diff --git a/Build/Gruntfile.js b/Build/Gruntfile.js index 1774f0e4f5aa4ae7c5db09b00175f561ec2ebc52..818c1fc2680c2003ca28435c43d49f170350857e 100644 --- a/Build/Gruntfile.js +++ b/Build/Gruntfile.js @@ -242,11 +242,9 @@ module.exports = function (grunt) { cwd: '<%= paths.root %>Build/JavaScript/', src: ['**/*.js', '**/*.js.map'], dest: '<%= paths.sysext %>', - rename: function (dest, src) { - var srccleaned = src.replace('Resources/Public/TypeScript', 'Resources/Public/JavaScript'); - srccleaned = srccleaned.replace('Tests/', 'Tests/JavaScript/'); - return dest + srccleaned; - } + rename: (dest, src) => dest + src + .replace('/', '/Resources/Public/JavaScript/') + .replace('/Resources/Public/JavaScript/tests/', '/Tests/JavaScript/') }] }, core_icons: { @@ -887,9 +885,9 @@ module.exports = function (grunt) { const config = grunt.file.readJSON("tsconfig.json"); const typescriptPath = grunt.config.get('paths.typescript'); config.compilerOptions.paths = {}; - grunt.file.expand(typescriptPath + '*/Resources/Public/TypeScript').map(dir => dir.replace(typescriptPath, '')).forEach((path) => { - const extname = ('_' + path.match(/^([^\/]+?)\//)[1]).replace(/_./g, (match) => match.charAt(1).toUpperCase()); - config.compilerOptions.paths['TYPO3/CMS/' + extname + '/*'] = [path + '/*']; + grunt.file.expand(typescriptPath + '*/').map(dir => dir.replace(typescriptPath, '')).forEach((path) => { + const extname = path.match(/^([^\/]+?)\//)[1].replace(/_/g, '-') + config.compilerOptions.paths['@typo3/' + extname + '/*'] = [path + '*']; }); grunt.file.write('tsconfig.json', JSON.stringify(config, null, 4) + '\n'); diff --git a/Build/JSUnit/karma.conf.js b/Build/JSUnit/karma.conf.js index 5509a1112620590c3fe45cf2184fe0fe1e6fa46a..a35ba67b524ca04be89eda2f6bef56772e1b3439 100644 --- a/Build/JSUnit/karma.conf.js +++ b/Build/JSUnit/karma.conf.js @@ -67,9 +67,9 @@ module.exports = function(config) { } } - if (source.startsWith('TYPO3/CMS')) { - const parts = source.substr(10).split('/'); - const extension = parts.shift().split(/(?=[A-Z])/).join('_').toLowerCase(); + if (source.startsWith('@typo3')) { + const parts = source.substr(7).split('/'); + const extension = parts.shift().replace(/-/g, '_'); const path = parts.join('/'); const fullPath = `typo3/sysext/${extension}/Resources/Public/JavaScript/${path}`; diff --git a/Build/Sources/TypeScript/adminpanel/Resources/Public/TypeScript/AdminPanel.ts b/Build/Sources/TypeScript/adminpanel/admin-panel.ts similarity index 100% rename from Build/Sources/TypeScript/adminpanel/Resources/Public/TypeScript/AdminPanel.ts rename to Build/Sources/TypeScript/adminpanel/admin-panel.ts diff --git a/Build/Sources/TypeScript/adminpanel/Resources/Public/TypeScript/Modules/Cache.ts b/Build/Sources/TypeScript/adminpanel/modules/cache.ts similarity index 100% rename from Build/Sources/TypeScript/adminpanel/Resources/Public/TypeScript/Modules/Cache.ts rename to Build/Sources/TypeScript/adminpanel/modules/cache.ts diff --git a/Build/Sources/TypeScript/adminpanel/Resources/Public/TypeScript/Modules/Preview.ts b/Build/Sources/TypeScript/adminpanel/modules/preview.ts similarity index 100% rename from Build/Sources/TypeScript/adminpanel/Resources/Public/TypeScript/Modules/Preview.ts rename to Build/Sources/TypeScript/adminpanel/modules/preview.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/index.d.ts b/Build/Sources/TypeScript/backend/Input/index.d.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/index.d.ts rename to Build/Sources/TypeScript/backend/Input/index.d.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/AbstractAction.ts b/Build/Sources/TypeScript/backend/action-button/abstract-action.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/AbstractAction.ts rename to Build/Sources/TypeScript/backend/action-button/abstract-action.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/DeferredAction.ts b/Build/Sources/TypeScript/backend/action-button/deferred-action.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/DeferredAction.ts rename to Build/Sources/TypeScript/backend/action-button/deferred-action.ts index 5d5e90475a376f40880acc0c9336dddc6b002d8b..b4044ea50940922b763133ae3c293ecb7c564666 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/DeferredAction.ts +++ b/Build/Sources/TypeScript/backend/action-button/deferred-action.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import {AbstractAction} from './AbstractAction'; -import Icons from '../Icons'; +import {AbstractAction} from './abstract-action'; +import Icons from '../icons'; /** * Action used when an operation execution time is unknown. diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/ImmediateAction.ts b/Build/Sources/TypeScript/backend/action-button/immediate-action.ts similarity index 93% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/ImmediateAction.ts rename to Build/Sources/TypeScript/backend/action-button/immediate-action.ts index fd2dcec9c165dba9561c8d660c7778a09653b9cd..4de8800c5e64afa7c90655325c0d4d18cd66b90d 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionButton/ImmediateAction.ts +++ b/Build/Sources/TypeScript/backend/action-button/immediate-action.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import {AbstractAction} from './AbstractAction'; +import {AbstractAction} from './abstract-action'; /** * Action used when an operation is executed immediately. diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionDispatcher.ts b/Build/Sources/TypeScript/backend/action-dispatcher.ts similarity index 87% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionDispatcher.ts rename to Build/Sources/TypeScript/backend/action-dispatcher.ts index 12586ea04c0c6618ab8a4308d4b1fa304cf8bf8f..263f3bf41b0d25e44dc6f94f4a2c65de11cce6a1 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ActionDispatcher.ts +++ b/Build/Sources/TypeScript/backend/action-dispatcher.ts @@ -11,18 +11,18 @@ * The TYPO3 project - inspiring people to share! */ -import InfoWindow from 'TYPO3/CMS/Backend/InfoWindow'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import shortcutMenu from 'TYPO3/CMS/Backend/Toolbar/ShortcutMenu'; -import windowManager from 'TYPO3/CMS/Backend/WindowManager'; -import moduleMenuApp from 'TYPO3/CMS/Backend/ModuleMenu'; -import documentService from 'TYPO3/CMS/Core/DocumentService'; -import Utility from 'TYPO3/CMS/Backend/Utility'; +import InfoWindow from '@typo3/backend/info-window'; +import RegularEvent from '@typo3/core/event/regular-event'; +import shortcutMenu from '@typo3/backend/toolbar/shortcut-menu'; +import windowManager from '@typo3/backend/window-manager'; +import moduleMenuApp from '@typo3/backend/module-menu'; +import documentService from '@typo3/core/document-service'; +import Utility from '@typo3/backend/utility'; declare type ActionDispatchArgument = string | HTMLElement | Event; /** - * Module: TYPO3/CMS/Backend/ActionDispatcher + * Module: @typo3/backend/action-dispatcher * * @example * <a class="btn btn-default" href="#" diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/AjaxDataHandler.ts b/Build/Sources/TypeScript/backend/ajax-data-handler.ts similarity index 93% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/AjaxDataHandler.ts rename to Build/Sources/TypeScript/backend/ajax-data-handler.ts index 76aa70534e48b04e112d9adc9ee90d8efc87da21..605768109d445306be40d0b305cc54a87240e30a 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/AjaxDataHandler.ts +++ b/Build/Sources/TypeScript/backend/ajax-data-handler.ts @@ -11,18 +11,18 @@ * The TYPO3 project - inspiring people to share! */ -import {BroadcastMessage} from 'TYPO3/CMS/Backend/BroadcastMessage'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {SeverityEnum} from './Enum/Severity'; -import MessageInterface from './AjaxDataHandler/MessageInterface'; -import ResponseInterface from './AjaxDataHandler/ResponseInterface'; +import {BroadcastMessage} from '@typo3/backend/broadcast-message'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {SeverityEnum} from './enum/severity'; +import MessageInterface from './ajax-data-handler/message-interface'; +import ResponseInterface from './ajax-data-handler/response-interface'; import $ from 'jquery'; -import BroadcastService from 'TYPO3/CMS/Backend/BroadcastService'; -import Icons from './Icons'; -import Modal from './Modal'; -import Notification from './Notification'; -import Viewport from './Viewport'; +import BroadcastService from '@typo3/backend/broadcast-service'; +import Icons from './icons'; +import Modal from './modal'; +import Notification from './notification'; +import Viewport from './viewport'; enum Identifiers { hide = '.t3js-record-hide', @@ -38,7 +38,7 @@ interface AfterProcessEventDict { } /** - * Module: TYPO3/CMS/Backend/AjaxDataHandler + * Module: @typo3/backend/ajax-data-handler * Javascript functions to work with AJAX and interacting with Datahandler * through \TYPO3\CMS\Backend\Controller\SimpleDataHandlerController->processAjaxRequest (record_process route) */ diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/AjaxDataHandler/MessageInterface.ts b/Build/Sources/TypeScript/backend/ajax-data-handler/message-interface.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/AjaxDataHandler/MessageInterface.ts rename to Build/Sources/TypeScript/backend/ajax-data-handler/message-interface.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/AjaxDataHandler/ResponseInterface.ts b/Build/Sources/TypeScript/backend/ajax-data-handler/response-interface.ts similarity index 91% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/AjaxDataHandler/ResponseInterface.ts rename to Build/Sources/TypeScript/backend/ajax-data-handler/response-interface.ts index e30dfc9686db1e1c4ed5e7e7a03329af93799cb0..edab0d4cdd3ed848ecd0466c15af8d027b70786c 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/AjaxDataHandler/ResponseInterface.ts +++ b/Build/Sources/TypeScript/backend/ajax-data-handler/response-interface.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import MessageInterface from './MessageInterface'; +import MessageInterface from './message-interface'; export default interface ResponseInterface { redirect: string; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/BackendException.ts b/Build/Sources/TypeScript/backend/backend-exception.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/BackendException.ts rename to Build/Sources/TypeScript/backend/backend-exception.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/BroadcastMessage.ts b/Build/Sources/TypeScript/backend/broadcast-message.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/BroadcastMessage.ts rename to Build/Sources/TypeScript/backend/broadcast-message.ts index 5b599c274d4d05bb76a522924bf54a6e5cf7e205..c774eb94625483745feaab830e2828eb14156563 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/BroadcastMessage.ts +++ b/Build/Sources/TypeScript/backend/broadcast-message.ts @@ -12,7 +12,7 @@ */ /** - * @module TYPO3/CMS/Backend/BroadcastMessage + * @module @typo3/backend/broadcast-message */ export class BroadcastMessage { readonly componentName: string; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/BroadcastService.ts b/Build/Sources/TypeScript/backend/broadcast-service.ts similarity index 87% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/BroadcastService.ts rename to Build/Sources/TypeScript/backend/broadcast-service.ts index 4e466b8d7280bcd20ea4d5641cbb6e53088341a7..3ecd0d6564a08a3de8aa5ca5f144fd76eea549ba 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/BroadcastService.ts +++ b/Build/Sources/TypeScript/backend/broadcast-service.ts @@ -12,11 +12,11 @@ */ import 'broadcastchannel'; -import {BroadcastMessage} from 'TYPO3/CMS/Backend/BroadcastMessage'; -import {MessageUtility} from 'TYPO3/CMS/Backend/Utility/MessageUtility'; +import {BroadcastMessage} from '@typo3/backend/broadcast-message'; +import {MessageUtility} from '@typo3/backend/utility/message-utility'; /** - * @module TYPO3/CMS/Backend/BroadcastService + * @module @typo3/backend/broadcast-service */ class BroadcastService { private readonly channel: BroadcastChannel; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ClipboardPanel.ts b/Build/Sources/TypeScript/backend/clipboard-panel.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ClipboardPanel.ts rename to Build/Sources/TypeScript/backend/clipboard-panel.ts index ee0e44f3d6105630dcc23a786f0e5b2d8d932503..5fb2242aaa40c6838287f22cb3e87a710d7a8d68 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ClipboardPanel.ts +++ b/Build/Sources/TypeScript/backend/clipboard-panel.ts @@ -16,11 +16,11 @@ import {customElement, property} from 'lit/decorators'; import {until} from 'lit/directives/until'; import {unsafeHTML} from 'lit/directives/unsafe-html'; import {classMap} from 'lit/directives/class-map'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import 'TYPO3/CMS/Backend/Element/SpinnerElement'; -import 'TYPO3/CMS/Backend/Element/IconElement'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import Notification from '@typo3/backend/notification'; +import '@typo3/backend/element/spinner-element'; +import '@typo3/backend/element/icon-element'; enum CopyMode { cut = 'cut', @@ -57,7 +57,7 @@ interface DispatchArgs { } /** - * Module: TYPO3/CMS/Backend/ClipboardPanel + * Module: @typo3/backend/clipboard-panel * * @example * <typo3-backend-clipboard-panel return-url="/typo3/module" table="_FILE"></typo3-backend-clipboard-panel> diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ColorPicker.ts b/Build/Sources/TypeScript/backend/color-picker.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ColorPicker.ts rename to Build/Sources/TypeScript/backend/color-picker.ts index aa362c6598066d423fccbbbeca39f8fe2c3d9548..0689cd3c26c70183de4e433a496eb926b11c8a04 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ColorPicker.ts +++ b/Build/Sources/TypeScript/backend/color-picker.ts @@ -15,9 +15,9 @@ import $ from 'jquery'; import 'jquery/minicolors'; /** - * Module: TYPO3/CMS/Backend/ColorPicker + * Module: @typo3/backend/color-picker * contains all logic for the color picker used in FormEngine - * @exports TYPO3/CMS/Backend/ColorPicker + * @exports @typo3/backend/color-picker */ class ColorPicker { /** diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ColumnSelectorButton.ts b/Build/Sources/TypeScript/backend/column-selector-button.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ColumnSelectorButton.ts rename to Build/Sources/TypeScript/backend/column-selector-button.ts index 95a81b8797d757a173fdb2934abcf8fbaeaeb28a..a130bf9da3e459911c0469fbb94ad2ca7173347d 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ColumnSelectorButton.ts +++ b/Build/Sources/TypeScript/backend/column-selector-button.ts @@ -13,13 +13,13 @@ import {html, TemplateResult, LitElement} from 'lit'; import {customElement, property} from 'lit/decorators'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import Severity from 'TYPO3/CMS/Backend/Severity'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {lll} from 'TYPO3/CMS/Core/lit-helper'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import Notification from 'TYPO3/CMS/Backend/Notification'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import Severity from '@typo3/backend/severity'; +import Modal from '@typo3/backend/modal'; +import {lll} from '@typo3/core/lit-helper'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import Notification from '@typo3/backend/notification'; enum Selectors { columnsSelector = '.t3js-column-selector', @@ -35,7 +35,7 @@ enum SelectorActions { } /** - * Module: TYPO3/CMS/Backend/ColumnSelectorButton + * Module: @typo3/backend/column-selector-button * * @example * <typo3-backend-column-selector-button diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextHelp.ts b/Build/Sources/TypeScript/backend/context-help.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextHelp.ts rename to Build/Sources/TypeScript/backend/context-help.ts index 197c4c9a0c325ea2a6eb7b03ef38ab9fbd5f66d8..b9fe5a5a0d51766a3b45ae7239f6031babe700db 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextHelp.ts +++ b/Build/Sources/TypeScript/backend/context-help.ts @@ -13,10 +13,10 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; import {Popover as BootstrapPopover} from 'bootstrap'; -import Popover from './Popover'; +import Popover from './popover'; interface HelpData { title: string; @@ -24,9 +24,9 @@ interface HelpData { } /** - * Module: TYPO3/CMS/Backend/ContextHelp + * Module: @typo3/backend/context-help * API for context help. - * @exports TYPO3/CMS/Backend/ContextHelp + * @exports @typo3/backend/context-help */ class ContextHelp { private ajaxUrl: string = TYPO3.settings.ajaxUrls.context_help; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextMenuActions.ts b/Build/Sources/TypeScript/backend/context-menu-actions.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextMenuActions.ts rename to Build/Sources/TypeScript/backend/context-menu-actions.ts index 54a79a9f64c54475f8d64067a8f714736d8872a1..237ef64cce72019a00f6b3df2e69c4081c479302 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextMenuActions.ts +++ b/Build/Sources/TypeScript/backend/context-menu-actions.ts @@ -11,21 +11,21 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {SeverityEnum} from './Enum/Severity'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {SeverityEnum} from './enum/severity'; import $ from 'jquery'; -import AjaxDataHandler from './AjaxDataHandler'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import InfoWindow from './InfoWindow'; -import Modal from './Modal'; -import ModuleMenu from './ModuleMenu'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import Viewport from './Viewport'; -import {ModuleStateStorage} from './Storage/ModuleStateStorage'; -import {NewContentElementWizard} from 'TYPO3/CMS/Backend/NewContentElementWizard'; +import AjaxDataHandler from './ajax-data-handler'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import InfoWindow from './info-window'; +import Modal from './modal'; +import ModuleMenu from './module-menu'; +import Notification from '@typo3/backend/notification'; +import Viewport from './viewport'; +import {ModuleStateStorage} from './storage/module-state-storage'; +import {NewContentElementWizard} from '@typo3/backend/new-content-element-wizard'; /** - * @exports TYPO3/CMS/Backend/ContextMenuActions + * @exports @typo3/backend/context-menu-actions */ class ContextMenuActions { /** diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextMenu.ts b/Build/Sources/TypeScript/backend/context-menu.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextMenu.ts rename to Build/Sources/TypeScript/backend/context-menu.ts index ae7299b6aa29d1972bc01b51c44213c4456b5345..a06790ce4c4ff3ca0b4460c5df61ef632159c5dd 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextMenu.ts +++ b/Build/Sources/TypeScript/backend/context-menu.ts @@ -12,12 +12,12 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import ContextMenuActions from './ContextMenuActions'; -import DebounceEvent from 'TYPO3/CMS/Core/Event/DebounceEvent'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import ThrottleEvent from 'TYPO3/CMS/Core/Event/ThrottleEvent'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import ContextMenuActions from './context-menu-actions'; +import DebounceEvent from '@typo3/core/event/debounce-event'; +import RegularEvent from '@typo3/core/event/regular-event'; +import ThrottleEvent from '@typo3/core/event/throttle-event'; interface MousePosition { X: number; @@ -43,7 +43,7 @@ interface MenuItems { } /** - * Module: TYPO3/CMS/Backend/ContextMenu + * Module: @typo3/backend/context-menu * Container used to load the context menu via AJAX to render the result in a layer next to the mouse cursor */ class ContextMenu { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/CopyToClipboard.ts b/Build/Sources/TypeScript/backend/copy-to-clipboard.ts similarity index 93% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/CopyToClipboard.ts rename to Build/Sources/TypeScript/backend/copy-to-clipboard.ts index d03251233493ca79d34b7de8937690c9d545127f..7a530e06711279b538ff46168a0f5eaad1eb1526 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/CopyToClipboard.ts +++ b/Build/Sources/TypeScript/backend/copy-to-clipboard.ts @@ -13,11 +13,11 @@ import {html, TemplateResult, LitElement} from 'lit'; import {customElement, property} from 'lit/decorators'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import {lll} from 'TYPO3/CMS/Core/lit-helper'; +import Notification from '@typo3/backend/notification'; +import {lll} from '@typo3/core/lit-helper'; /** - * Module: TYPO3/CMS/Backend/CopyToClipboard + * Module: @typo3/backend/copy-to-clipboard * * This module can be used to copy a given text to * the operating systems' clipboard. diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DateTimePicker.ts b/Build/Sources/TypeScript/backend/date-time-picker.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DateTimePicker.ts rename to Build/Sources/TypeScript/backend/date-time-picker.ts index 31c3df822771f68421c3a9fc85182619051b8e6a..1d75dce77232ee5cef02ccc22b2f606b4c0307fb 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DateTimePicker.ts +++ b/Build/Sources/TypeScript/backend/date-time-picker.ts @@ -13,15 +13,15 @@ import flatpickr from 'flatpickr/flatpickr.min'; import moment from 'moment'; -import PersistentStorage from './Storage/Persistent'; -import ThrottleEvent from 'TYPO3/CMS/Core/Event/ThrottleEvent'; +import PersistentStorage from './storage/persistent'; +import ThrottleEvent from '@typo3/core/event/throttle-event'; interface FlatpickrInputElement extends HTMLInputElement { _flatpickr: any; } /** - * Module: TYPO3/CMS/Backend/DateTimePicker + * Module: @typo3/backend/date-time-picker * contains all logic for the date time picker used in FormEngine * and EXT:belog and EXT:scheduler */ diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DebugConsole.ts b/Build/Sources/TypeScript/backend/debug-console.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DebugConsole.ts rename to Build/Sources/TypeScript/backend/debug-console.ts index 272da02e3fb1e0c62c89f71e4fe0e27022924a85..c820f3764e5a76bf8bc75d42db844acb9a2f93b1 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DebugConsole.ts +++ b/Build/Sources/TypeScript/backend/debug-console.ts @@ -14,9 +14,9 @@ import $ from 'jquery'; /** - * Module: TYPO3/CMS/Backend/DebugConsole + * Module: @typo3/backend/debug-console * The debug console shown at the bottom of the backend - * @exports TYPO3/CMS/Backend/DebugConsole + * @exports @typo3/backend/debug-console */ class DebugConsole { private $consoleDom: any; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DocumentHeader.ts b/Build/Sources/TypeScript/backend/document-header.ts similarity index 93% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DocumentHeader.ts rename to Build/Sources/TypeScript/backend/document-header.ts index 337230710a3478c286af60c1c7de8d3859af7c08..ef8534419e5b0fd3b80d5e0ca0dc94bdcb3366b4 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DocumentHeader.ts +++ b/Build/Sources/TypeScript/backend/document-header.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import ThrottleEvent from 'TYPO3/CMS/Core/Event/ThrottleEvent'; +import DocumentService from '@typo3/core/document-service'; +import ThrottleEvent from '@typo3/core/event/throttle-event'; /** - * Module: TYPO3/CMS/Backend/DocumentHeader + * Module: @typo3/backend/document-header * Folds docHeader when scrolling down, and reveals when scrollup up */ class DocumentHeader { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DocumentSaveActions.ts b/Build/Sources/TypeScript/backend/document-save-actions.ts similarity index 99% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DocumentSaveActions.ts rename to Build/Sources/TypeScript/backend/document-save-actions.ts index bd0dd9686f7f48ea87371f7100d7e3c25d982f1d..53d6e945de713d59482eb536e3f84b09abacd73d 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DocumentSaveActions.ts +++ b/Build/Sources/TypeScript/backend/document-save-actions.ts @@ -12,7 +12,7 @@ */ import $ from 'jquery'; -import Icons from './Icons'; +import Icons from './icons'; class DocumentSaveActions { private static instance: DocumentSaveActions = null; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DragUploader.ts b/Build/Sources/TypeScript/backend/drag-uploader.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DragUploader.ts rename to Build/Sources/TypeScript/backend/drag-uploader.ts index 73e9e1112b6f657c71a48a6f49acd2c37bff56d7..37bb5a24cf2ec593e887f8f1bcaa0480a192c826 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/DragUploader.ts +++ b/Build/Sources/TypeScript/backend/drag-uploader.ts @@ -13,15 +13,15 @@ import $ from 'jquery'; import moment from 'moment'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {SeverityEnum} from './Enum/Severity'; -import {MessageUtility} from './Utility/MessageUtility'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {SeverityEnum} from './enum/severity'; +import {MessageUtility} from './utility/message-utility'; import NProgress from 'nprogress'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Modal from './Modal'; -import Notification from './Notification'; -import ImmediateAction from 'TYPO3/CMS/Backend/ActionButton/ImmediateAction'; -import Md5 from 'TYPO3/CMS/Backend/Hashing/Md5'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Modal from './modal'; +import Notification from './notification'; +import ImmediateAction from '@typo3/backend/action-button/immediate-action'; +import Md5 from '@typo3/backend/hashing/md5'; /** * Possible actions for conflicts w/ existing files diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/IconElement.ts b/Build/Sources/TypeScript/backend/element/icon-element.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/IconElement.ts rename to Build/Sources/TypeScript/backend/element/icon-element.ts index b7dc05b2ed586b1aa1281092930f2feac7ca2fe2..41fe8769ea80c9253bea03f25a1e36d5870453f9 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/IconElement.ts +++ b/Build/Sources/TypeScript/backend/element/icon-element.ts @@ -15,9 +15,9 @@ import {html, css, unsafeCSS, LitElement, TemplateResult, CSSResult} from 'lit'; import {customElement, property} from 'lit/decorators'; import {unsafeHTML} from 'lit/directives/unsafe-html'; import {until} from 'lit/directives/until'; -import {Sizes, States, MarkupIdentifiers} from '../Enum/IconTypes'; -import Icons from '../Icons'; -import 'TYPO3/CMS/Backend/Element/SpinnerElement'; +import {Sizes, States, MarkupIdentifiers} from '../enum/icon-types'; +import Icons from '../icons'; +import '@typo3/backend/element/spinner-element'; const iconUnifyModifier = 0.86; const iconSize = (identifier: CSSResult, size: number) => css` @@ -28,7 +28,7 @@ const iconSize = (identifier: CSSResult, size: number) => css` `; /** - * Module: TYPO3/CMS/Backend/Element/IconElement + * Module: @typo3/backend/element/icon-element * * @example * <typo3-backend-icon identifier="data-view-page" size="small"></typo3-backend-icon> diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/ImmediateActionElement.ts b/Build/Sources/TypeScript/backend/element/immediate-action-element.ts similarity index 81% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/ImmediateActionElement.ts rename to Build/Sources/TypeScript/backend/element/immediate-action-element.ts index f66244b2794c841eb70ba4e97b9944edc135da2f..6a3a6ece01246f591eb6d667323cf52ced744395 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/ImmediateActionElement.ts +++ b/Build/Sources/TypeScript/backend/element/immediate-action-element.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import Utility from 'TYPO3/CMS/Backend/Utility'; -import {EventDispatcher} from 'TYPO3/CMS/Backend/Event/EventDispatcher'; +import Utility from '@typo3/backend/utility'; +import {EventDispatcher} from '@typo3/backend/event/event-dispatcher'; /** - * Module: TYPO3/CMS/Backend/Element/ImmediateActionElement + * Module: @typo3/backend/element/immediate-action-element * * @example * <typo3-immediate-action action="TYPO3.ModuleMenu.App.refreshMenu"></typo3-immediate-action> @@ -30,18 +30,18 @@ export class ImmediateActionElement extends HTMLElement { private static async getDelegate(action: string): Promise<Function> { switch (action) { case 'TYPO3.ModuleMenu.App.refreshMenu': - const {default: moduleMenuApp} = await import('TYPO3/CMS/Backend/ModuleMenu'); + const {default: moduleMenuApp} = await import('@typo3/backend/module-menu'); return moduleMenuApp.App.refreshMenu.bind(moduleMenuApp.App); case 'TYPO3.Backend.Topbar.refresh': - const {default: viewportObject} = await import('TYPO3/CMS/Backend/Viewport'); + const {default: viewportObject} = await import('@typo3/backend/viewport'); return viewportObject.Topbar.refresh.bind(viewportObject.Topbar); case 'TYPO3.WindowManager.localOpen': - const {default: windowManager} = await import('TYPO3/CMS/Backend/WindowManager'); + const {default: windowManager} = await import('@typo3/backend/window-manager'); return windowManager.localOpen.bind(windowManager); case 'TYPO3.Backend.Storage.ModuleStateStorage.update': - return (await import('TYPO3/CMS/Backend/Storage/ModuleStateStorage')).ModuleStateStorage.update; + return (await import('@typo3/backend/storage/module-state-storage')).ModuleStateStorage.update; case 'TYPO3.Backend.Storage.ModuleStateStorage.updateWithCurrentMount': - return (await import('TYPO3/CMS/Backend/Storage/ModuleStateStorage')).ModuleStateStorage.updateWithCurrentMount; + return (await import('@typo3/backend/storage/module-state-storage')).ModuleStateStorage.updateWithCurrentMount; case 'TYPO3.Backend.Event.EventDispatcher.dispatchCustomEvent': return EventDispatcher.dispatchCustomEvent; default: diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/SpinnerElement.ts b/Build/Sources/TypeScript/backend/element/spinner-element.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/SpinnerElement.ts rename to Build/Sources/TypeScript/backend/element/spinner-element.ts index 29053a8d883f528b7383d352ce9943a05b982134..cd94f4e5c8e71fe5a8b1e92035c369d156f5b0fc 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/SpinnerElement.ts +++ b/Build/Sources/TypeScript/backend/element/spinner-element.ts @@ -13,7 +13,7 @@ import {html, css, LitElement, TemplateResult} from 'lit'; import {customElement, property} from 'lit/decorators'; -import {Sizes} from '../Enum/IconTypes'; +import {Sizes} from '../enum/icon-types'; enum Variant { light = 'light', @@ -21,7 +21,7 @@ enum Variant { } /** - * Module: TYPO3/CMS/Backend/Element/SpinnerElement + * Module: @typo3/backend/element/spinner-element * * @example * <typo3-backend-spinner size="small" variant="dark"></typo3-backend-spinner> diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/TableWizardElement.ts b/Build/Sources/TypeScript/backend/element/table-wizard-element.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/TableWizardElement.ts rename to Build/Sources/TypeScript/backend/element/table-wizard-element.ts index 56894bb5c7e14bc8eafc65827d224553bd78dee4..573f72f880205a68f6e7db7ce67745c08af488a4 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Element/TableWizardElement.ts +++ b/Build/Sources/TypeScript/backend/element/table-wizard-element.ts @@ -13,14 +13,14 @@ import { html, LitElement, TemplateResult, render } from 'lit'; import { customElement, property } from 'lit/decorators'; -import { lll } from 'TYPO3/CMS/Core/lit-helper'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import Severity from 'TYPO3/CMS/Backend/Severity'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import { SeverityEnum } from 'TYPO3/CMS/Backend/Enum/Severity'; +import { lll } from '@typo3/core/lit-helper'; +import '@typo3/backend/element/icon-element'; +import Severity from '@typo3/backend/severity'; +import Modal from '@typo3/backend/modal'; +import { SeverityEnum } from '@typo3/backend/enum/severity'; /** - * Module: TYPO3/CMS/Backend/Element/TableWizardElement + * Module: @typo3/backend/element/table-wizard-element * * @example * <typo3-backend-table-wizard table="[["quot;a"quot;,"quot;b"quot;],["quot;c"quot;,"quot;d"quot;]]"> diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Enum/IconTypes.ts b/Build/Sources/TypeScript/backend/enum/icon-types.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Enum/IconTypes.ts rename to Build/Sources/TypeScript/backend/enum/icon-types.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Enum/KeyTypes.ts b/Build/Sources/TypeScript/backend/enum/key-types.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Enum/KeyTypes.ts rename to Build/Sources/TypeScript/backend/enum/key-types.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Enum/Severity.ts b/Build/Sources/TypeScript/backend/enum/severity.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Enum/Severity.ts rename to Build/Sources/TypeScript/backend/enum/severity.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Enum/Viewport/ScaffoldIdentifier.ts b/Build/Sources/TypeScript/backend/enum/viewport/scaffold-identifier.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Enum/Viewport/ScaffoldIdentifier.ts rename to Build/Sources/TypeScript/backend/enum/viewport/scaffold-identifier.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/ClientRequest.ts b/Build/Sources/TypeScript/backend/event/client-request.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/ClientRequest.ts rename to Build/Sources/TypeScript/backend/event/client-request.ts index dd5a7128ef3cecee26a79c4c8b05850b54b60bf1..80510b96412d89ee3e3994ea32938a8eff83a7a2 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/ClientRequest.ts +++ b/Build/Sources/TypeScript/backend/event/client-request.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import InteractionRequest from './InteractionRequest'; +import InteractionRequest from './interaction-request'; class ClientRequest extends InteractionRequest { public readonly clientEvent: any; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/Consumable.ts b/Build/Sources/TypeScript/backend/event/consumable.ts similarity index 90% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/Consumable.ts rename to Build/Sources/TypeScript/backend/event/consumable.ts index 755ced4468713e626ca98b42f6081d5d5bddbc01..6a5840eda5f8ef4409dd206b0ad9f89c3f63344b 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/Consumable.ts +++ b/Build/Sources/TypeScript/backend/event/consumable.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import InteractionRequest from './InteractionRequest'; +import InteractionRequest from './interaction-request'; interface Consumable { consume(interactionRequest: InteractionRequest): any; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/ConsumerScope.ts b/Build/Sources/TypeScript/backend/event/consumer-scope.ts similarity index 93% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/ConsumerScope.ts rename to Build/Sources/TypeScript/backend/event/consumer-scope.ts index f3f30a4608b6925993bff847d4692fb2d9ad0a37..7ed3249d500ff77dda878e861506cd21307b5ca6 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/ConsumerScope.ts +++ b/Build/Sources/TypeScript/backend/event/consumer-scope.ts @@ -12,8 +12,8 @@ */ import $ from 'jquery'; -import Consumable from './Consumable'; -import InteractionRequest from './InteractionRequest'; +import Consumable from './consumable'; +import InteractionRequest from './interaction-request'; class ConsumerScope { private consumers: Consumable[] = []; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/EventDispatcher.ts b/Build/Sources/TypeScript/backend/event/event-dispatcher.ts similarity index 93% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/EventDispatcher.ts rename to Build/Sources/TypeScript/backend/event/event-dispatcher.ts index 4eb69a5635f9a7a15c3c72ee896ff12231b14428..97a416fc65d6691d928402086931c547914fec95 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/EventDispatcher.ts +++ b/Build/Sources/TypeScript/backend/event/event-dispatcher.ts @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/Backend/Event/EventDispatcher + * Module: @typo3/backend/event/event-dispatcher */ export class EventDispatcher { static dispatchCustomEvent(name: string, detail: any = null, useTop: boolean = false): void { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/InteractionRequestAssignment.ts b/Build/Sources/TypeScript/backend/event/interaction-request-assignment.ts similarity index 91% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/InteractionRequestAssignment.ts rename to Build/Sources/TypeScript/backend/event/interaction-request-assignment.ts index 8fa66b2d2e004e478c32017aa7244a943d8f1738..e54efc959eea7d14956abd3e0ecb9eca43f3c6c6 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/InteractionRequestAssignment.ts +++ b/Build/Sources/TypeScript/backend/event/interaction-request-assignment.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import InteractionRequest from './InteractionRequest'; +import InteractionRequest from './interaction-request'; interface InteractionRequestAssignment { request: InteractionRequest; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/InteractionRequestMap.ts b/Build/Sources/TypeScript/backend/event/interaction-request-map.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/InteractionRequestMap.ts rename to Build/Sources/TypeScript/backend/event/interaction-request-map.ts index cb47d4cbd6d41606e67cfc0118470053e1402382..7f6d9de6b6f5b2c678a095699622c07ce06673b1 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/InteractionRequestMap.ts +++ b/Build/Sources/TypeScript/backend/event/interaction-request-map.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import InteractionRequest from './InteractionRequest'; -import InteractionRequestAssignment from './InteractionRequestAssignment'; +import InteractionRequest from './interaction-request'; +import InteractionRequestAssignment from './interaction-request-assignment'; class InteractionRequestMap { private assignments: InteractionRequestAssignment[] = []; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/InteractionRequest.ts b/Build/Sources/TypeScript/backend/event/interaction-request.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/InteractionRequest.ts rename to Build/Sources/TypeScript/backend/event/interaction-request.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/TriggerRequest.ts b/Build/Sources/TypeScript/backend/event/trigger-request.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/TriggerRequest.ts rename to Build/Sources/TypeScript/backend/event/trigger-request.ts index 8db5dfc6cc290f4a5ee13ae17adf30aabee78693..13ff69a16cd380162d3a1cfdf160fc3b1a33f75f 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Event/TriggerRequest.ts +++ b/Build/Sources/TypeScript/backend/event/trigger-request.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import InteractionRequest from './InteractionRequest'; +import InteractionRequest from './interaction-request'; class TriggerRequest extends InteractionRequest { constructor(type: string, parentRequest: InteractionRequest = null) { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineLinkBrowserAdapter.ts b/Build/Sources/TypeScript/backend/form-engine-link-browser-adapter.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineLinkBrowserAdapter.ts rename to Build/Sources/TypeScript/backend/form-engine-link-browser-adapter.ts index a2fd5ec6bf85310f96fbdfdf7368bbea12568c41..e431ac2f1d015926cc700ec4566273e8baa003d4 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineLinkBrowserAdapter.ts +++ b/Build/Sources/TypeScript/backend/form-engine-link-browser-adapter.ts @@ -12,12 +12,12 @@ */ /** - * Module: TYPO3/CMS/Backend/FormEngineLinkBrowserAdapter + * Module: @typo3/backend/form-engine-link-browser-adapter * LinkBrowser communication with parent window */ import $ from 'jquery'; -import LinkBrowser from 'TYPO3/CMS/Recordlist/LinkBrowser' -import Modal from 'TYPO3/CMS/Backend/Modal'; +import LinkBrowser from '@typo3/recordlist/link-browser' +import Modal from '@typo3/backend/modal'; interface OnFieldChangeItem { name: string; @@ -27,7 +27,7 @@ interface OnFieldChangeItem { export default (function() { /** - * @exports TYPO3/CMS/Backend/FormEngineLinkBrowserAdapter + * @exports @typo3/backend/form-engine-link-browser-adapter */ const FormEngineLinkBrowserAdapter: any = { onFieldChangeItems: null // those are set in the module initializer function in PHP diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineReview.ts b/Build/Sources/TypeScript/backend/form-engine-review.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineReview.ts rename to Build/Sources/TypeScript/backend/form-engine-review.ts index 918c016e49ef7a526968f66b6cdbeade249e32e0..8b637729251985830c77c57901ba9f4aecba1f6b 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineReview.ts +++ b/Build/Sources/TypeScript/backend/form-engine-review.ts @@ -13,12 +13,12 @@ import 'bootstrap'; import $ from 'jquery'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import FormEngine from '@typo3/backend/form-engine'; /** - * Module: TYPO3/CMS/Backend/FormEngineReview + * Module: @typo3/backend/form-engine-review * Enables interaction with record fields that need review - * @exports TYPO3/CMS/Backend/FormEngineReview + * @exports @typo3/backend/form-engine-review */ class FormEngineReview { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineSuggest.ts b/Build/Sources/TypeScript/backend/form-engine-suggest.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineSuggest.ts rename to Build/Sources/TypeScript/backend/form-engine-suggest.ts index 7de0d15b8d9911ef4aacc44008c3464025bb60c9..ec2164ead8ff38c420f96a9c203de8d3c83f7aec 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineSuggest.ts +++ b/Build/Sources/TypeScript/backend/form-engine-suggest.ts @@ -13,7 +13,7 @@ import $ from 'jquery'; import 'jquery/autocomplete'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import FormEngine from '@typo3/backend/form-engine'; // data structure returned by SuggestWizardDefaultReceiver::queryTable() interface SuggestEntry { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineValidation.ts b/Build/Sources/TypeScript/backend/form-engine-validation.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineValidation.ts rename to Build/Sources/TypeScript/backend/form-engine-validation.ts index c3a7fd85f976c62a0f6255546c56639bf06a0965..896b948a5ccdd045318043f841f90bd2bccd727b 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngineValidation.ts +++ b/Build/Sources/TypeScript/backend/form-engine-validation.ts @@ -12,16 +12,16 @@ */ /** - * Module: TYPO3/CMS/Backend/FormEngineValidation + * Module: @typo3/backend/form-engine-validation * Contains all JS functions related to TYPO3 TCEforms/FormEngineValidation * @internal */ import $ from 'jquery'; import moment from 'moment'; -import Md5 from 'TYPO3/CMS/Backend/Hashing/Md5'; -import DocumentSaveActions from 'TYPO3/CMS/Backend/DocumentSaveActions'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Severity from 'TYPO3/CMS/Backend/Severity'; +import Md5 from '@typo3/backend/hashing/md5'; +import DocumentSaveActions from '@typo3/backend/document-save-actions'; +import Modal from '@typo3/backend/modal'; +import Severity from '@typo3/backend/severity'; export default (function() { @@ -29,7 +29,7 @@ export default (function() { * The main FormEngineValidation object * * @type {{rulesSelector: string, inputSelector: string, markerSelector: string, groupFieldHiddenElement: string, relatedFieldSelector: string, errorClass: string, lastYear: number, lastDate: number, lastTime: number, passwordDummy: string}} - * @exports TYPO3/CMS/Backend/FormEngineValidation + * @exports @typo3/backend/form-engine-validation */ const FormEngineValidation: any = { rulesSelector: '[data-formengine-validation-rules]', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine.ts b/Build/Sources/TypeScript/backend/form-engine.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine.ts rename to Build/Sources/TypeScript/backend/form-engine.ts index ba1277aed7ab72819b931bdff085cd2bc7659cac..feb5b4b4aacef7bd17d21878a0edc507354ec7a1 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine.ts +++ b/Build/Sources/TypeScript/backend/form-engine.ts @@ -21,19 +21,19 @@ */ /** - * Module: TYPO3/CMS/Backend/FormEngine + * Module: @typo3/backend/form-engine */ import $ from 'jquery'; -import FormEngineValidation from 'TYPO3/CMS/Backend/FormEngineValidation'; -import DocumentSaveActions from 'TYPO3/CMS/Backend/DocumentSaveActions'; -import Icons from 'TYPO3/CMS/Backend/Icons'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import * as MessageUtility from 'TYPO3/CMS/Backend/Utility/MessageUtility'; -import Severity from 'TYPO3/CMS/Backend/Severity'; -import * as BackendExceptionModule from 'TYPO3/CMS/Backend/BackendException'; -import InteractionRequestMap from 'TYPO3/CMS/Backend/Event/InteractionRequestMap'; -import InteractionRequest from 'TYPO3/CMS/Backend/Event/InteractionRequest'; -import TriggerRequest from 'TYPO3/CMS/Backend/Event/TriggerRequest'; +import FormEngineValidation from '@typo3/backend/form-engine-validation'; +import DocumentSaveActions from '@typo3/backend/document-save-actions'; +import Icons from '@typo3/backend/icons'; +import Modal from '@typo3/backend/modal'; +import * as MessageUtility from '@typo3/backend/utility/message-utility'; +import Severity from '@typo3/backend/severity'; +import * as BackendExceptionModule from '@typo3/backend/backend-exception'; +import InteractionRequestMap from '@typo3/backend/event/interaction-request-map'; +import InteractionRequest from '@typo3/backend/event/interaction-request'; +import TriggerRequest from '@typo3/backend/event/trigger-request'; interface OnFieldChangeItem { name: string; @@ -91,7 +91,7 @@ export default (function() { }); /** - * @exports TYPO3/CMS/Backend/FormEngine + * @exports @typo3/backend/form-engine */ const FormEngine: any = { consumeTypes: ['typo3.setUrl', 'typo3.beforeSetUrl', 'typo3.refresh'], @@ -623,7 +623,7 @@ export default (function() { return !inputElement.classList.contains('t3js-color-picker'); }); if (clearables.length > 0) { - import('TYPO3/CMS/Backend/Input/Clearable').then(function() { + import('@typo3/backend/input/clearable').then(function() { clearables.forEach(clearableField => (clearableField as any).clearable()); }); } diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormContainerContainer.ts b/Build/Sources/TypeScript/backend/form-engine/container/flex-form-container-container.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormContainerContainer.ts rename to Build/Sources/TypeScript/backend/form-engine/container/flex-form-container-container.ts index 09d01f20d1e76d9374ef47344ca3d4e10291bfee..a31f69e10e0388d5970dbb9302b7f919c117de07 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormContainerContainer.ts +++ b/Build/Sources/TypeScript/backend/form-engine/container/flex-form-container-container.ts @@ -12,11 +12,11 @@ */ import {Collapse} from 'bootstrap'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; -import FlexFormSectionContainer from './FlexFormSectionContainer'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import Severity from 'TYPO3/CMS/Backend/Severity'; +import SecurityUtility from '@typo3/core/security-utility'; +import FlexFormSectionContainer from './flex-form-section-container'; +import Modal from '@typo3/backend/modal'; +import RegularEvent from '@typo3/core/event/regular-event'; +import Severity from '@typo3/backend/severity'; enum Selectors { toggleSelector = '[data-bs-toggle="flexform-inline"]', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormSectionContainer.ts b/Build/Sources/TypeScript/backend/form-engine/container/flex-form-section-container.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormSectionContainer.ts rename to Build/Sources/TypeScript/backend/form-engine/container/flex-form-section-container.ts index 6a04c8027d9bff9a4499b63dad3c9cbc864e9532..c87b0a590e72ed8b7b483b2ce80d7fdfe23a93cf 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/FlexFormSectionContainer.ts +++ b/Build/Sources/TypeScript/backend/form-engine/container/flex-form-section-container.ts @@ -14,13 +14,13 @@ import {Collapse} from 'bootstrap'; import $ from 'jquery'; import Sortable from 'sortablejs'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FlexFormContainerContainer from './FlexFormContainerContainer'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import {JavaScriptItemProcessor} from 'TYPO3/CMS/Core/JavaScriptItemProcessor'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import DocumentService from '@typo3/core/document-service'; +import FlexFormContainerContainer from './flex-form-container-container'; +import FormEngine from '@typo3/backend/form-engine'; +import RegularEvent from '@typo3/core/event/regular-event'; +import {JavaScriptItemProcessor} from '@typo3/core/java-script-item-processor'; enum Selectors { toggleAllSelector = '.t3-form-flexsection-toggle', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts b/Build/Sources/TypeScript/backend/form-engine/container/inline-control-container.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts rename to Build/Sources/TypeScript/backend/form-engine/container/inline-control-container.ts index 35fc76feb4d9f628ca346963965cc8412f67a9f6..de7749cbf060c0f9f58c599c378cc3a4c196faa8 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/InlineControlContainer.ts +++ b/Build/Sources/TypeScript/backend/form-engine/container/inline-control-container.ts @@ -11,22 +11,22 @@ * The TYPO3 project - inspiring people to share! */ -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {MessageUtility} from '../../Utility/MessageUtility'; -import {AjaxDispatcher} from './../InlineRelation/AjaxDispatcher'; -import {InlineResponseInterface} from './../InlineRelation/InlineResponseInterface'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {MessageUtility} from '../../utility/message-utility'; +import {AjaxDispatcher} from './../inline-relation/ajax-dispatcher'; +import {InlineResponseInterface} from './../inline-relation/inline-response-interface'; +import DocumentService from '@typo3/core/document-service'; import NProgress from 'nprogress'; import Sortable from 'sortablejs'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; -import FormEngineValidation from 'TYPO3/CMS/Backend/FormEngineValidation'; -import Icons from '../../Icons'; -import InfoWindow from '../../InfoWindow'; -import Modal from '../../Modal'; -import Notification from '../../Notification'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import Severity from '../../Severity'; -import Utility from '../../Utility'; +import FormEngine from '@typo3/backend/form-engine'; +import FormEngineValidation from '@typo3/backend/form-engine-validation'; +import Icons from '../../icons'; +import InfoWindow from '../../info-window'; +import Modal from '../../modal'; +import Notification from '../../notification'; +import RegularEvent from '@typo3/core/event/regular-event'; +import Severity from '../../severity'; +import Utility from '../../utility'; enum Selectors { toggleSelector = '[data-bs-toggle="formengine-inline"]', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/SiteLanguageContainer.ts b/Build/Sources/TypeScript/backend/form-engine/container/site-language-container.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/SiteLanguageContainer.ts rename to Build/Sources/TypeScript/backend/form-engine/container/site-language-container.ts index 7fb24552616721c91f8925e264b690b8869d1233..3ae64d1e94e85be5ccdb40d49d803487c0115340 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Container/SiteLanguageContainer.ts +++ b/Build/Sources/TypeScript/backend/form-engine/container/site-language-container.ts @@ -11,18 +11,18 @@ * The TYPO3 project - inspiring people to share! */ -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {MessageUtility} from '../../Utility/MessageUtility'; -import {AjaxDispatcher} from './../InlineRelation/AjaxDispatcher'; -import {InlineResponseInterface} from './../InlineRelation/InlineResponseInterface'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {MessageUtility} from '../../utility/message-utility'; +import {AjaxDispatcher} from './../inline-relation/ajax-dispatcher'; +import {InlineResponseInterface} from './../inline-relation/inline-response-interface'; import NProgress from 'nprogress'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; -import FormEngineValidation from 'TYPO3/CMS/Backend/FormEngineValidation'; -import Modal from '../../Modal'; -import Notification from '../../Notification'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import Severity from '../../Severity'; -import Utility from '../../Utility'; +import FormEngine from '@typo3/backend/form-engine'; +import FormEngineValidation from '@typo3/backend/form-engine-validation'; +import Modal from '../../modal'; +import Notification from '../../notification'; +import RegularEvent from '@typo3/core/event/regular-event'; +import Severity from '../../severity'; +import Utility from '../../utility'; enum Selectors { toggleSelector = '[data-bs-toggle="formengine-inline"]', @@ -70,7 +70,7 @@ interface UniqueDefinitionUsed { } /** - * Module: TYPO3/CMS/Backend/FormEngine/Container/SiteLanguageContainer + * Module: @typo3/backend/form-engine/container/site-language-container * * Functionality for the site language container * diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/AbstractSortableSelectItems.ts b/Build/Sources/TypeScript/backend/form-engine/element/abstract-sortable-select-items.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/AbstractSortableSelectItems.ts rename to Build/Sources/TypeScript/backend/form-engine/element/abstract-sortable-select-items.ts index fc45d4cfcbe86fb9a7fcf02da52b9da9e92aec29..79eb0ab2b18279cb417d646d9f74dc8381b251fa 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/AbstractSortableSelectItems.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/abstract-sortable-select-items.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; -import FormEngineValidation from 'TYPO3/CMS/Backend/FormEngineValidation'; +import FormEngine from '@typo3/backend/form-engine'; +import FormEngineValidation from '@typo3/backend/form-engine-validation'; export abstract class AbstractSortableSelectItems { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/CategoryElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/category-element.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/CategoryElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/category-element.ts index 9312fc2a0f60695521e6a2539256213c8a7935f3..a1bb03a0a840a0141d03ddc9287735c941cc6827 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/CategoryElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/category-element.ts @@ -11,15 +11,15 @@ * The TYPO3 project - inspiring people to share! */ -import type {SelectTree} from './SelectTree'; -import type {SelectTreeToolbar} from './SelectTreeToolbar'; -import './SelectTree'; -import './SelectTreeToolbar'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import {TreeNode} from 'TYPO3/CMS/Backend/Tree/TreeNode'; +import type {SelectTree} from './select-tree'; +import type {SelectTreeToolbar} from './select-tree-toolbar'; +import './select-tree'; +import './select-tree-toolbar'; +import '@typo3/backend/element/icon-element'; +import {TreeNode} from '@typo3/backend/tree/tree-node'; /** - * Module: TYPO3/CMS/Backend/FormEngine/Element/CategoryElement + * Module: @typo3/backend/form-engine/element/category-element * * Functionality for the category element (renders a tree view) * diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/Extra/SelectBoxFilter.ts b/Build/Sources/TypeScript/backend/form-engine/element/extra/select-box-filter.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/Extra/SelectBoxFilter.ts rename to Build/Sources/TypeScript/backend/form-engine/element/extra/select-box-filter.ts index 8ae756d715b70b09abe5186e36d11d47410c8a79..0dffe5963f1e1b388e6892d67ca110d59872ee4d 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/Extra/SelectBoxFilter.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/extra/select-box-filter.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import RegularEvent from '@typo3/core/event/regular-event'; enum Selectors { fieldContainerSelector = '.t3js-formengine-field-group', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/GroupElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/group-element.ts similarity index 86% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/GroupElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/group-element.ts index 6a00ea7def2165033d5ab371fddf603196872596..60fd6bea7aa70f46d2051d9db13e553fc0a324f6 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/GroupElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/group-element.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import {AbstractSortableSelectItems} from './AbstractSortableSelectItems'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FormEngineSuggest from '../../FormEngineSuggest'; +import {AbstractSortableSelectItems} from './abstract-sortable-select-items'; +import DocumentService from '@typo3/core/document-service'; +import FormEngineSuggest from '../../form-engine-suggest'; class GroupElement extends AbstractSortableSelectItems { private element: HTMLSelectElement = null; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/InputDateTimeElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/input-date-time-element.ts similarity index 82% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/InputDateTimeElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/input-date-time-element.ts index 5350d4ffa1219f972904549c36dcc02e2a2539d5..7ce21c19b40126fa5974aef25e911dda8651bbc0 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/InputDateTimeElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/input-date-time-element.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FormEngineValidation from 'TYPO3/CMS/Backend/FormEngineValidation'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import DocumentService from '@typo3/core/document-service'; +import FormEngineValidation from '@typo3/backend/form-engine-validation'; +import RegularEvent from '@typo3/core/event/regular-event'; class InputDateTimeElement { private element: HTMLInputElement = null; @@ -22,7 +22,7 @@ class InputDateTimeElement { DocumentService.ready().then((): void => { this.element = document.getElementById(elementId) as HTMLInputElement; this.registerEventHandler(this.element); - import('../../DateTimePicker').then(({default: DateTimePicker}): void => { + import('../../date-time-picker').then(({default: DateTimePicker}): void => { DateTimePicker.initialize(this.element) }); }); diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/InputLinkElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/input-link-element.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/InputLinkElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/input-link-element.ts index b435486a0a576c1892450a24ebfc7ad946f45353..4b7470cd8e7ed6e30cae47bcd9b3c997ce3232ca 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/InputLinkElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/input-link-element.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import DocumentService from '@typo3/core/document-service'; enum Selectors { toggleSelector = '.t3js-form-field-inputlink-explanation-toggle', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/MfaInfoElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/mfa-info-element.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/MfaInfoElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/mfa-info-element.ts index d3c10a485555c8cf19ee1cacbc1c50fdea7e075e..2d168bf539a59ada27eb2ad0f4650092ba0812b8 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/MfaInfoElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/mfa-info-element.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import DocumentService from '@typo3/core/document-service'; +import RegularEvent from '@typo3/core/event/regular-event'; +import Notification from '@typo3/backend/notification'; +import Modal from '@typo3/backend/modal'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; interface FieldOptions { userId: number, diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/Modifier/Resizable.ts b/Build/Sources/TypeScript/backend/form-engine/element/modifier/resizable.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/Modifier/Resizable.ts rename to Build/Sources/TypeScript/backend/form-engine/element/modifier/resizable.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/Modifier/Tabbable.ts b/Build/Sources/TypeScript/backend/form-engine/element/modifier/tabbable.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/Modifier/Tabbable.ts rename to Build/Sources/TypeScript/backend/form-engine/element/modifier/tabbable.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectCheckBoxElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/select-check-box-element.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectCheckBoxElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/select-check-box-element.ts index c9f2e9dc8b71277cbe05532dc12015b03645dc68..7102912a59e864c959e0d7f2c8faf973aeb84118 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectCheckBoxElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/select-check-box-element.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import DocumentService from '@typo3/core/document-service'; +import RegularEvent from '@typo3/core/event/regular-event'; enum Identifier { toggleAll = '.t3js-toggle-checkboxes', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectMultipleSideBySideElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/select-multiple-side-by-side-element.ts similarity index 89% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectMultipleSideBySideElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/select-multiple-side-by-side-element.ts index 9e717e08b27f42b1d373602f96848eb401f87580..8d9735807152f37e1d7fc64dc308407e171acffa 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectMultipleSideBySideElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/select-multiple-side-by-side-element.ts @@ -11,10 +11,10 @@ * The TYPO3 project - inspiring people to share! */ -import {AbstractSortableSelectItems} from './AbstractSortableSelectItems'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; -import SelectBoxFilter from './Extra/SelectBoxFilter'; +import {AbstractSortableSelectItems} from './abstract-sortable-select-items'; +import DocumentService from '@typo3/core/document-service'; +import FormEngine from '@typo3/backend/form-engine'; +import SelectBoxFilter from './extra/select-box-filter'; class SelectMultipleSideBySideElement extends AbstractSortableSelectItems { private selectedOptionsElement: HTMLSelectElement = null; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectSingleElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/select-single-element.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectSingleElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/select-single-element.ts index 3879f565fdfcdfc3653d163a052bc6a45bff7d2e..c7e5f878f42fb6199b17a4d3b7730789fccc930e 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectSingleElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/select-single-element.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import RegularEvent from '@typo3/core/event/regular-event'; +import DocumentService from '@typo3/core/document-service'; +import FormEngine from '@typo3/backend/form-engine'; import OnFieldChangeItem = TYPO3.CMS.Backend.OnFieldChangeItem; interface SelectSingleElementOptions { @@ -21,7 +21,7 @@ interface SelectSingleElementOptions { } /** - * Module: TYPO3/CMS/Backend/FormEngine/Element/SelectSingleElement + * Module: @typo3/backend/form-engine/element/select-single-element * Logic for SelectSingleElement */ class SelectSingleElement { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectTreeElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/select-tree-element.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectTreeElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/select-tree-element.ts index 13d7b1a300b10690525c98be243629b9feb35be6..30e83c5e2786ff4d811680334077604a1aae5c1f 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectTreeElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/select-tree-element.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import type {SelectTree} from './SelectTree'; -import type {SelectTreeToolbar} from './SelectTreeToolbar'; -import './SelectTree'; -import './SelectTreeToolbar'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import {TreeNode} from 'TYPO3/CMS/Backend/Tree/TreeNode'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import type {SelectTree} from './select-tree'; +import type {SelectTreeToolbar} from './select-tree-toolbar'; +import './select-tree'; +import './select-tree-toolbar'; +import '@typo3/backend/element/icon-element'; +import {TreeNode} from '@typo3/backend/tree/tree-node'; +import FormEngine from '@typo3/backend/form-engine'; import OnFieldChangeItem = TYPO3.CMS.Backend.OnFieldChangeItem; export class SelectTreeElement { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectTreeToolbar.ts b/Build/Sources/TypeScript/backend/form-engine/element/select-tree-toolbar.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectTreeToolbar.ts rename to Build/Sources/TypeScript/backend/form-engine/element/select-tree-toolbar.ts index f73f96860977840baf9e20e1554932748b9dae44..b19b1599d4d86ba1b152458c3beb89f72f8df469 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectTreeToolbar.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/select-tree-toolbar.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import type {SelectTree} from './SelectTree'; +import type {SelectTree} from './select-tree'; import {Tooltip} from 'bootstrap'; import {html, LitElement, TemplateResult} from 'lit'; import {customElement} from 'lit/decorators'; -import {lll} from 'TYPO3/CMS/Core/lit-helper'; -import {TreeNode} from '../../Tree/TreeNode'; +import {lll} from '@typo3/core/lit-helper'; +import {TreeNode} from '../../tree/tree-node'; @customElement('typo3-backend-form-selecttree-toolbar') export class SelectTreeToolbar extends LitElement { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectTree.ts b/Build/Sources/TypeScript/backend/form-engine/element/select-tree.ts similarity index 99% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectTree.ts rename to Build/Sources/TypeScript/backend/form-engine/element/select-tree.ts index dbd617959adbd3dd308a6f95cb2a0e7fb9a7e6e0..8d95c9aa1d8e5f847863f60a80aff8f7c04b305d 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SelectTree.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/select-tree.ts @@ -12,8 +12,8 @@ */ import * as d3selection from 'd3-selection'; -import {SvgTree, SvgTreeSettings, TreeNodeSelection} from '../../SvgTree'; -import {TreeNode} from '../../Tree/TreeNode'; +import {SvgTree, SvgTreeSettings, TreeNodeSelection} from '../../svg-tree'; +import {TreeNode} from '../../tree/tree-node'; import {customElement} from 'lit/decorators'; interface SelectTreeSettings extends SvgTreeSettings { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SlugElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/slug-element.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SlugElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/slug-element.ts index e13862b0aeaa3ca10fc5f81e40822c2432aefb25..26c824b5df5e4f54c50311fc1fba5ac88f8d5da1 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/SlugElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/slug-element.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import DebounceEvent from 'TYPO3/CMS/Core/Event/DebounceEvent'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import DocumentService from '@typo3/core/document-service'; +import DebounceEvent from '@typo3/core/event/debounce-event'; +import RegularEvent from '@typo3/core/event/regular-event'; interface FieldOptions { pageId: number; @@ -53,7 +53,7 @@ enum ProposalModes { } /** - * Module: TYPO3/CMS/Backend/FormEngine/Element/SlugElement + * Module: @typo3/backend/form-engine/element/slug-element * Logic for a TCA type "slug" * * For new records, changes on the other fields of the record (typically the record title) are listened diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/TextElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/text-element.ts similarity index 83% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/TextElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/text-element.ts index 147a4160dff565a0845bd0e87b42c2f24d9ea8f7..c4ee0e3d8b7b7eebf9d4dd51e44c6b3a729f2e3b 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/TextElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/text-element.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import {Resizable} from './Modifier/Resizable'; -import {Tabbable} from './Modifier/Tabbable'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import {Resizable} from './modifier/resizable'; +import {Tabbable} from './modifier/tabbable'; +import DocumentService from '@typo3/core/document-service'; class TextElement { private element: HTMLTextAreaElement = null; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/TextTableElement.ts b/Build/Sources/TypeScript/backend/form-engine/element/text-table-element.ts similarity index 83% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/TextTableElement.ts rename to Build/Sources/TypeScript/backend/form-engine/element/text-table-element.ts index 9c9eba8de6777c84ca0c8109853b57fca3ea9ccf..b7c4e665427b62fb3ddb313482ad77ace60b41fc 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/Element/TextTableElement.ts +++ b/Build/Sources/TypeScript/backend/form-engine/element/text-table-element.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import {Resizable} from './Modifier/Resizable'; -import {Tabbable} from './Modifier/Tabbable'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import {Resizable} from './modifier/resizable'; +import {Tabbable} from './modifier/tabbable'; +import DocumentService from '@typo3/core/document-service'; class TextTableElement { private element: HTMLTextAreaElement = null; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/AddRecord.ts b/Build/Sources/TypeScript/backend/form-engine/field-control/add-record.ts similarity index 90% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/AddRecord.ts rename to Build/Sources/TypeScript/backend/form-engine/field-control/add-record.ts index ab30bb83ef638cf3c73ce00e012819dbb534a2f7..142c9a5378e2d93e0ab4102ad2b75ad72cbaba88 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/AddRecord.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-control/add-record.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import DocumentService from '@typo3/core/document-service'; +import FormEngine from '@typo3/backend/form-engine'; /** * Handles the "Add record" field control that renders a new FormEngine instance diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/EditPopup.ts b/Build/Sources/TypeScript/backend/form-engine/field-control/edit-popup.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/EditPopup.ts rename to Build/Sources/TypeScript/backend/form-engine/field-control/edit-popup.ts index 31b7e6313407fc3de362507c1d0e11f322d9a514..e9476f08bd267ebcc7852e7e7903799f9b23fb5f 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/EditPopup.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-control/edit-popup.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import DocumentService from '@typo3/core/document-service'; /** * Handles the "Edit popup" field control that renders a new FormEngine instance diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/InsertClipboard.ts b/Build/Sources/TypeScript/backend/form-engine/field-control/insert-clipboard.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/InsertClipboard.ts rename to Build/Sources/TypeScript/backend/form-engine/field-control/insert-clipboard.ts index 73323b9b25ea6f19e8fa8143ea83cc1c0e9d510b..21d1042ae53bbb67f2bb736310aa7556e69d50d6 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/InsertClipboard.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-control/insert-clipboard.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import DocumentService from '@typo3/core/document-service'; +import FormEngine from '@typo3/backend/form-engine'; interface ClipboardItem { title: string; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/LinkPopup.ts b/Build/Sources/TypeScript/backend/form-engine/field-control/link-popup.ts similarity index 90% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/LinkPopup.ts rename to Build/Sources/TypeScript/backend/form-engine/field-control/link-popup.ts index f00893a381959274a6c4e35df1e007871439adb2..6fc74e48b7d28cd38a3ebc2edfaede5acea98c72 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/LinkPopup.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-control/link-popup.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; -import Modal from '../../Modal'; +import DocumentService from '@typo3/core/document-service'; +import FormEngine from '@typo3/backend/form-engine'; +import Modal from '../../modal'; /** * This module is used for the field control "Link popup" diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/ListModule.ts b/Build/Sources/TypeScript/backend/form-engine/field-control/list-module.ts similarity index 90% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/ListModule.ts rename to Build/Sources/TypeScript/backend/form-engine/field-control/list-module.ts index 9fa34e2d0752ad6caec9f3397f1f1bf67cef90a5..ac3e1961f09a94e944bf5be0c321ad8e2aa1d0ac 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/ListModule.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-control/list-module.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import DocumentService from '@typo3/core/document-service'; +import FormEngine from '@typo3/backend/form-engine'; /** * This module is used for the field control "List module" used for "group" fields diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/ResetSelection.ts b/Build/Sources/TypeScript/backend/form-engine/field-control/reset-selection.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/ResetSelection.ts rename to Build/Sources/TypeScript/backend/form-engine/field-control/reset-selection.ts index aee20dec196049391a3224e567fd0e7082cb6076..9aa2cdae6fb59029daa2db3c98de51f734b7625b 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/ResetSelection.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-control/reset-selection.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import DocumentService from '@typo3/core/document-service'; /** * This module is used for the field control "Reset selection" used for selectSingleBox diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/TableWizard.ts b/Build/Sources/TypeScript/backend/form-engine/field-control/table-wizard.ts similarity index 89% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/TableWizard.ts rename to Build/Sources/TypeScript/backend/form-engine/field-control/table-wizard.ts index df8db9f82490656d8fbe429765e2f79ec0b350ec..95b8440ae63b4b3888f1e434ba7ea1589012e983 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldControl/TableWizard.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-control/table-wizard.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import DocumentService from '@typo3/core/document-service'; +import FormEngine from '@typo3/backend/form-engine'; /** * Handles the "Table wizard" field control diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldWizard/LocalizationStateSelector.ts b/Build/Sources/TypeScript/backend/form-engine/field-wizard/localization-state-selector.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldWizard/LocalizationStateSelector.ts rename to Build/Sources/TypeScript/backend/form-engine/field-wizard/localization-state-selector.ts index 94a9b58c35f8b1cff91774ef6d1f77d3b61cc020..567681bad8e84fd95e83649108da122e49bc66f3 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldWizard/LocalizationStateSelector.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-wizard/localization-state-selector.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import DocumentService from '@typo3/core/document-service'; +import RegularEvent from '@typo3/core/event/regular-event'; enum States { CUSTOM = 'custom', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldWizard/ValuePicker.ts b/Build/Sources/TypeScript/backend/form-engine/field-wizard/value-picker.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldWizard/ValuePicker.ts rename to Build/Sources/TypeScript/backend/form-engine/field-wizard/value-picker.ts index f50ebb8aeca458e7ed2a34b0d341be41aa33b2f1..63bc1faf2ede0562c42aa9e651800143a9197ca7 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldWizard/ValuePicker.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-wizard/value-picker.ts @@ -18,7 +18,7 @@ enum InsertModes { } /** - * Module TYPO3/CMS/Backend/FormEngine/FieldWizard/ValuePicker + * Module @typo3/backend/form-engine/field-wizard/value-picker * * @example * <typo3-formengine-valuepicker mode="prepend" linked-field="css-selector"> diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldWizard/ValueSlider.ts b/Build/Sources/TypeScript/backend/form-engine/field-wizard/value-slider.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldWizard/ValueSlider.ts rename to Build/Sources/TypeScript/backend/form-engine/field-wizard/value-slider.ts index f7b303e0489b0cd6b7a3d662826e46553d03c8dc..5dc0546998e63183a4a29dbfc9c440401940a9fa 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/FieldWizard/ValueSlider.ts +++ b/Build/Sources/TypeScript/backend/form-engine/field-wizard/value-slider.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import ThrottleEvent from 'TYPO3/CMS/Core/Event/ThrottleEvent'; +import ThrottleEvent from '@typo3/core/event/throttle-event'; class ValueSlider { private readonly controlElement: HTMLInputElement = null; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/AjaxDispatcher.ts b/Build/Sources/TypeScript/backend/form-engine/inline-relation/ajax-dispatcher.ts similarity index 93% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/AjaxDispatcher.ts rename to Build/Sources/TypeScript/backend/form-engine/inline-relation/ajax-dispatcher.ts index 8a40af434cb281d354899db9cd6ead33cf9767ab..1e0cbcfb80a7bb385d63cf3c955e93409de6338d 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/AjaxDispatcher.ts +++ b/Build/Sources/TypeScript/backend/form-engine/inline-relation/ajax-dispatcher.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {JavaScriptItemProcessor} from 'TYPO3/CMS/Core/JavaScriptItemProcessor'; -import Notification from '../../Notification'; -import Utility from '../../Utility'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {JavaScriptItemProcessor} from '@typo3/core/java-script-item-processor'; +import Notification from '../../notification'; +import Utility from '../../utility'; interface Context { config: Object; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/InlineResponseInterface.ts b/Build/Sources/TypeScript/backend/form-engine/inline-relation/inline-response-interface.ts similarity index 91% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/InlineResponseInterface.ts rename to Build/Sources/TypeScript/backend/form-engine/inline-relation/inline-response-interface.ts index 871a36364af685aa752f9ca382ba81d4c20b2936..d6082b35c25103636df3ba080b00e7f6dc50a7ca 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/InlineRelation/InlineResponseInterface.ts +++ b/Build/Sources/TypeScript/backend/form-engine/inline-relation/inline-response-interface.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxDispatcherResponse} from 'TYPO3/CMS/Backend/FormEngine/InlineRelation/AjaxDispatcher'; +import {AjaxDispatcherResponse} from '@typo3/backend/form-engine/inline-relation/ajax-dispatcher'; export interface InlineResponseInterface extends AjaxDispatcherResponse{ data: string; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/RequestUpdate.ts b/Build/Sources/TypeScript/backend/form-engine/request-update.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/RequestUpdate.ts rename to Build/Sources/TypeScript/backend/form-engine/request-update.ts index ba4caccee60c9aec8dcd45220f295af85baf85d6..19701480833ec9a83c5cfb71b0d83fe3dab65789 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/FormEngine/RequestUpdate.ts +++ b/Build/Sources/TypeScript/backend/form-engine/request-update.ts @@ -13,7 +13,7 @@ import {LitElement} from 'lit'; import {customElement, property} from 'lit/decorators'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import FormEngine from '@typo3/backend/form-engine'; enum UpdateMode { ask = 'ask', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/GlobalEventHandler.ts b/Build/Sources/TypeScript/backend/global-event-handler.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/GlobalEventHandler.ts rename to Build/Sources/TypeScript/backend/global-event-handler.ts index ec09347a0e02ae0727b29a2bfb80cc7b89107d72..a1b591e8b1569cdd1ce411069066431af32c25a0 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/GlobalEventHandler.ts +++ b/Build/Sources/TypeScript/backend/global-event-handler.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import documentService from 'TYPO3/CMS/Core/DocumentService'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import documentService from '@typo3/core/document-service'; +import RegularEvent from '@typo3/core/event/regular-event'; type HTMLFormChildElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement; /** - * Module: TYPO3/CMS/Backend/GlobalEventHandler + * Module: @typo3/backend/global-event-handler * * + `data-global-event="change"` * + `data-action-submit="..."` submits form data diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/GridEditor.ts b/Build/Sources/TypeScript/backend/grid-editor.ts similarity index 99% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/GridEditor.ts rename to Build/Sources/TypeScript/backend/grid-editor.ts index 2f08839e180b17b3402ecd4abba8700ad97a463a..f060afcf4d2c30f8be8afe19bbe75bad6bc23a92 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/GridEditor.ts +++ b/Build/Sources/TypeScript/backend/grid-editor.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import {SeverityEnum} from './Enum/Severity'; +import {SeverityEnum} from './enum/severity'; import 'bootstrap'; import $ from 'jquery'; -import Modal from './Modal'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; +import Modal from './modal'; +import SecurityUtility from '@typo3/core/security-utility'; /** * GridEditorConfigurationInterface @@ -38,8 +38,8 @@ interface CellInterface { } /** - * Module: TYPO3/CMS/Backend/GridEditor - * @exports TYPO3/CMS/Backend/GridEditor + * Module: @typo3/backend/grid-editor + * @exports @typo3/backend/grid-editor */ export class GridEditor { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Hashing/Md5.ts b/Build/Sources/TypeScript/backend/hashing/md5.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Hashing/Md5.ts rename to Build/Sources/TypeScript/backend/hashing/md5.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Icons.ts b/Build/Sources/TypeScript/backend/icons.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Icons.ts rename to Build/Sources/TypeScript/backend/icons.ts index 7a3d7570d2694647b7f30b378b8117967389854d..51bbd294e874e8da64619091ed55ad47fb440f50 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Icons.ts +++ b/Build/Sources/TypeScript/backend/icons.ts @@ -11,17 +11,17 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import ClientStorage from './Storage/Client'; -import {Sizes, States, MarkupIdentifiers} from './Enum/IconTypes'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import ClientStorage from './storage/client'; +import {Sizes, States, MarkupIdentifiers} from './enum/icon-types'; interface PromiseCache { [key: string]: Promise<string>; } /** - * Module: TYPO3/CMS/Backend/Icons + * Module: @typo3/backend/icons * Uses the icon API of the core to fetch icons via AJAX. */ class Icons { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ImageManipulation.ts b/Build/Sources/TypeScript/backend/image-manipulation.ts similarity index 99% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ImageManipulation.ts rename to Build/Sources/TypeScript/backend/image-manipulation.ts index 958c304f346c40c0c71bebac37a7888a54b28a8d..a5342c2556a1c736ed007a5369f9d4118373a8c1 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ImageManipulation.ts +++ b/Build/Sources/TypeScript/backend/image-manipulation.ts @@ -14,13 +14,13 @@ import $ from 'jquery'; import 'jquery-ui/draggable'; import 'jquery-ui/resizable'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import FormEngineValidation from 'TYPO3/CMS/Backend/FormEngineValidation'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import FormEngineValidation from '@typo3/backend/form-engine-validation'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; import Cropper from 'cropperjs'; import ImagesLoaded from 'imagesloaded'; -import Icons from './Icons'; -import Modal from './Modal'; +import Icons from './icons'; +import Modal from './modal'; interface Area { x: number; @@ -55,9 +55,9 @@ interface CropperEvent extends CustomEvent { } /** - * Module: TYPO3/CMS/Backend/ImageManipulation + * Module: @typo3/backend/image-manipulation * Contains all logic for the image crop GUI including setting focusAreas - * @exports TYPO3/CMS/Backend/ImageManipulation + * @exports @typo3/backend/image-manipulation */ class ImageManipulation { private initialized: boolean = false; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/InfoWindow.ts b/Build/Sources/TypeScript/backend/info-window.ts similarity index 87% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/InfoWindow.ts rename to Build/Sources/TypeScript/backend/info-window.ts index ff1c8ae904a4bc670493a6a158b517ff655535fc..244db21bd03850819c15327232e98d91d2edd66e 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/InfoWindow.ts +++ b/Build/Sources/TypeScript/backend/info-window.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import {SeverityEnum} from './Enum/Severity'; -import Modal from './Modal'; +import {SeverityEnum} from './enum/severity'; +import Modal from './modal'; /** - * Module: TYPO3/CMS/Backend/InfoWindow - * @exports TYPO3/CMS/Backend/InfoWindow + * Module: @typo3/backend/info-window + * @exports @typo3/backend/info-window */ class InfoWindow { /** diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/Clearable.ts b/Build/Sources/TypeScript/backend/input/clearable.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Input/Clearable.ts rename to Build/Sources/TypeScript/backend/input/clearable.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/JavaScriptModuleImportEventHandler.ts b/Build/Sources/TypeScript/backend/java-script-module-import-event-handler.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/JavaScriptModuleImportEventHandler.ts rename to Build/Sources/TypeScript/backend/java-script-module-import-event-handler.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LayoutModule/DragDrop.ts b/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LayoutModule/DragDrop.ts rename to Build/Sources/TypeScript/backend/layout-module/drag-drop.ts index 9d6bf7db9193b8f23172e0a5c9542d1fe44eaf14..e30008aba71541bc60b923e1ed5e43fbbc84b298 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LayoutModule/DragDrop.ts +++ b/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts @@ -12,15 +12,15 @@ */ /** - * Module: TYPO3/CMS/Backend/LayoutModule/DragDrop + * Module: @typo3/backend/layout-module/drag-drop * this JS code does the drag+drop logic for the Layout module (Web => Page) * based on jQuery UI */ import $ from 'jquery'; import 'jquery-ui/droppable'; -import DataHandler from '../AjaxDataHandler'; -import Icons from '../Icons'; -import ResponseInterface from '../AjaxDataHandler/ResponseInterface'; +import DataHandler from '../ajax-data-handler'; +import Icons from '../icons'; +import ResponseInterface from '../ajax-data-handler/response-interface'; interface Parameters { cmd?: { [key: string]: { [key: string]: any } }; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LayoutModule/Paste.ts b/Build/Sources/TypeScript/backend/layout-module/paste.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LayoutModule/Paste.ts rename to Build/Sources/TypeScript/backend/layout-module/paste.ts index ae572bd650f3f5c6c31454a1327b2ec7bec58470..b9ee2ea2edbc53b6910a6383c5eead8a5398ca58 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LayoutModule/Paste.ts +++ b/Build/Sources/TypeScript/backend/layout-module/paste.ts @@ -12,18 +12,18 @@ */ /** - * Module: TYPO3/CMS/Backend/LayoutModule/Paste + * Module: @typo3/backend/layout-module/paste * Dynamically adds "Paste" Icons in the Page Layout module (Web => Page) * and triggers a modal window. which then calls the AjaxDataHandler * to execute the action to paste the current clipboard contents. */ import $ from 'jquery'; -import ResponseInterface from '../AjaxDataHandler/ResponseInterface'; -import DataHandler from '../AjaxDataHandler'; -import Modal from '../Modal'; -import Severity from '../Severity'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import {SeverityEnum} from '../Enum/Severity'; +import ResponseInterface from '../ajax-data-handler/response-interface'; +import DataHandler from '../ajax-data-handler'; +import Modal from '../modal'; +import Severity from '../severity'; +import '@typo3/backend/element/icon-element'; +import {SeverityEnum} from '../enum/severity'; interface Button { text: string; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Localization.ts b/Build/Sources/TypeScript/backend/localization.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Localization.ts rename to Build/Sources/TypeScript/backend/localization.ts index 1144b5b144b590fe3eee60849f7ebe208b748a5b..425142734135d49148a419fad8f0bfc677d7299c 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Localization.ts +++ b/Build/Sources/TypeScript/backend/localization.ts @@ -12,11 +12,11 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {SeverityEnum} from './Enum/Severity'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Icons from './Icons'; -import Wizard from './Wizard'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {SeverityEnum} from './enum/severity'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Icons from './icons'; +import Wizard from './wizard'; type LanguageRecord = { uid: number; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LoginRefresh.ts b/Build/Sources/TypeScript/backend/login-refresh.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LoginRefresh.ts rename to Build/Sources/TypeScript/backend/login-refresh.ts index ad65450fa6278053ab7e8254aec2c89ef398b925..d75a50c7182b9152214374afaf9c7b33ed033433 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/LoginRefresh.ts +++ b/Build/Sources/TypeScript/backend/login-refresh.ts @@ -12,9 +12,9 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Notification from 'TYPO3/CMS/Backend/Notification'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Notification from '@typo3/backend/notification'; enum MarkupIdentifiers { loginrefresh = 't3js-modal-loginrefresh', @@ -29,8 +29,8 @@ interface LoginRefreshOptions { } /** - * Module: TYPO3/CMS/Backend/LoginRefresh - * @exports TYPO3/CMS/Backend/LoginRefresh + * Module: @typo3/backend/login-refresh + * @exports @typo3/backend/login-refresh */ class LoginRefresh { private options: any = { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Login.ts b/Build/Sources/TypeScript/backend/login.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Login.ts rename to Build/Sources/TypeScript/backend/login.ts index c7cddc0b2a3824c2cf7ea725e1ce183f173657cb..d114d170bebb5e7f6b83305d18c7b1c9acce696e 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Login.ts +++ b/Build/Sources/TypeScript/backend/login.ts @@ -13,9 +13,9 @@ import 'bootstrap'; import $ from 'jquery'; -import 'TYPO3/CMS/Backend/Input/Clearable'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; +import '@typo3/backend/input/clearable'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; interface PreflightResponse { capabilities: PreflightResponseCapabilities; @@ -27,9 +27,9 @@ interface PreflightResponseCapabilities { } /** - * Module: TYPO3/CMS/Backend/Login + * Module: @typo3/backend/login * JavaScript module for the backend login form - * @exports TYPO3/CMS/Backend/Login + * @exports @typo3/backend/login * * Class and file name do not match as the class was renamed, but to keep overrides in place, the filename has to stay! */ diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ModalInterface.ts b/Build/Sources/TypeScript/backend/modal-interface.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ModalInterface.ts rename to Build/Sources/TypeScript/backend/modal-interface.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Modal.ts b/Build/Sources/TypeScript/backend/modal.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Modal.ts rename to Build/Sources/TypeScript/backend/modal.ts index 519c37a0d5e51f0363e9f2a5b027889b517375c7..32e2c15292f8efc33f8bbf25055ccdea122a9597 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Modal.ts +++ b/Build/Sources/TypeScript/backend/modal.ts @@ -14,14 +14,14 @@ import 'bootstrap'; import $ from 'jquery'; import {html, render} from 'lit'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractAction} from './ActionButton/AbstractAction'; -import {ModalResponseEvent} from 'TYPO3/CMS/Backend/ModalInterface'; -import {SeverityEnum} from './Enum/Severity'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; -import Icons from './Icons'; -import Severity from './Severity'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractAction} from './action-button/abstract-action'; +import {ModalResponseEvent} from '@typo3/backend/modal-interface'; +import {SeverityEnum} from './enum/severity'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import SecurityUtility from '@typo3/core/security-utility'; +import Icons from './icons'; +import Severity from './severity'; enum Identifiers { modal = '.t3js-modal', @@ -80,7 +80,7 @@ interface Configuration { } /** - * Module: TYPO3/CMS/Backend/Modal + * Module: @typo3/backend/modal * API for modal windows powered by Twitter Bootstrap. */ class Modal { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ModuleMenu.ts b/Build/Sources/TypeScript/backend/module-menu.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ModuleMenu.ts rename to Build/Sources/TypeScript/backend/module-menu.ts index 2818faad4d257890497a58e613a74aa6ee704424..068066625b6356b0d1934635677eaed2099643d4 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ModuleMenu.ts +++ b/Build/Sources/TypeScript/backend/module-menu.ts @@ -11,22 +11,22 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {ScaffoldIdentifierEnum} from './Enum/Viewport/ScaffoldIdentifier'; -import {getRecordFromName, Module, ModuleState} from './Module'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {ScaffoldIdentifierEnum} from './enum/viewport/scaffold-identifier'; +import {getRecordFromName, Module, ModuleState} from './module'; import $ from 'jquery'; -import PersistentStorage from './Storage/Persistent'; -import Viewport from './Viewport'; -import ClientRequest from './Event/ClientRequest'; -import TriggerRequest from './Event/TriggerRequest'; -import InteractionRequest from './Event/InteractionRequest'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import {ModuleStateStorage} from './Storage/ModuleStateStorage'; +import PersistentStorage from './storage/persistent'; +import Viewport from './viewport'; +import ClientRequest from './event/client-request'; +import TriggerRequest from './event/trigger-request'; +import InteractionRequest from './event/interaction-request'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import RegularEvent from '@typo3/core/event/regular-event'; +import {ModuleStateStorage} from './storage/module-state-storage'; /** * Class to render the module menu and handle the BE navigation - * Module: TYPO3/CMS/Backend/ModuleMenu + * Module: @typo3/backend/module-menu */ class ModuleMenu { private loadedModule: string = null; @@ -80,7 +80,7 @@ class ModuleMenu { } // get id let section = ''; - if (moduleData.navigationComponentId === 'TYPO3/CMS/Backend/PageTree/PageTreeElement') { + if (moduleData.navigationComponentId === '@typo3/backend/page-tree/page-tree-element') { section = 'web'; } else { section = moduleData.name.split('_')[0]; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Module.ts b/Build/Sources/TypeScript/backend/module.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Module.ts rename to Build/Sources/TypeScript/backend/module.ts index 322475a4225de3a88db25cbfb11f8f03371fc67e..a413f5ff7722564027fdc7d30c9eda0ae9240331 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Module.ts +++ b/Build/Sources/TypeScript/backend/module.ts @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/Backend/Module + * Module: @typo3/backend/module */ export interface ModuleState { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Module/Iframe.ts b/Build/Sources/TypeScript/backend/module/iframe.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Module/Iframe.ts rename to Build/Sources/TypeScript/backend/module/iframe.ts index eebc3e3034e31ffa62e350e387e90babe03d7b04..c50cf9ce75f566eebc67bcadd19b5d84f09267df 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Module/Iframe.ts +++ b/Build/Sources/TypeScript/backend/module/iframe.ts @@ -13,11 +13,11 @@ import {html, css, LitElement, TemplateResult} from 'lit'; import {customElement, property, query} from 'lit/decorators'; -import {ModuleState} from '../Module'; -import {lll} from 'TYPO3/CMS/Core/lit-helper'; +import {ModuleState} from '../module'; +import {lll} from '@typo3/core/lit-helper'; /** - * Module: TYPO3/CMS/Backend/Module/Iframe + * Module: @typo3/backend/module/iframe */ export const componentName = 'typo3-iframe-module'; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Module/Router.ts b/Build/Sources/TypeScript/backend/module/router.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Module/Router.ts rename to Build/Sources/TypeScript/backend/module/router.ts index 6c81101e793d2b4c5c66101a40f49968a2fbf366..04741223ccc2b70eaf09f29699ac4d71b01392ad 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Module/Router.ts +++ b/Build/Sources/TypeScript/backend/module/router.ts @@ -13,9 +13,9 @@ import {html, css, LitElement, TemplateResult} from 'lit'; import {customElement, property, query} from 'lit/decorators'; -import {getRecordFromName, Module, ModuleState} from '../Module'; +import {getRecordFromName, Module, ModuleState} from '../module'; -const IFRAME_COMPONENT = 'TYPO3/CMS/Backend/Module/Iframe'; +const IFRAME_COMPONENT = '@typo3/backend/module/iframe'; interface DecoratedModuleState { slotName: string; @@ -27,7 +27,7 @@ interface DecoratedModuleState { const alwaysUpdate = (newVal: string, oldVal: string) => true; /** - * Module: TYPO3/CMS/Backend/Module/Router + * Module: @typo3/backend/module/router */ @customElement('typo3-backend-module-router') export class ModuleRouter extends LitElement { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/MultiRecordSelectionAction.ts b/Build/Sources/TypeScript/backend/multi-record-selection-action.ts similarity index 91% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/MultiRecordSelectionAction.ts rename to Build/Sources/TypeScript/backend/multi-record-selection-action.ts index 15f796ac59cd02a33fb565b2a182569200020948..4f4b9747e19b218cdc4400a59d0eba009ad3e1df 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/MultiRecordSelectionAction.ts +++ b/Build/Sources/TypeScript/backend/multi-record-selection-action.ts @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/Backend/MultiRecordSelectionAction + * Module: @typo3/backend/multi-record-selection-action */ export interface ActionConfiguration { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/MultiRecordSelection.ts b/Build/Sources/TypeScript/backend/multi-record-selection.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/MultiRecordSelection.ts rename to Build/Sources/TypeScript/backend/multi-record-selection.ts index ef61e8780a2ddb9a149f90bfadba7944a4744aaf..2c3b81282ae9534e5d4a960455b81958b5ab6e49 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/MultiRecordSelection.ts +++ b/Build/Sources/TypeScript/backend/multi-record-selection.ts @@ -11,10 +11,10 @@ * The TYPO3 project - inspiring people to share! */ -import Notification from 'TYPO3/CMS/Backend/Notification'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import {ActionConfiguration, ActionEventDetails} from 'TYPO3/CMS/Backend/MultiRecordSelectionAction'; +import Notification from '@typo3/backend/notification'; +import DocumentService from '@typo3/core/document-service'; +import RegularEvent from '@typo3/core/event/regular-event'; +import {ActionConfiguration, ActionEventDetails} from '@typo3/backend/multi-record-selection-action'; enum Selectors { actionsSelector = '.t3js-multi-record-selection-actions', @@ -42,7 +42,7 @@ enum CheckboxState { } /** - * Module: TYPO3/CMS/Backend/MultiRecordSelection + * Module: @typo3/backend/multi-record-selection */ class MultiRecordSelection { private lastChecked: HTMLInputElement = null; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/MultiStepWizard.ts b/Build/Sources/TypeScript/backend/multi-step-wizard.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/MultiStepWizard.ts rename to Build/Sources/TypeScript/backend/multi-step-wizard.ts index 23ca748251804a2afe0936bcf359ca50249a6a1a..a698b58a7e9d4618d4e0920b3c09bbb0b12cf2a5 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/MultiStepWizard.ts +++ b/Build/Sources/TypeScript/backend/multi-step-wizard.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import {SeverityEnum} from './Enum/Severity'; +import {SeverityEnum} from './enum/severity'; import $ from 'jquery'; -import Modal from './Modal'; -import Severity from './Severity'; -import Icons from './Icons'; +import Modal from './modal'; +import Severity from './severity'; +import Icons from './icons'; interface MultiStepWizardSettings { @@ -39,9 +39,9 @@ interface Slide { } /** - * Module: TYPO3/CMS/Backend/MultiStepWizard + * Module: @typo3/backend/multi-step-wizard * Multi step wizard within a modal - * @exports TYPO3/CMS/Backend/MultiStepWizard + * @exports @typo3/backend/multi-step-wizard */ class MultiStepWizard { private setup: MultiStepWizardSetup; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/NewContentElementWizardButton.ts b/Build/Sources/TypeScript/backend/new-content-element-wizard-button.ts similarity index 88% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/NewContentElementWizardButton.ts rename to Build/Sources/TypeScript/backend/new-content-element-wizard-button.ts index ab2cb6455caac31b9f187b36369cb7b22b7264ed..6b8ce975880a980fc1a27b0f1252b0a8d9bcf2e7 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/NewContentElementWizardButton.ts +++ b/Build/Sources/TypeScript/backend/new-content-element-wizard-button.ts @@ -13,12 +13,12 @@ import {customElement, property} from 'lit/decorators'; import {html, LitElement, TemplateResult} from 'lit'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import {NewContentElementWizard} from 'TYPO3/CMS/Backend/NewContentElementWizard'; +import Modal from '@typo3/backend/modal'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import {NewContentElementWizard} from '@typo3/backend/new-content-element-wizard'; /** - * Module: TYPO3/CMS/Backend/NewContentElementWizardButton + * Module: @typo3/backend/new-content-element-wizard-button * * @example * <typo3-backend-new-content-element-wizard-button url="link/to/endpoint" title="Wizard title" ></typo3-backend-new-content-element-wizard-button> diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/NewContentElementWizard.ts b/Build/Sources/TypeScript/backend/new-content-element-wizard.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/NewContentElementWizard.ts rename to Build/Sources/TypeScript/backend/new-content-element-wizard.ts index 3ef1c002e5ccefeae8b9d43e57761618fe85bf19..960af6d33724f4b06a59b362092f261130db564e 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/NewContentElementWizard.ts +++ b/Build/Sources/TypeScript/backend/new-content-element-wizard.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import DebounceEvent from 'TYPO3/CMS/Core/Event/DebounceEvent'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import RegularEvent from '@typo3/core/event/regular-event'; +import DebounceEvent from '@typo3/core/event/debounce-event'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; interface PositionMapArguments { url: string, @@ -40,7 +40,7 @@ enum Selectors { } /** - * Module: TYPO3/CMS/Backend/NewContentElementWizard + * Module: @typo3/backend/new-content-element-wizard */ export class NewContentElementWizard { private readonly modal: HTMLElement; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/NewMultiplePages.ts b/Build/Sources/TypeScript/backend/new-multiple-pages.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/NewMultiplePages.ts rename to Build/Sources/TypeScript/backend/new-multiple-pages.ts index b737886e8da132c5c47bd2e6ee2072bb0096fd30..67c532802aa1418df3768c42025557abd7275a8f 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/NewMultiplePages.ts +++ b/Build/Sources/TypeScript/backend/new-multiple-pages.ts @@ -21,7 +21,7 @@ enum Identifiers { } /** - * Module: TYPO3/CMS/Backend/NewMultiplePages + * Module: @typo3/backend/new-multiple-pages * JavaScript functions for creating multiple pages */ class NewMultiplePages { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Notification.ts b/Build/Sources/TypeScript/backend/notification.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Notification.ts rename to Build/Sources/TypeScript/backend/notification.ts index d00bd84e4408bf676dedbc7b85c12e8b2e7c882d..df84cbb2fbd796ce5da53ea8ec0d591ed6965058 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Notification.ts +++ b/Build/Sources/TypeScript/backend/notification.ts @@ -15,9 +15,9 @@ import {LitElement, html} from 'lit'; import {customElement, property, state} from 'lit/decorators'; import {classMap} from 'lit/directives/class-map'; import {ifDefined} from 'lit/directives/if-defined'; -import {AbstractAction} from './ActionButton/AbstractAction'; -import {SeverityEnum} from './Enum/Severity'; -import Severity from './Severity'; +import {AbstractAction} from './action-button/abstract-action'; +import {SeverityEnum} from './enum/severity'; +import Severity from './severity'; interface Action { label: string; @@ -25,7 +25,7 @@ interface Action { } /** - * Module: TYPO3/CMS/Backend/Notification + * Module: @typo3/backend/notification * Notification API for the TYPO3 backend */ class Notification { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/OnlineMedia.ts b/Build/Sources/TypeScript/backend/online-media.ts similarity index 91% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/OnlineMedia.ts rename to Build/Sources/TypeScript/backend/online-media.ts index a3eedc420b2d4bfad62f7acec2aca14391c458ce..86c70aea6212fbe4de7c52333eb87261fa7260bc 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/OnlineMedia.ts +++ b/Build/Sources/TypeScript/backend/online-media.ts @@ -12,14 +12,14 @@ */ import $ from 'jquery'; -import {MessageUtility} from 'TYPO3/CMS/Backend/Utility/MessageUtility'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {KeyTypesEnum} from './Enum/KeyTypes'; +import {MessageUtility} from '@typo3/backend/utility/message-utility'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {KeyTypesEnum} from './enum/key-types'; import NProgress from 'nprogress'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; -import Modal from './Modal'; -import Severity from './Severity'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import SecurityUtility from '@typo3/core/security-utility'; +import Modal from './modal'; +import Severity from './severity'; interface Response { file?: number; @@ -27,7 +27,7 @@ interface Response { } /** - * Module: TYPO3/CMS/Backend/OnlineMedia + * Module: @typo3/backend/online-media * Javascript for show the online media dialog */ class OnlineMedia { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/PageActions.ts b/Build/Sources/TypeScript/backend/page-actions.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/PageActions.ts rename to Build/Sources/TypeScript/backend/page-actions.ts index ff8c0e5ef900b62bc52e343506fc11fb1d75b0ee..fcd27d1d6b2fa7aaff7b36e07bb4adca2bbc3c28 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/PageActions.ts +++ b/Build/Sources/TypeScript/backend/page-actions.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import { KeyTypesEnum } from './Enum/KeyTypes'; +import { KeyTypesEnum } from './enum/key-types'; import $ from 'jquery'; -import PersistentStorage from './Storage/Persistent'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import 'TYPO3/CMS/Backend/NewContentElementWizardButton'; +import PersistentStorage from './storage/persistent'; +import '@typo3/backend/element/icon-element'; +import '@typo3/backend/new-content-element-wizard-button'; enum IdentifierEnum { pageTitle = '.t3js-title-inlineedit', @@ -23,7 +23,7 @@ enum IdentifierEnum { } /** - * Module: TYPO3/CMS/Backend/PageActions + * Module: @typo3/backend/page-actions * JavaScript implementations for page actions */ class PageActions { @@ -204,7 +204,7 @@ class PageActions { parameters.data.pages = {}; parameters.data.pages[recordUid] = { title: $field.val() }; - import('TYPO3/CMS/Backend/AjaxDataHandler').then(({default: DataHandler}): void => { + import('@typo3/backend/ajax-data-handler').then(({default: DataHandler}): void => { DataHandler.process(parameters).then((): void => { $inputFieldWrap.find('[data-action=cancel]').trigger('click'); this.$pageTitle.text($field.val()); diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/PageTree/PageTreeElement.ts b/Build/Sources/TypeScript/backend/page-tree/page-tree-element.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/PageTree/PageTreeElement.ts rename to Build/Sources/TypeScript/backend/page-tree/page-tree-element.ts index 3b39af32b106466f7619151986f3a5e653a9a6dd..5c74486c474dec213ddca353409ae0e41763531c 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/PageTree/PageTreeElement.ts +++ b/Build/Sources/TypeScript/backend/page-tree/page-tree-element.ts @@ -14,22 +14,22 @@ import {html, LitElement, TemplateResult, PropertyValues} from 'lit'; import {customElement, property, query} from 'lit/decorators'; import {until} from 'lit/directives/until'; -import {lll} from 'TYPO3/CMS/Core/lit-helper'; -import {PageTree} from './PageTree'; -import {TreeNode} from './../Tree/TreeNode'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import Persistent from 'TYPO3/CMS/Backend/Storage/Persistent'; -import {getRecordFromName} from '../Module'; -import ContextMenu from '../ContextMenu'; +import {lll} from '@typo3/core/lit-helper'; +import {PageTree} from './page-tree'; +import {TreeNode} from './../tree/tree-node'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import Persistent from '@typo3/backend/storage/persistent'; +import {getRecordFromName} from '../module'; +import ContextMenu from '../context-menu'; import * as d3selection from 'd3-selection'; -import {KeyTypesEnum as KeyTypes} from 'TYPO3/CMS/Backend/Enum/KeyTypes'; -import {TreeNodeSelection, TreeWrapperSelection, Toolbar} from '../SvgTree'; -import {DragDrop, DragDropHandler, DraggablePositionEnum} from '../Tree/DragDrop'; +import {KeyTypesEnum as KeyTypes} from '@typo3/backend/enum/key-types'; +import {TreeNodeSelection, TreeWrapperSelection, Toolbar} from '../svg-tree'; +import {DragDrop, DragDropHandler, DraggablePositionEnum} from '../tree/drag-drop'; import {D3DragEvent} from 'd3-drag'; -import Modal from '../Modal'; -import Severity from '../Severity'; -import {ModuleStateStorage} from '../Storage/ModuleStateStorage'; +import Modal from '../modal'; +import Severity from '../severity'; +import {ModuleStateStorage} from '../storage/module-state-storage'; /** * This module defines the Custom Element for rendering the navigation component for an editable page tree diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/PageTree/PageTree.ts b/Build/Sources/TypeScript/backend/page-tree/page-tree.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/PageTree/PageTree.ts rename to Build/Sources/TypeScript/backend/page-tree/page-tree.ts index 630a3f92edd51dc0dd83dca0d19dc462538ff0b0..7bb846b88629b4d450fe21b5eeb351d254ac56c1 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/PageTree/PageTree.ts +++ b/Build/Sources/TypeScript/backend/page-tree/page-tree.ts @@ -11,10 +11,10 @@ * The TYPO3 project - inspiring people to share! */ -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {SvgTree, TreeNodeSelection} from '../SvgTree'; -import {TreeNode} from '../Tree/TreeNode'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {SvgTree, TreeNodeSelection} from '../svg-tree'; +import {TreeNode} from '../tree/tree-node'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; /** * A Tree based on SVG for pages, which has a AJAX-based loading of the tree diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Popover.ts b/Build/Sources/TypeScript/backend/popover.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Popover.ts rename to Build/Sources/TypeScript/backend/popover.ts index 8e91e3c5b164f136a24047f2193bd1471c10a2dc..36d14aaec101273c1e7c0981c3e6d6142a4aa0f9 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Popover.ts +++ b/Build/Sources/TypeScript/backend/popover.ts @@ -15,9 +15,9 @@ import $ from 'jquery'; import {Popover as BootstrapPopover} from 'bootstrap'; /** - * Module: TYPO3/CMS/Backend/Popover + * Module: @typo3/backend/popover * API for popover windows powered by Twitter Bootstrap. - * @exports TYPO3/CMS/Backend/Popover + * @exports @typo3/backend/popover */ class Popover { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Severity.ts b/Build/Sources/TypeScript/backend/severity.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Severity.ts rename to Build/Sources/TypeScript/backend/severity.ts index 885bb6859c9bfc2d9d808a6d6010925efbb12fe8..eac3296f498c092c9057cb402878eeb0b0317831 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Severity.ts +++ b/Build/Sources/TypeScript/backend/severity.ts @@ -11,10 +11,10 @@ * The TYPO3 project - inspiring people to share! */ -import {SeverityEnum} from './Enum/Severity'; +import {SeverityEnum} from './enum/severity'; /** - * Module: TYPO3/CMS/Backend/Severity + * Module: @typo3/backend/severity * Severity for the TYPO3 backend */ class Severity { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/SiteInlineActions.ts b/Build/Sources/TypeScript/backend/site-inline-actions.ts similarity index 89% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/SiteInlineActions.ts rename to Build/Sources/TypeScript/backend/site-inline-actions.ts index 7f6d2d8600f9ff0b488ac66380a736ebb8bf4e07..0250d8485559150ec2a403923a325e2ae2ae2f09 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/SiteInlineActions.ts +++ b/Build/Sources/TypeScript/backend/site-inline-actions.ts @@ -11,10 +11,10 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import DocumentService from '@typo3/core/document-service'; /** - * Module: TYPO3/CMS/Backend/SiteInlineActions + * Module: @typo3/backend/site-inline-actions * Site configuration backend module FormEngine inline: * Override inline 'create' and 'details' route to point to SiteInlineAjaxController */ diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/AbstractClientStorage.ts b/Build/Sources/TypeScript/backend/storage/abstract-client-storage.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/AbstractClientStorage.ts rename to Build/Sources/TypeScript/backend/storage/abstract-client-storage.ts index d6c6656b63b33007e21f8b344985f4fb0a1c1fe8..37d83defe39933e77ed6664844459cdbda5bbe45 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/AbstractClientStorage.ts +++ b/Build/Sources/TypeScript/backend/storage/abstract-client-storage.ts @@ -12,8 +12,8 @@ */ /** - * Module: TYPO3/CMS/Backend/Storage/AbstractClientStorage - * @exports TYPO3/CMS/Backend/Storage/AbstractClientStorage + * Module: @typo3/backend/storage/abstract-client-storage + * @exports @typo3/backend/storage/abstract-client-storage */ export default abstract class AbstractClientStorage { protected keyPrefix: string = 't3-'; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/BrowserSession.ts b/Build/Sources/TypeScript/backend/storage/browser-session.ts similarity index 79% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/BrowserSession.ts rename to Build/Sources/TypeScript/backend/storage/browser-session.ts index 8cb8fb37675c733394c8438a7ff4f67f95397c39..f590be25c6dc22a96374a4e8c6cb12db3a8ced88 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/BrowserSession.ts +++ b/Build/Sources/TypeScript/backend/storage/browser-session.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import AbstractClientStorage from './AbstractClientStorage'; +import AbstractClientStorage from './abstract-client-storage'; /** - * Module: TYPO3/CMS/Backend/Storage/BrowserSession + * Module: @typo3/backend/storage/browser-session * Wrapper for sessionStorage - * @exports TYPO3/CMS/Backend/Storage/BrowserSession + * @exports @typo3/backend/storage/browser-session */ class BrowserSession extends AbstractClientStorage { public constructor() { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/Client.ts b/Build/Sources/TypeScript/backend/storage/client.ts similarity index 80% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/Client.ts rename to Build/Sources/TypeScript/backend/storage/client.ts index 810e72d42ebf5874cbdca9e5e09224c23a93a67e..245a3276b8ed49f65862de2bc62cbdef23a62fea 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/Client.ts +++ b/Build/Sources/TypeScript/backend/storage/client.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import AbstractClientStorage from './AbstractClientStorage'; +import AbstractClientStorage from './abstract-client-storage'; /** - * Module: TYPO3/CMS/Backend/Storage/Client + * Module: @typo3/backend/storage/client * Wrapper for localStorage - * @exports TYPO3/CMS/Backend/Storage/Client + * @exports @typo3/backend/storage/client */ class Client extends AbstractClientStorage { public constructor() { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/ModuleStateStorage.ts b/Build/Sources/TypeScript/backend/storage/module-state-storage.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/ModuleStateStorage.ts rename to Build/Sources/TypeScript/backend/storage/module-state-storage.ts index 59a13a7535a8693b5b81335fded483a09d8b68c3..7c6ecfd988a890b658add85c9857f6879915cf4f 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/ModuleStateStorage.ts +++ b/Build/Sources/TypeScript/backend/storage/module-state-storage.ts @@ -30,7 +30,7 @@ interface CurrentState { * > between modules Typically that is set by something like this in a * > Web>* sub module * - * @exports TYPO3/CMS/Backend/Storage/ModuleStateStorage + * @exports @typo3/backend/storage/module-state-storage */ export class ModuleStateStorage { private static prefix = 't3-module-state-'; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/Persistent.ts b/Build/Sources/TypeScript/backend/storage/persistent.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/Persistent.ts rename to Build/Sources/TypeScript/backend/storage/persistent.ts index 17a01eaec40223801127f48178e1d2c255133ebd..0177e7878cf2d5b55e533a474fc304f69024c3c1 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Storage/Persistent.ts +++ b/Build/Sources/TypeScript/backend/storage/persistent.ts @@ -14,9 +14,9 @@ import $ from 'jquery'; /** - * Module: TYPO3/CMS/Backend/Storage/Persistent + * Module: @typo3/backend/storage/persistent * Wrapper for persistent storage in UC - * @exports TYPO3/CMS/Backend/Storage/Persistent + * @exports @typo3/backend/storage/persistent */ class Persistent { private data: any = false; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/SvgTree.ts b/Build/Sources/TypeScript/backend/svg-tree.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/SvgTree.ts rename to Build/Sources/TypeScript/backend/svg-tree.ts index ebce3d06a64247494108c5a47a01bb0cca2ced57..dfd3e1eed9d683491ad56bb1eb479733a5141acf 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/SvgTree.ts +++ b/Build/Sources/TypeScript/backend/svg-tree.ts @@ -13,18 +13,18 @@ import {html, LitElement, TemplateResult} from 'lit'; import {customElement, property, state} from 'lit/decorators'; -import {TreeNode} from './Tree/TreeNode'; +import {TreeNode} from './tree/tree-node'; import * as d3selection from 'd3-selection'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Notification from './Notification'; -import {KeyTypesEnum as KeyTypes} from './Enum/KeyTypes'; -import Icons from './Icons'; -import Tooltip from './Tooltip'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {MarkupIdentifiers} from './Enum/IconTypes'; -import {lll} from 'TYPO3/CMS/Core/lit-helper'; -import DebounceEvent from 'TYPO3/CMS/Core/Event/DebounceEvent'; -import 'TYPO3/CMS/Backend/Element/IconElement'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Notification from './notification'; +import {KeyTypesEnum as KeyTypes} from './enum/key-types'; +import Icons from './icons'; +import Tooltip from './tooltip'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {MarkupIdentifiers} from './enum/icon-types'; +import {lll} from '@typo3/core/lit-helper'; +import DebounceEvent from '@typo3/core/event/debounce-event'; +import '@typo3/backend/element/icon-element'; import {Tooltip as BootstrapTooltip} from 'bootstrap'; export type TreeWrapperSelection<TBase extends d3selection.BaseType> = d3selection.Selection<TBase, any, any, any>; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/SwitchUser.ts b/Build/Sources/TypeScript/backend/switch-user.ts similarity index 91% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/SwitchUser.ts rename to Build/Sources/TypeScript/backend/switch-user.ts index 6e89c039e4fea5b9415b2c0f4d369ed731cb3c0b..c56987612727345abfa2dd976d0a8791543bfe4a 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/SwitchUser.ts +++ b/Build/Sources/TypeScript/backend/switch-user.ts @@ -13,9 +13,9 @@ import {html, TemplateResult, LitElement} from 'lit'; import {customElement, property} from 'lit/decorators'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import Notification from 'TYPO3/CMS/Backend/Notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import Notification from '@typo3/backend/notification'; enum Modes { switch = 'switch', @@ -23,7 +23,7 @@ enum Modes { } /** - * Module: TYPO3/CMS/Backend/SwitchUser + * Module: @typo3/backend/switch-user * * @example * <typo3-switch-user targetUser="123" mode="switch"> diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tabs.ts b/Build/Sources/TypeScript/backend/tabs.ts similarity index 88% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tabs.ts rename to Build/Sources/TypeScript/backend/tabs.ts index 31011cc9c1c19a213cc96b588f6cb4616f02c118..c9cce1d3dab53ae3269072905b12283f2c45d1f5 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tabs.ts +++ b/Build/Sources/TypeScript/backend/tabs.ts @@ -12,13 +12,13 @@ */ import {Tab} from 'bootstrap'; -import BrowserSession from './Storage/BrowserSession'; -import Client from './Storage/Client'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import BrowserSession from './storage/browser-session'; +import Client from './storage/client'; +import DocumentService from '@typo3/core/document-service'; /** - * Module: TYPO3/CMS/Backend/Tabs - * @exports TYPO3/CMS/Backend/Tabs + * Module: @typo3/backend/tabs + * @exports @typo3/backend/tabs */ class Tabs { /** diff --git a/Build/Sources/TypeScript/backend/Tests/BackendExceptionTest.ts b/Build/Sources/TypeScript/backend/tests/backend-exception-test.ts similarity index 86% rename from Build/Sources/TypeScript/backend/Tests/BackendExceptionTest.ts rename to Build/Sources/TypeScript/backend/tests/backend-exception-test.ts index 5cb1e93a60ea9ed06656bcbf8d460014b52f147d..8c0fcbc65629ff1232c649d1509ac0123d7d786d 100644 --- a/Build/Sources/TypeScript/backend/Tests/BackendExceptionTest.ts +++ b/Build/Sources/TypeScript/backend/tests/backend-exception-test.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import {BackendException} from 'TYPO3/CMS/Backend/BackendException'; +import {BackendException} from '@typo3/backend/backend-exception'; -describe('TYPO3/CMS/Backend/BackendException', () => { +describe('@typo3/backend/backend-exception', () => { it('sets exception message', () => { const backendException: BackendException = new BackendException('some message'); expect(backendException.message).toBe('some message'); diff --git a/Build/Sources/TypeScript/backend/Tests/Element/ImmediateActionElementTest.ts b/Build/Sources/TypeScript/backend/tests/element/immediate-action-element-test.ts similarity index 89% rename from Build/Sources/TypeScript/backend/Tests/Element/ImmediateActionElementTest.ts rename to Build/Sources/TypeScript/backend/tests/element/immediate-action-element-test.ts index b92f444255901fe4238619f143721149bb5b902e..cfece04cf9689c671a6c29db1a54bbe0addd5744 100644 --- a/Build/Sources/TypeScript/backend/Tests/Element/ImmediateActionElementTest.ts +++ b/Build/Sources/TypeScript/backend/tests/element/immediate-action-element-test.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import {ImmediateActionElement} from 'TYPO3/CMS/Backend/Element/ImmediateActionElement'; -import moduleMenuApp from 'TYPO3/CMS/Backend/ModuleMenu'; -import viewportObject from 'TYPO3/CMS/Backend/Viewport'; +import {ImmediateActionElement} from '@typo3/backend/element/immediate-action-element'; +import moduleMenuApp from '@typo3/backend/module-menu'; +import viewportObject from '@typo3/backend/viewport'; describe('TYPO3/CMS/Backend/Element/ImmediateActionElement:', () => { let root: HTMLElement; // This will hold the actual element under test. @@ -41,7 +41,7 @@ describe('TYPO3/CMS/Backend/Element/ImmediateActionElement:', () => { element.setAttribute('action', 'TYPO3.Backend.Topbar.refresh'); expect(observer.refresh).not.toHaveBeenCalled(); root.appendChild(element); - await import('TYPO3/CMS/Backend/Viewport'); + await import('@typo3/backend/viewport'); await new Promise((resolve) => setTimeout(resolve, 100)) expect(observer.refresh).toHaveBeenCalled(); (viewportObject as any).Topbar = backup; @@ -60,7 +60,7 @@ describe('TYPO3/CMS/Backend/Element/ImmediateActionElement:', () => { element.setAttribute('action', 'TYPO3.Backend.Topbar.refresh'); expect(observer.refresh).not.toHaveBeenCalled(); root.appendChild(element); - await import('TYPO3/CMS/Backend/Viewport'); + await import('@typo3/backend/viewport'); await new Promise((resolve) => setTimeout(resolve, 100)) expect(observer.refresh).toHaveBeenCalled(); (viewportObject as any).Topbar = backup; @@ -78,7 +78,7 @@ describe('TYPO3/CMS/Backend/Element/ImmediateActionElement:', () => { const element = document.createRange().createContextualFragment('<typo3-immediate-action action="TYPO3.ModuleMenu.App.refreshMenu"></typo3-immediate-action>').querySelector('typo3-immediate-action'); expect(observer.refreshMenu).not.toHaveBeenCalled(); root.appendChild(element); - await import('TYPO3/CMS/Backend/ModuleMenu'); + await import('@typo3/backend/module-menu'); await new Promise((resolve) => setTimeout(resolve, 100)) expect(observer.refreshMenu).toHaveBeenCalled(); (viewportObject as any).App = backup; @@ -94,7 +94,7 @@ describe('TYPO3/CMS/Backend/Element/ImmediateActionElement:', () => { spyOn(observer, 'refreshMenu').and.callThrough(); (moduleMenuApp as any).App = observer; root.innerHTML = '<typo3-immediate-action action="TYPO3.ModuleMenu.App.refreshMenu"></typo3-immediate-action>'; - await import('TYPO3/CMS/Backend/ModuleMenu'); + await import('@typo3/backend/module-menu'); await new Promise((resolve) => setTimeout(resolve, 100)) expect(observer.refreshMenu).toHaveBeenCalled(); (moduleMenuApp as any).App = backup; diff --git a/Build/Sources/TypeScript/backend/Tests/FormEngineValidationTest.ts b/Build/Sources/TypeScript/backend/tests/form-engine-validation-test.ts similarity index 99% rename from Build/Sources/TypeScript/backend/Tests/FormEngineValidationTest.ts rename to Build/Sources/TypeScript/backend/tests/form-engine-validation-test.ts index 72af33f8c8eb65cadc0bdd0030429e34f202e7c6..840a3697a1117cdf5f319a630df42b1e32a0d5fb 100644 --- a/Build/Sources/TypeScript/backend/Tests/FormEngineValidationTest.ts +++ b/Build/Sources/TypeScript/backend/tests/form-engine-validation-test.ts @@ -1,5 +1,5 @@ import $ from 'jquery'; -import FormEngineValidation from 'TYPO3/CMS/Backend/FormEngineValidation'; +import FormEngineValidation from '@typo3/backend/form-engine-validation'; declare function using(values: Function|Array<Object>|Object, func: Function): void; diff --git a/Build/Sources/TypeScript/backend/Tests/GridEditorTest.ts b/Build/Sources/TypeScript/backend/tests/grid-editor-test.ts similarity index 93% rename from Build/Sources/TypeScript/backend/Tests/GridEditorTest.ts rename to Build/Sources/TypeScript/backend/tests/grid-editor-test.ts index 1f67f19a16deeb998471b804611719134e0b1c21..b11b6b9db6852997995ec18986acff13cf316186 100644 --- a/Build/Sources/TypeScript/backend/Tests/GridEditorTest.ts +++ b/Build/Sources/TypeScript/backend/tests/grid-editor-test.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import {GridEditor} from 'TYPO3/CMS/Backend/GridEditor'; +import {GridEditor} from '@typo3/backend/grid-editor'; describe('TYPO3/CMS/Backend/GridEditorTest:', () => { diff --git a/Build/Sources/TypeScript/backend/Tests/Hashing/Md5Test.ts b/Build/Sources/TypeScript/backend/tests/hashing/md5Test.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Tests/Hashing/Md5Test.ts rename to Build/Sources/TypeScript/backend/tests/hashing/md5Test.ts index 94d189e552886399f0fef30c3d9a1e29cdf28c93..74befbcaefcbd546970d5b8b32acd26650f88952 100644 --- a/Build/Sources/TypeScript/backend/Tests/Hashing/Md5Test.ts +++ b/Build/Sources/TypeScript/backend/tests/hashing/md5Test.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import Md5 from 'TYPO3/CMS/Backend/Hashing/Md5'; +import Md5 from '@typo3/backend/hashing/md5'; describe('TYPO3/CMS/Backend/Hashing/Md5:', () => { describe('tests for hash', () => { diff --git a/Build/Sources/TypeScript/backend/Tests/IconsTest.ts b/Build/Sources/TypeScript/backend/tests/icons-test.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Tests/IconsTest.ts rename to Build/Sources/TypeScript/backend/tests/icons-test.ts index 54c406c469a447df8bf5c4d6c44e617ca417c8ab..942fbfe1ae92a55aa908d7ccb64cb74d9b98bbb4 100644 --- a/Build/Sources/TypeScript/backend/Tests/IconsTest.ts +++ b/Build/Sources/TypeScript/backend/tests/icons-test.ts @@ -1,5 +1,5 @@ import $ from 'jquery'; -import Icons from 'TYPO3/CMS/Backend/Icons'; +import Icons from '@typo3/backend/icons'; describe('TYPO3/CMS/Backend/IconsTest:', () => { /** diff --git a/Build/Sources/TypeScript/backend/Tests/NotificationTest.ts b/Build/Sources/TypeScript/backend/tests/notification-test.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Tests/NotificationTest.ts rename to Build/Sources/TypeScript/backend/tests/notification-test.ts index 9e2d5296724ece7fb39623b85b0dedc40e88da3d..0b5075eee5def3684447662706741651125838aa 100644 --- a/Build/Sources/TypeScript/backend/Tests/NotificationTest.ts +++ b/Build/Sources/TypeScript/backend/tests/notification-test.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import DeferredAction from 'TYPO3/CMS/Backend/ActionButton/DeferredAction'; -import ImmediateAction from 'TYPO3/CMS/Backend/ActionButton/ImmediateAction'; -import Notification from 'TYPO3/CMS/Backend/Notification'; +import DeferredAction from '@typo3/backend/action-button/deferred-action'; +import ImmediateAction from '@typo3/backend/action-button/immediate-action'; +import Notification from '@typo3/backend/notification'; import type {LitElement} from 'lit'; describe('TYPO3/CMS/Backend/Notification:', () => { diff --git a/Build/Sources/TypeScript/backend/Tests/PopoverTest.ts b/Build/Sources/TypeScript/backend/tests/popover-test.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Tests/PopoverTest.ts rename to Build/Sources/TypeScript/backend/tests/popover-test.ts index c1c104d227674ed5c3b969925aa801551c50a97e..29fa1fd06c62ca3228ef83077b72548e3f4798ae 100644 --- a/Build/Sources/TypeScript/backend/Tests/PopoverTest.ts +++ b/Build/Sources/TypeScript/backend/tests/popover-test.ts @@ -1,6 +1,6 @@ import $ from 'jquery'; import {Popover as BootstrapPopover} from 'bootstrap'; -import Popover from 'TYPO3/CMS/Backend/Popover'; +import Popover from '@typo3/backend/popover'; describe('TYPO3/CMS/Backend/PopoverTest:', () => { /** diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar.ts b/Build/Sources/TypeScript/backend/toolbar.ts similarity index 86% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar.ts rename to Build/Sources/TypeScript/backend/toolbar.ts index 1bff84c9a24784955ca5614db65c4dc3ae601f64..c8ce7de5e692008c9f558ce3d4fbb36923b089f5 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar.ts +++ b/Build/Sources/TypeScript/backend/toolbar.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import DocumentService from '@typo3/core/document-service'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Backend/Toolbar + * Module: @typo3/backend/toolbar * Toolbar component of the TYPO3 backend - * @exports TYPO3/CMS/Backend/Toolbar + * @exports @typo3/backend/toolbar */ class Toolbar { public static initialize(): void { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/ClearCacheMenu.ts b/Build/Sources/TypeScript/backend/toolbar/clear-cache-menu.ts similarity index 90% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/ClearCacheMenu.ts rename to Build/Sources/TypeScript/backend/toolbar/clear-cache-menu.ts index cb7764dd30413529ef5e94c459e611b8077aff8d..30ce5340f27a114844345d11f86e62cf081d4a9b 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/ClearCacheMenu.ts +++ b/Build/Sources/TypeScript/backend/toolbar/clear-cache-menu.ts @@ -12,11 +12,11 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Icons from '../Icons'; -import Notification from '../Notification'; -import Viewport from '../Viewport'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Icons from '../icons'; +import Notification from '../notification'; +import Viewport from '../viewport'; enum Identifiers { containerSelector = '#typo3-cms-backend-backend-toolbaritems-clearcachetoolbaritem', @@ -25,7 +25,7 @@ enum Identifiers { } /** - * Module: TYPO3/CMS/Backend/Toolbar/ClearCacheMenu + * Module: @typo3/backend/toolbar/clear-cache-menu * main functionality for clearing caches via the top bar * reloading the clear cache icon */ diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/LiveSearch.ts b/Build/Sources/TypeScript/backend/toolbar/live-search.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/LiveSearch.ts rename to Build/Sources/TypeScript/backend/toolbar/live-search.ts index 82ffe05c7d93f8ef3da3d7d96c4ff7cc954e635c..ffb3f28bf3d812f84f1657dfc7f8169333f96a31 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/LiveSearch.ts +++ b/Build/Sources/TypeScript/backend/toolbar/live-search.ts @@ -12,14 +12,14 @@ */ import $ from 'jquery'; -import Viewport from '../Viewport'; -import Icons from '../Icons'; +import Viewport from '../viewport'; +import Icons from '../icons'; import 'jquery/autocomplete'; -import '../Input/Clearable'; +import '../input/clearable'; import {html, render, TemplateResult} from 'lit'; import {unsafeHTML} from 'lit/directives/unsafe-html'; -import {renderHTML} from 'TYPO3/CMS/Core/lit-helper'; -import {ModuleStateStorage} from 'TYPO3/CMS/Backend/Storage/ModuleStateStorage'; +import {renderHTML} from '@typo3/core/lit-helper'; +import {ModuleStateStorage} from '@typo3/backend/storage/module-state-storage'; enum Identifiers { containerSelector = '#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem', @@ -44,9 +44,9 @@ interface Suggestion { } /** - * Module: TYPO3/CMS/Backend/Toolbar/LiveSearch + * Module: @typo3/backend/toolbar/live-search * Global search to deal with everything in the backend that is search-related - * @exports TYPO3/CMS/Backend/Toolbar/LiveSearch + * @exports @typo3/backend/toolbar/live-search */ class LiveSearch { private url: string = TYPO3.settings.ajaxUrls.livesearch; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/ShortcutMenu.ts b/Build/Sources/TypeScript/backend/toolbar/shortcut-menu.ts similarity index 95% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/ShortcutMenu.ts rename to Build/Sources/TypeScript/backend/toolbar/shortcut-menu.ts index df15c93891b66f5027a5b78a6730c8b107064897..bb62bb50c221060ff4ecc0664ce320900d433c5e 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/ShortcutMenu.ts +++ b/Build/Sources/TypeScript/backend/toolbar/shortcut-menu.ts @@ -12,14 +12,14 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Icons from '../Icons'; -import Modal from '../Modal'; -import Notification from '../Notification'; -import Viewport from '../Viewport'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; -import {ModuleStateStorage} from 'TYPO3/CMS/Backend/Storage/ModuleStateStorage'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Icons from '../icons'; +import Modal from '../modal'; +import Notification from '../notification'; +import Viewport from '../viewport'; +import SecurityUtility from '@typo3/core/security-utility'; +import {ModuleStateStorage} from '@typo3/backend/storage/module-state-storage'; enum Identifiers { containerSelector = '#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem', diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/SystemInformationMenu.ts b/Build/Sources/TypeScript/backend/toolbar/system-information-menu.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/SystemInformationMenu.ts rename to Build/Sources/TypeScript/backend/toolbar/system-information-menu.ts index eaf465d597bcd914e0b47ba7601fc3445868dd1e..180e04fa924bec92863f1c469bfa5f30bcf5a56e 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/SystemInformationMenu.ts +++ b/Build/Sources/TypeScript/backend/toolbar/system-information-menu.ts @@ -12,11 +12,11 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Icons from '../Icons'; -import PersistentStorage from '../Storage/Persistent'; -import Viewport from '../Viewport'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Icons from '../icons'; +import PersistentStorage from '../storage/persistent'; +import Viewport from '../viewport'; enum Identifiers { containerSelector = '#typo3-cms-backend-backend-toolbaritems-systeminformationtoolbaritem', @@ -27,7 +27,7 @@ enum Identifiers { } /** - * Module: TYPO3/CMS/Backend/Toolbar/SystemInformationMenu + * Module: @typo3/backend/toolbar/system-information-menu * System information menu handler */ class SystemInformationMenu { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tooltip.ts b/Build/Sources/TypeScript/backend/tooltip.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tooltip.ts rename to Build/Sources/TypeScript/backend/tooltip.ts index 94e820ddcb158827e110d2f2e395979c1e796140..0aa6c967f4b2156eec5be93778013224b4bbdbee 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tooltip.ts +++ b/Build/Sources/TypeScript/backend/tooltip.ts @@ -12,7 +12,7 @@ */ import {Tooltip as BootstrapTooltip} from 'bootstrap'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import DocumentService from '@typo3/core/document-service'; /** * The main tooltip object diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/DragDrop.ts b/Build/Sources/TypeScript/backend/tree/drag-drop.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/DragDrop.ts rename to Build/Sources/TypeScript/backend/tree/drag-drop.ts index b0750e2487ab30b9a61e155ee2d860f81cddb689..8ab1d6c766f7f3b55b34cdada6734b879c695719 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/DragDrop.ts +++ b/Build/Sources/TypeScript/backend/tree/drag-drop.ts @@ -12,10 +12,10 @@ */ import {html, TemplateResult} from 'lit'; -import {renderNodes} from 'TYPO3/CMS/Core/lit-helper'; +import {renderNodes} from '@typo3/core/lit-helper'; import * as d3drag from 'd3-drag'; import * as d3selection from 'd3-selection'; -import {SvgTree, SvgTreeWrapper} from '../SvgTree'; +import {SvgTree, SvgTreeWrapper} from '../svg-tree'; /** * Contains basic types for allowing dragging + dropping in trees diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/FileStorageBrowser.ts b/Build/Sources/TypeScript/backend/tree/file-storage-browser.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/FileStorageBrowser.ts rename to Build/Sources/TypeScript/backend/tree/file-storage-browser.ts index a573ef50383e9ba9787490862acf6e8c8bf67e5a..fd36215200b2bc4fff8338977e19043ef6f80773 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/FileStorageBrowser.ts +++ b/Build/Sources/TypeScript/backend/tree/file-storage-browser.ts @@ -13,15 +13,15 @@ import {html, LitElement, TemplateResult} from 'lit'; import {customElement, query} from 'lit/decorators'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {TreeNode} from './TreeNode'; -import {Toolbar, TreeNodeSelection} from '../SvgTree'; -import ElementBrowser from 'TYPO3/CMS/Recordlist/ElementBrowser'; -import LinkBrowser from 'TYPO3/CMS/Recordlist/LinkBrowser'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import Persistent from 'TYPO3/CMS/Backend/Storage/Persistent'; -import {FileStorageTree} from './FileStorageTree'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {TreeNode} from './tree-node'; +import {Toolbar, TreeNodeSelection} from '../svg-tree'; +import ElementBrowser from '@typo3/recordlist/element-browser'; +import LinkBrowser from '@typo3/recordlist/link-browser'; +import '@typo3/backend/element/icon-element'; +import Persistent from '@typo3/backend/storage/persistent'; +import {FileStorageTree} from './file-storage-tree'; const componentName: string = 'typo3-backend-component-filestorage-browser'; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/FileStorageTreeContainer.ts b/Build/Sources/TypeScript/backend/tree/file-storage-tree-container.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/FileStorageTreeContainer.ts rename to Build/Sources/TypeScript/backend/tree/file-storage-tree-container.ts index 00f8bad9c5f36f63b2c1f4ce6e595a0644483848..1898bd9318bfd8dbb24ff83b11b7df2fe66bfba4 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/FileStorageTreeContainer.ts +++ b/Build/Sources/TypeScript/backend/tree/file-storage-tree-container.ts @@ -13,20 +13,20 @@ import {html, LitElement, TemplateResult} from 'lit'; import {customElement, query} from 'lit/decorators'; -import {FileStorageTree} from './FileStorageTree'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import {TreeNode} from 'TYPO3/CMS/Backend/Tree/TreeNode'; -import Persistent from 'TYPO3/CMS/Backend/Storage/Persistent'; -import ContextMenu from '../ContextMenu'; +import {FileStorageTree} from './file-storage-tree'; +import '@typo3/backend/element/icon-element'; +import {TreeNode} from '@typo3/backend/tree/tree-node'; +import Persistent from '@typo3/backend/storage/persistent'; +import ContextMenu from '../context-menu'; import {D3DragEvent} from 'd3-drag'; -import {DragDropHandler, DragDrop, DraggablePositionEnum} from './DragDrop'; -import Modal from '../Modal'; -import Severity from '../Severity'; -import Notification from '../Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {TreeNodeSelection, Toolbar} from '../SvgTree'; -import {ModuleStateStorage} from '../Storage/ModuleStateStorage'; -import {getRecordFromName} from '../Module'; +import {DragDropHandler, DragDrop, DraggablePositionEnum} from './drag-drop'; +import Modal from '../modal'; +import Severity from '../severity'; +import Notification from '../notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {TreeNodeSelection, Toolbar} from '../svg-tree'; +import {ModuleStateStorage} from '../storage/module-state-storage'; +import {getRecordFromName} from '../module'; export const navigationComponentName: string = 'typo3-backend-navigation-component-filestoragetree'; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/FileStorageTree.ts b/Build/Sources/TypeScript/backend/tree/file-storage-tree.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/FileStorageTree.ts rename to Build/Sources/TypeScript/backend/tree/file-storage-tree.ts index 5f78fe51dc17b50f65219419abdf4fdbf5267c3e..eb8c7bbf84e2d0648fd1c4df485027ce07585d76 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/FileStorageTree.ts +++ b/Build/Sources/TypeScript/backend/tree/file-storage-tree.ts @@ -11,10 +11,10 @@ * The TYPO3 project - inspiring people to share! */ -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {SvgTree} from '../SvgTree'; -import {TreeNode} from '../Tree/TreeNode'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {SvgTree} from '../svg-tree'; +import {TreeNode} from '../tree/tree-node'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; /** * A tree for folders / storages diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/PageBrowser.ts b/Build/Sources/TypeScript/backend/tree/page-browser.ts similarity index 94% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/PageBrowser.ts rename to Build/Sources/TypeScript/backend/tree/page-browser.ts index b057d6dd3e475c742cf767567922d76dca3f16eb..2fab2864ace2652dafd9a4154386f13297712311 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/PageBrowser.ts +++ b/Build/Sources/TypeScript/backend/tree/page-browser.ts @@ -14,16 +14,16 @@ import {html, LitElement, TemplateResult} from 'lit'; import {customElement, property, query} from 'lit/decorators'; import {until} from 'lit/directives/until'; -import {lll} from 'TYPO3/CMS/Core/lit-helper'; -import {PageTree} from '../PageTree/PageTree'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {TreeNode} from './TreeNode'; -import {TreeNodeSelection, Toolbar} from '../SvgTree'; -import ElementBrowser from 'TYPO3/CMS/Recordlist/ElementBrowser'; -import LinkBrowser from 'TYPO3/CMS/Recordlist/LinkBrowser'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import Persistent from 'TYPO3/CMS/Backend/Storage/Persistent'; +import {lll} from '@typo3/core/lit-helper'; +import {PageTree} from '../page-tree/page-tree'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {TreeNode} from './tree-node'; +import {TreeNodeSelection, Toolbar} from '../svg-tree'; +import ElementBrowser from '@typo3/recordlist/element-browser'; +import LinkBrowser from '@typo3/recordlist/link-browser'; +import '@typo3/backend/element/icon-element'; +import Persistent from '@typo3/backend/storage/persistent'; const componentName: string = 'typo3-backend-component-page-browser'; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/TreeNode.ts b/Build/Sources/TypeScript/backend/tree/tree-node.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/TreeNode.ts rename to Build/Sources/TypeScript/backend/tree/tree-node.ts index 17e6dc4d0791e23829137297174731a0527c2c5c..f8a45eea2463e600f6b64360667ac35708e36f17 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Tree/TreeNode.ts +++ b/Build/Sources/TypeScript/backend/tree/tree-node.ts @@ -12,7 +12,7 @@ */ import * as d3selection from 'd3-selection'; -import {DraggablePositionEnum} from './DragDrop'; +import {DraggablePositionEnum} from './drag-drop'; /** * Represents a single node in the SVG tree that is rendered. diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/UserPassLogin.ts b/Build/Sources/TypeScript/backend/user-pass-login.ts similarity index 96% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/UserPassLogin.ts rename to Build/Sources/TypeScript/backend/user-pass-login.ts index a57251355171135992dec9cf610e923a92424696..bfd1cc6596132d4f8a583607da4e25c107b3b3e2 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/UserPassLogin.ts +++ b/Build/Sources/TypeScript/backend/user-pass-login.ts @@ -12,12 +12,12 @@ */ import $ from 'jquery'; -import Login from './Login'; +import Login from './login'; /** - * Module: TYPO3/CMS/Backend/UserPassLogin + * Module: @typo3/backend/user-pass-login * JavaScript module for the UsernamePasswordLoginProvider - * @exports TYPO3/CMS/Backend/UserPassLogin + * @exports @typo3/backend/user-pass-login */ class UserPassLogin { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility.ts b/Build/Sources/TypeScript/backend/utility.ts similarity index 99% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility.ts rename to Build/Sources/TypeScript/backend/utility.ts index 4997a42ef47e1d67ae447db398edfb59fa1f9f4f..af22a842db5406fcef0bef584a4aa039896e8b3a 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility.ts +++ b/Build/Sources/TypeScript/backend/utility.ts @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/Backend/Utility + * Module: @typo3/backend/utility */ class Utility { /** diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility/MessageUtility.ts b/Build/Sources/TypeScript/backend/utility/message-utility.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility/MessageUtility.ts rename to Build/Sources/TypeScript/backend/utility/message-utility.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility/TopLevelModuleImport.ts b/Build/Sources/TypeScript/backend/utility/top-level-module-import.ts similarity index 100% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Utility/TopLevelModuleImport.ts rename to Build/Sources/TypeScript/backend/utility/top-level-module-import.ts diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport.ts b/Build/Sources/TypeScript/backend/viewport.ts similarity index 81% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport.ts rename to Build/Sources/TypeScript/backend/viewport.ts index e5e223a78e94d19b6ce385dbb9c0b8a7ebe3ce64..854aebd68bc15a2a0dc6cea64d07af9024ab6314 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport.ts +++ b/Build/Sources/TypeScript/backend/viewport.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import ContentContainer from './Viewport/ContentContainer'; -import ConsumerScope from './Event/ConsumerScope'; -import Loader from './Viewport/Loader'; -import NavigationContainer from './Viewport/NavigationContainer'; -import Topbar from './Viewport/Topbar'; +import ContentContainer from './viewport/content-container'; +import ConsumerScope from './event/consumer-scope'; +import Loader from './viewport/loader'; +import NavigationContainer from './viewport/navigation-container'; +import Topbar from './viewport/topbar'; class Viewport { // The attributes are uppercase for compatibility reasons diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/AbstractContainer.ts b/Build/Sources/TypeScript/backend/viewport/abstract-container.ts similarity index 91% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/AbstractContainer.ts rename to Build/Sources/TypeScript/backend/viewport/abstract-container.ts index cc5ccfe2d0777c2d00949989369c0117c74d425c..70e721b73efdd7165d5dc1ab489752bb66068b83 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/AbstractContainer.ts +++ b/Build/Sources/TypeScript/backend/viewport/abstract-container.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import ConsumerScope from '../Event/ConsumerScope'; +import ConsumerScope from '../event/consumer-scope'; export abstract class AbstractContainer { protected readonly consumerScope: any = ConsumerScope; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/ContentContainer.ts b/Build/Sources/TypeScript/backend/viewport/content-container.ts similarity index 90% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/ContentContainer.ts rename to Build/Sources/TypeScript/backend/viewport/content-container.ts index 337d3f6dbe05fde77ba44e84b564897738e3f766..30c16d5400e44d876e3ff5261029443d771e6798 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/ContentContainer.ts +++ b/Build/Sources/TypeScript/backend/viewport/content-container.ts @@ -11,14 +11,14 @@ * The TYPO3 project - inspiring people to share! */ -import {ScaffoldIdentifierEnum} from '../Enum/Viewport/ScaffoldIdentifier'; -import {AbstractContainer} from './AbstractContainer'; +import {ScaffoldIdentifierEnum} from '../enum/viewport/scaffold-identifier'; +import {AbstractContainer} from './abstract-container'; import $ from 'jquery'; -import ClientRequest from '../Event/ClientRequest'; -import InteractionRequest from '../Event/InteractionRequest'; -import Loader from './Loader'; -import Utility from '../Utility'; -import TriggerRequest from '../Event/TriggerRequest'; +import ClientRequest from '../event/client-request'; +import InteractionRequest from '../event/interaction-request'; +import Loader from './loader'; +import Utility from '../utility'; +import TriggerRequest from '../event/trigger-request'; class ContentContainer extends AbstractContainer { public get(): Window { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/Loader.ts b/Build/Sources/TypeScript/backend/viewport/loader.ts similarity index 90% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/Loader.ts rename to Build/Sources/TypeScript/backend/viewport/loader.ts index 0083ddf520d71dec8ac821547d5fb189d6c41ca6..3a381ab6be146158cb24c129bef4f9e60f35307a 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/Loader.ts +++ b/Build/Sources/TypeScript/backend/viewport/loader.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import {ScaffoldIdentifierEnum} from '../Enum/Viewport/ScaffoldIdentifier'; +import {ScaffoldIdentifierEnum} from '../enum/viewport/scaffold-identifier'; import NProgress from 'nprogress'; class Loader { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/NavigationContainer.ts b/Build/Sources/TypeScript/backend/viewport/navigation-container.ts similarity index 92% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/NavigationContainer.ts rename to Build/Sources/TypeScript/backend/viewport/navigation-container.ts index 374d04549e45ccbdd82b4e189b982a7084b25de6..7e5f848152430b2abf477ed4f001c40be7ac9668 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/NavigationContainer.ts +++ b/Build/Sources/TypeScript/backend/viewport/navigation-container.ts @@ -11,10 +11,10 @@ * The TYPO3 project - inspiring people to share! */ -import {ScaffoldIdentifierEnum} from '../Enum/Viewport/ScaffoldIdentifier'; -import {AbstractContainer} from './AbstractContainer'; -import TriggerRequest from '../Event/TriggerRequest'; -import InteractionRequest from '../Event/InteractionRequest'; +import {ScaffoldIdentifierEnum} from '../enum/viewport/scaffold-identifier'; +import {AbstractContainer} from './abstract-container'; +import TriggerRequest from '../event/trigger-request'; +import InteractionRequest from '../event/interaction-request'; class NavigationContainer extends AbstractContainer { private activeComponentId: string = ''; @@ -52,13 +52,13 @@ class NavigationContainer extends AbstractContainer { return; } if (this.activeComponentId !== '') { - let activeComponentElement = container.querySelector('#navigationComponent-' + this.activeComponentId.replace(/[/]/g, '_')) as HTMLElement; + let activeComponentElement = container.querySelector('#navigationComponent-' + this.activeComponentId.replace(/[/@]/g, '_')) as HTMLElement; if (activeComponentElement) { activeComponentElement.style.display = 'none'; } } - const componentCssName = navigationComponentId.replace(/[/]/g, '_'); + const componentCssName = navigationComponentId.replace(/[/@]/g, '_'); const navigationComponentElement = 'navigationComponent-' + componentCssName; // The component was already set up, so requiring the module again can be excluded. diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/ResizableNavigation.ts b/Build/Sources/TypeScript/backend/viewport/resizable-navigation.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/ResizableNavigation.ts rename to Build/Sources/TypeScript/backend/viewport/resizable-navigation.ts index b107a3ae1c211d3aa609afbf79ff2665e3244911..9e84d61b1f7da23024a8dae158375dbac11131b8 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/ResizableNavigation.ts +++ b/Build/Sources/TypeScript/backend/viewport/resizable-navigation.ts @@ -13,9 +13,9 @@ import {html, LitElement, TemplateResult} from 'lit'; import {customElement, property, state} from 'lit/decorators'; -import {lll} from 'TYPO3/CMS/Core/lit-helper'; -import Persistent from '../Storage/Persistent'; -import 'TYPO3/CMS/Backend/Element/IconElement'; +import {lll} from '@typo3/core/lit-helper'; +import Persistent from '../storage/persistent'; +import '@typo3/backend/element/icon-element'; const selectorConverter = { fromAttribute(selector: string) { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/Toolbar.ts b/Build/Sources/TypeScript/backend/viewport/toolbar.ts similarity index 89% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/Toolbar.ts rename to Build/Sources/TypeScript/backend/viewport/toolbar.ts index 51dbecd73b9affe0a567c43627a3f5fe63c6cd06..07083e735bd5f37dbf801ad21345fa4b73a67d80 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/Toolbar.ts +++ b/Build/Sources/TypeScript/backend/viewport/toolbar.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import {ScaffoldIdentifierEnum} from '../Enum/Viewport/ScaffoldIdentifier'; +import {ScaffoldIdentifierEnum} from '../enum/viewport/scaffold-identifier'; import $ from 'jquery'; class Toolbar { diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/Topbar.ts b/Build/Sources/TypeScript/backend/viewport/topbar.ts similarity index 81% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/Topbar.ts rename to Build/Sources/TypeScript/backend/viewport/topbar.ts index 4324872c258e5f33a63fab36538e0a26ec4831d0..736aea9c0899cc9184a5b3e4eb8fad7f4d2a1506 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Viewport/Topbar.ts +++ b/Build/Sources/TypeScript/backend/viewport/topbar.ts @@ -11,10 +11,10 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {ScaffoldIdentifierEnum} from '../Enum/Viewport/ScaffoldIdentifier'; -import Toolbar from './Toolbar'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {ScaffoldIdentifierEnum} from '../enum/viewport/scaffold-identifier'; +import Toolbar from './toolbar'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; class Topbar { public static readonly topbarSelector: string = ScaffoldIdentifierEnum.header; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/WindowManager.ts b/Build/Sources/TypeScript/backend/window-manager.ts similarity index 98% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/WindowManager.ts rename to Build/Sources/TypeScript/backend/window-manager.ts index 4b8b117629a8485ffe0b685a428e4e1bf8d05342..9c3df64bf3e441b83a9cf627b3f39a684314cee4 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/WindowManager.ts +++ b/Build/Sources/TypeScript/backend/window-manager.ts @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/Backend/WindowManager + * Module: @typo3/backend/window-manager */ class WindowManager { private windows: {[key: string]: Window} = {}; diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Wizard.ts b/Build/Sources/TypeScript/backend/wizard.ts similarity index 97% rename from Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Wizard.ts rename to Build/Sources/TypeScript/backend/wizard.ts index b4168b4fd571d40c920eb047bb0a93e93f76feff..1d06c0c149a59e7c0c9b6cd746b9ac82aba9f379 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Wizard.ts +++ b/Build/Sources/TypeScript/backend/wizard.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import {SeverityEnum} from './Enum/Severity'; +import {SeverityEnum} from './enum/severity'; import $ from 'jquery'; -import Modal from './Modal'; -import Severity from './Severity'; -import Icons from './Icons'; +import Modal from './modal'; +import Severity from './severity'; +import Icons from './icons'; interface WizardSettings { @@ -38,8 +38,8 @@ interface Slide { } /** - * Module: TYPO3/CMS/Backend/Wizard - * @exports TYPO3/CMS/Backend/Wizard + * Module: @typo3/backend/wizard + * @exports @typo3/backend/wizard */ class Wizard { private setup: WizardSetup; diff --git a/Build/Sources/TypeScript/belog/Resources/Public/TypeScript/BackendLog.ts b/Build/Sources/TypeScript/belog/backend-log.ts similarity index 84% rename from Build/Sources/TypeScript/belog/Resources/Public/TypeScript/BackendLog.ts rename to Build/Sources/TypeScript/belog/backend-log.ts index bb0942cb16bb3fcfd40e290975b3847fc36f0584..8e3422ebc65ee4a46990da1b8c504a30df344a2a 100644 --- a/Build/Sources/TypeScript/belog/Resources/Public/TypeScript/BackendLog.ts +++ b/Build/Sources/TypeScript/belog/backend-log.ts @@ -11,14 +11,14 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import DateTimePicker from 'TYPO3/CMS/Backend/DateTimePicker'; -import 'TYPO3/CMS/Backend/Input/Clearable'; +import DocumentService from '@typo3/core/document-service'; +import DateTimePicker from '@typo3/backend/date-time-picker'; +import '@typo3/backend/input/clearable'; /** - * Module: TYPO3/CMS/Belog/BackendLog + * Module: @typo3/belog/backend-log * JavaScript for backend log - * @exports TYPO3/CMS/Belog/BackendLog + * @exports @typo3/belog/backend-log */ class BackendLog { private clearableElements: NodeListOf<HTMLInputElement> = null; diff --git a/Build/Sources/TypeScript/beuser/Resources/Public/TypeScript/BackendUserListing.ts b/Build/Sources/TypeScript/beuser/backend-user-listing.ts similarity index 87% rename from Build/Sources/TypeScript/beuser/Resources/Public/TypeScript/BackendUserListing.ts rename to Build/Sources/TypeScript/beuser/backend-user-listing.ts index 892cf2254fb662c114b460cc7416f41bda4fa1e5..945c9876341f1c15d06ce6e6062371f70a78f55d 100644 --- a/Build/Sources/TypeScript/beuser/Resources/Public/TypeScript/BackendUserListing.ts +++ b/Build/Sources/TypeScript/beuser/backend-user-listing.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import 'TYPO3/CMS/Backend/Input/Clearable'; +import '@typo3/backend/input/clearable'; /** - * Module: TYPO3/CMS/Beuser/BackendUserListing + * Module: @typo3/beuser/backend-user-listing * JavaScript for backend user listing - * @exports TYPO3/CMS/Beuser/BackendUserListing + * @exports @typo3/beuser/backend-user-listing */ class BackendUserListing { constructor() { diff --git a/Build/Sources/TypeScript/beuser/Resources/Public/TypeScript/Permissions.ts b/Build/Sources/TypeScript/beuser/permissions.ts similarity index 97% rename from Build/Sources/TypeScript/beuser/Resources/Public/TypeScript/Permissions.ts rename to Build/Sources/TypeScript/beuser/permissions.ts index eb19d02c5343e01e292ac296451f8cc94ff64729..6f66a41ed087112b95484a52f0aad3fd742f1651 100644 --- a/Build/Sources/TypeScript/beuser/Resources/Public/TypeScript/Permissions.ts +++ b/Build/Sources/TypeScript/beuser/permissions.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Tooltip from 'TYPO3/CMS/Backend/Tooltip'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import RegularEvent from '@typo3/core/event/regular-event'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Tooltip from '@typo3/backend/tooltip'; /** - * Module: TYPO3/CMS/Beuser/Permissions + * Module: @typo3/beuser/permissions * Javascript functions regarding the permissions module */ class Permissions { diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/AjaxRequest.ts b/Build/Sources/TypeScript/core/ajax/ajax-request.ts similarity index 98% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/AjaxRequest.ts rename to Build/Sources/TypeScript/core/ajax/ajax-request.ts index 705f24cd0c5b3d7ca462570036bdc2fba1286a2a..2dfa1d83cb3f71af14988b42dffe6875a7dca9d4 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/AjaxRequest.ts +++ b/Build/Sources/TypeScript/core/ajax/ajax-request.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from './AjaxResponse'; -import {GenericKeyValue, InputTransformer} from './InputTransformer'; +import {AjaxResponse} from './ajax-response'; +import {GenericKeyValue, InputTransformer} from './input-transformer'; /** * @example send data as `Content-Type: multipart/form-data` (default) diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/AjaxResponse.ts b/Build/Sources/TypeScript/core/ajax/ajax-response.ts similarity index 96% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/AjaxResponse.ts rename to Build/Sources/TypeScript/core/ajax/ajax-response.ts index 7b8b11aac082ab8b23cc756b59f4f858fa4384be..d7060390820b382d16b6b2655efb7e2c4c9dbd4e 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/AjaxResponse.ts +++ b/Build/Sources/TypeScript/core/ajax/ajax-response.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import SimpleResponseInterface from './SimpleResponseInterface'; +import SimpleResponseInterface from './simple-response-interface'; export class AjaxResponse { public readonly response: Response; diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/InputTransformer.ts b/Build/Sources/TypeScript/core/ajax/input-transformer.ts similarity index 100% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/InputTransformer.ts rename to Build/Sources/TypeScript/core/ajax/input-transformer.ts diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/SimpleResponseInterface.ts b/Build/Sources/TypeScript/core/ajax/simple-response-interface.ts similarity index 100% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Ajax/SimpleResponseInterface.ts rename to Build/Sources/TypeScript/core/ajax/simple-response-interface.ts diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Authentication/MfaProvider/Totp.ts b/Build/Sources/TypeScript/core/authentication/mfa-provider/totp.ts similarity index 97% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Authentication/MfaProvider/Totp.ts rename to Build/Sources/TypeScript/core/authentication/mfa-provider/totp.ts index f789938f4d1f5102fefdd6695238182ad1340881..3fc06e4c06de3d1eac1145d811475b69e7be49d5 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Authentication/MfaProvider/Totp.ts +++ b/Build/Sources/TypeScript/core/authentication/mfa-provider/totp.ts @@ -13,7 +13,7 @@ import {render, html, TemplateResult, LitElement} from 'lit'; import {customElement, property} from 'lit/decorators'; -import Modal from 'TYPO3/CMS/Backend/Modal'; +import Modal from '@typo3/backend/modal'; enum Selectors { modalBody = '.t3js-modal-body' diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/DocumentService.ts b/Build/Sources/TypeScript/core/document-service.ts similarity index 95% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/DocumentService.ts rename to Build/Sources/TypeScript/core/document-service.ts index a319ac4976c0b28bef0ab4c573bcab806019ece2..eee31c5eb992e0f5210d759d32be089f1932a526 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/DocumentService.ts +++ b/Build/Sources/TypeScript/core/document-service.ts @@ -12,8 +12,8 @@ */ /** - * Module: TYPO3/CMS/Core/DocumentService - * @exports TYPO3/CMS/Core/DocumentService + * Module: @typo3/core/document-service + * @exports @typo3/core/document-service */ class DocumentService { private readonly windowRef: Window; diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/DebounceEvent.ts b/Build/Sources/TypeScript/core/event/debounce-event.ts similarity index 94% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/DebounceEvent.ts rename to Build/Sources/TypeScript/core/event/debounce-event.ts index 701e26c77acbe9c2527b7c1f0976a3b8814fc10a..d682e3431bdbf46c7d23458a6f9368ae784333ef 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/DebounceEvent.ts +++ b/Build/Sources/TypeScript/core/event/debounce-event.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import {Listener} from './EventInterface'; -import RegularEvent from './RegularEvent'; +import {Listener} from './event-interface'; +import RegularEvent from './regular-event'; /** * Debounces an event listener that is executed after the event happened, either at the start or at the end. diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/EventInterface.ts b/Build/Sources/TypeScript/core/event/event-interface.ts similarity index 100% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/EventInterface.ts rename to Build/Sources/TypeScript/core/event/event-interface.ts diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/RegularEvent.ts b/Build/Sources/TypeScript/core/event/regular-event.ts similarity index 96% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/RegularEvent.ts rename to Build/Sources/TypeScript/core/event/regular-event.ts index d446ffecc4607c6eb62c9e7e9ca1feb6c3530432..02b96f2f22ef4b3376db8dd90b946a1ea404e8a4 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/RegularEvent.ts +++ b/Build/Sources/TypeScript/core/event/regular-event.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import {EventInterface, Listener} from './EventInterface'; +import {EventInterface, Listener} from './event-interface'; class RegularEvent implements EventInterface { protected eventName: string; diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/RequestAnimationFrameEvent.ts b/Build/Sources/TypeScript/core/event/request-animation-frame-event.ts similarity index 92% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/RequestAnimationFrameEvent.ts rename to Build/Sources/TypeScript/core/event/request-animation-frame-event.ts index 58bf0a919133c7d012faeb1b8c2ee5072907922c..14b61623ab2f229ebb684890d665da84ab1c0994 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/RequestAnimationFrameEvent.ts +++ b/Build/Sources/TypeScript/core/event/request-animation-frame-event.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import {Listener} from './EventInterface'; -import RegularEvent from './RegularEvent'; +import {Listener} from './event-interface'; +import RegularEvent from './regular-event'; /** * Creates a event aimed for high performance visual operations diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/ThrottleEvent.ts b/Build/Sources/TypeScript/core/event/throttle-event.ts similarity index 93% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/ThrottleEvent.ts rename to Build/Sources/TypeScript/core/event/throttle-event.ts index 928eb0898f24358768d015c0a8bd36bb75e444c7..3ebcc4a5b13be0fdd6755137a53ef0decb6121e1 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/Event/ThrottleEvent.ts +++ b/Build/Sources/TypeScript/core/event/throttle-event.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import {Listener} from './EventInterface'; -import RegularEvent from './RegularEvent'; +import {Listener} from './event-interface'; +import RegularEvent from './regular-event'; /** * Throttles the event listener to be called only after a defined time during the event's execution over time. diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/JavaScriptItemHandler.ts b/Build/Sources/TypeScript/core/java-script-item-handler.ts similarity index 90% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/JavaScriptItemHandler.ts rename to Build/Sources/TypeScript/core/java-script-item-handler.ts index dd543f9976c9f1ca436e185afdf3dc1da2afe3b4..060204750ae8fa8ac440006d162908e9726ef1fd 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/JavaScriptItemHandler.ts +++ b/Build/Sources/TypeScript/core/java-script-item-handler.ts @@ -13,7 +13,7 @@ /** * This handler is used as client-side counterpart of `\TYPO3\CMS\Core\Page\JavaScriptRenderer`. * - * @module TYPO3/CMS/Core/JavaScriptItemHandler + * @module @typo3/core/java-script-item-handler * @internal Use in TYPO3 core only, API can change at any time! */ if (document.currentScript) { @@ -24,7 +24,7 @@ if (document.currentScript) { const moduleImporter = (moduleName: string) => import(moduleName).catch(() => (window as any).importShim(moduleName)); - moduleImporter('TYPO3/CMS/Core/JavaScriptItemProcessor.js').then(({JavaScriptItemProcessor}) => { + moduleImporter('@typo3/core/java-script-item-processor.js').then(({JavaScriptItemProcessor}) => { const processor = new JavaScriptItemProcessor(); processor.processItems(items); }); diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/JavaScriptItemProcessor.ts b/Build/Sources/TypeScript/core/java-script-item-processor.ts similarity index 99% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/JavaScriptItemProcessor.ts rename to Build/Sources/TypeScript/core/java-script-item-processor.ts index 354731f5b649ca8f41b82a7a5ae48557651f323c..3a7f505073144b9ae925697cc30fe4f70647f91d 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/JavaScriptItemProcessor.ts +++ b/Build/Sources/TypeScript/core/java-script-item-processor.ts @@ -13,7 +13,7 @@ /** * This processor is used as client-side counterpart of `\TYPO3\CMS\Core\Page\JavaScriptItems * - * @module TYPO3/CMS/Core/JavaScriptItemProcessor + * @module @typo3/core/java-script-item-processor * @internal Use in TYPO3 core only, API can change at any time! */ diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/lit-helper.ts b/Build/Sources/TypeScript/core/lit-helper.ts similarity index 100% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/lit-helper.ts rename to Build/Sources/TypeScript/core/lit-helper.ts diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/RequireJSConfigHandler.ts b/Build/Sources/TypeScript/core/require-jsconfig-handler.ts similarity index 94% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/RequireJSConfigHandler.ts rename to Build/Sources/TypeScript/core/require-jsconfig-handler.ts index f6879781f38bc70de7d1eb7df4f1e1187e0ac8b9..84d0ca1e9056ff85dee3afd6ade733d7ee632558 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/RequireJSConfigHandler.ts +++ b/Build/Sources/TypeScript/core/require-jsconfig-handler.ts @@ -13,7 +13,7 @@ /** * This handler is used as client-side counterpart of `\TYPO3\CMS\Core\Page\PageRenderer`. * - * @module TYPO3/CMS/Core/RequireJSConfigHandler + * @module @typo3/core/require-jsconfig-handler * @internal Use in TYPO3 core only, API can change at any time! */ diff --git a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/SecurityUtility.ts b/Build/Sources/TypeScript/core/security-utility.ts similarity index 96% rename from Build/Sources/TypeScript/core/Resources/Public/TypeScript/SecurityUtility.ts rename to Build/Sources/TypeScript/core/security-utility.ts index e563b32bc3c59394d38e9c15752490db13a6e321..4a43e29705626cfb8bf5fd2ac013838b49af4de2 100644 --- a/Build/Sources/TypeScript/core/Resources/Public/TypeScript/SecurityUtility.ts +++ b/Build/Sources/TypeScript/core/security-utility.ts @@ -12,9 +12,9 @@ */ /** - * Module: TYPO3/CMS/Core/SecurityUtility + * Module: @typo3/core/security-utility * contains method to escape input to prevent XSS and other security related things - * @exports TYPO3/CMS/Core/SecurityUtility + * @exports @typo3/core/security-utility */ class SecurityUtility { private readonly documentRef: Document; diff --git a/Build/Sources/TypeScript/core/Tests/Ajax/AjaxRequestTest.ts b/Build/Sources/TypeScript/core/tests/ajax/ajax-request-test.ts similarity index 97% rename from Build/Sources/TypeScript/core/Tests/Ajax/AjaxRequestTest.ts rename to Build/Sources/TypeScript/core/tests/ajax/ajax-request-test.ts index de57a3c669d8fd7767b1b379452520c98d06ec42..228fe3f9ad1e1a18c6665bc469ec358bbe309223 100644 --- a/Build/Sources/TypeScript/core/Tests/Ajax/AjaxRequestTest.ts +++ b/Build/Sources/TypeScript/core/tests/ajax/ajax-request-test.ts @@ -11,10 +11,10 @@ * The TYPO3 project - inspiring people to share! */ -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; -describe('TYPO3/CMS/Core/Ajax/AjaxRequest', (): void => { +describe('@typo3/core/ajax/ajax-request', (): void => { let promiseHelper: any; beforeEach((): void => { diff --git a/Build/Sources/TypeScript/core/Tests/Ajax/InputTransformerTest.ts b/Build/Sources/TypeScript/core/tests/ajax/input-transformer-test.ts similarity index 93% rename from Build/Sources/TypeScript/core/Tests/Ajax/InputTransformerTest.ts rename to Build/Sources/TypeScript/core/tests/ajax/input-transformer-test.ts index 5906d92483d0976d260361a0b018f9f3d90b4b97..90f4cca37d85724384d03d4a5823d2c8d26cd866 100644 --- a/Build/Sources/TypeScript/core/Tests/Ajax/InputTransformerTest.ts +++ b/Build/Sources/TypeScript/core/tests/ajax/input-transformer-test.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import {GenericKeyValue, InputTransformer} from 'TYPO3/CMS/Core/Ajax/InputTransformer'; +import {GenericKeyValue, InputTransformer} from '@typo3/core/ajax/input-transformer'; -describe('TYPO3/CMS/Core/Ajax/InputTransformer', (): void => { +describe('@typo3/core/ajax/input-transformer', (): void => { it('converts object to FormData', (): void => { const input: GenericKeyValue = {foo: 'bar', bar: 'baz', nested: {works: 'yes'}}; const expected = new FormData(); diff --git a/Build/Sources/TypeScript/core/Tests/SecurityUtilityTest.ts b/Build/Sources/TypeScript/core/tests/security-utility-test.ts similarity index 92% rename from Build/Sources/TypeScript/core/Tests/SecurityUtilityTest.ts rename to Build/Sources/TypeScript/core/tests/security-utility-test.ts index 66f1df5e76b8537840126c3b5b6b4f0fbe9c8324..112f67ab29246159da9efd697aa914872773ce58 100644 --- a/Build/Sources/TypeScript/core/Tests/SecurityUtilityTest.ts +++ b/Build/Sources/TypeScript/core/tests/security-utility-test.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; +import SecurityUtility from '@typo3/core/security-utility'; -describe('TYPO3/CMS/Core/SecurityUtility', (): void => { +describe('@typo3/core/security-utility', (): void => { it('generates random hex value', (): void => { function* validLengthDataProvider(): any { yield 1; diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/ChartInitializer.ts b/Build/Sources/TypeScript/dashboard/chart-initializer.ts similarity index 90% rename from Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/ChartInitializer.ts rename to Build/Sources/TypeScript/dashboard/chart-initializer.ts index 7dae6eb23b3e64cc60e6d32ef9e42f99db5683f2..ceb3c7e00623550c6eac62a82f642b1bb1cd501c 100644 --- a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/ChartInitializer.ts +++ b/Build/Sources/TypeScript/dashboard/chart-initializer.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import Chart from 'TYPO3/CMS/Dashboard/Contrib/chartjs'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import Chart from '@typo3/dashboard/contrib/chartjs'; +import RegularEvent from '@typo3/core/event/regular-event'; class ChartInitializer { diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/DashboardDelete.ts b/Build/Sources/TypeScript/dashboard/dashboard-delete.ts similarity index 89% rename from Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/DashboardDelete.ts rename to Build/Sources/TypeScript/dashboard/dashboard-delete.ts index 1b7c78c090a6347a04889264a4b6e79db4812ef8..07c3731cb3dbfe6790e5e7f31e40aa9167a735ef 100644 --- a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/DashboardDelete.ts +++ b/Build/Sources/TypeScript/dashboard/dashboard-delete.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import Modal from '@typo3/backend/modal'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import RegularEvent from '@typo3/core/event/regular-event'; class DashboardDelete { diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/DashboardModal.ts b/Build/Sources/TypeScript/dashboard/dashboard-modal.ts similarity index 92% rename from Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/DashboardModal.ts rename to Build/Sources/TypeScript/dashboard/dashboard-modal.ts index 96a43f189e372356024527b770104b36fd7de690..854b4388747c89cb8e3ab56f94feb3ea086c4936 100644 --- a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/DashboardModal.ts +++ b/Build/Sources/TypeScript/dashboard/dashboard-modal.ts @@ -12,9 +12,9 @@ */ import $ from 'jquery'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import Modal from '@typo3/backend/modal'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import RegularEvent from '@typo3/core/event/regular-event'; class DashboardModal { diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/Grid.ts b/Build/Sources/TypeScript/dashboard/grid.ts similarity index 93% rename from Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/Grid.ts rename to Build/Sources/TypeScript/dashboard/grid.ts index c477a2d0b51f57acda9a27ba2b884e6324278aae..4710208c9a0fbe1cb99773b8bbaa7b5aa4c6dbaa 100644 --- a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/Grid.ts +++ b/Build/Sources/TypeScript/dashboard/grid.ts @@ -12,9 +12,9 @@ */ import Muuri from 'muuri'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import RegularEvent from '@typo3/core/event/regular-event'; class Grid { private readonly selector: string = '.dashboard-grid'; diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetContentCollector.ts b/Build/Sources/TypeScript/dashboard/widget-content-collector.ts similarity index 94% rename from Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetContentCollector.ts rename to Build/Sources/TypeScript/dashboard/widget-content-collector.ts index 8628bdba1a9a5dd97e11f2d290423b3e5160776d..b7be636d31456e430b7dce4c7e47760c60b25174 100644 --- a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetContentCollector.ts +++ b/Build/Sources/TypeScript/dashboard/widget-content-collector.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import RegularEvent from '@typo3/core/event/regular-event'; class WidgetContentCollector { diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetRefresh.ts b/Build/Sources/TypeScript/dashboard/widget-refresh.ts similarity index 100% rename from Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetRefresh.ts rename to Build/Sources/TypeScript/dashboard/widget-refresh.ts diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetRemover.ts b/Build/Sources/TypeScript/dashboard/widget-remover.ts similarity index 89% rename from Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetRemover.ts rename to Build/Sources/TypeScript/dashboard/widget-remover.ts index b1e1dcc2913f2f2b4d341a321a6e1f13d18997c7..e024fb69a48404c5f4723c585c1edae7c6eb1947 100644 --- a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetRemover.ts +++ b/Build/Sources/TypeScript/dashboard/widget-remover.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import Modal from '@typo3/backend/modal'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import RegularEvent from '@typo3/core/event/regular-event'; class WidgetRemover { diff --git a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetSelector.ts b/Build/Sources/TypeScript/dashboard/widget-selector.ts similarity index 90% rename from Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetSelector.ts rename to Build/Sources/TypeScript/dashboard/widget-selector.ts index 148421db941fb7ef2291676ea1845f0d7c57545a..be60a0fe0d8cb86f81a31e3174355c483ec8c505 100644 --- a/Build/Sources/TypeScript/dashboard/Resources/Public/TypeScript/WidgetSelector.ts +++ b/Build/Sources/TypeScript/dashboard/widget-selector.ts @@ -12,9 +12,9 @@ */ import $ from 'jquery'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import Modal from '@typo3/backend/modal'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import RegularEvent from '@typo3/core/event/regular-event'; class WidgetSelector { diff --git a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/DistributionImage.ts b/Build/Sources/TypeScript/extensionmanager/distribution-image.ts similarity index 98% rename from Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/DistributionImage.ts rename to Build/Sources/TypeScript/extensionmanager/distribution-image.ts index 604d5ae5d3ceef5dd039edbbe61f04494780afe5..f9e9ae993ba1d402f2fa2a863a454ad36e020e26 100644 --- a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/DistributionImage.ts +++ b/Build/Sources/TypeScript/extensionmanager/distribution-image.ts @@ -12,7 +12,7 @@ */ /** - * Module TYPO3/CMS/Extensionmanager/DistributionImage + * Module @typo3/extensionmanager/distribution-image * * @example * <typo3-extensionmanager-distribution-image image="some/image.jpg" fallback="/some/fallback/image.jpg"/> diff --git a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Main.ts b/Build/Sources/TypeScript/extensionmanager/main.ts similarity index 91% rename from Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Main.ts rename to Build/Sources/TypeScript/extensionmanager/main.ts index e1c391356cd96da87b0d26a49a597c87cd718629..30cf858c4ce45667bd46830692c831bd5b6bf8b7 100644 --- a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Main.ts +++ b/Build/Sources/TypeScript/extensionmanager/main.ts @@ -13,20 +13,20 @@ import $ from 'jquery'; import NProgress from 'nprogress'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Tooltip from 'TYPO3/CMS/Backend/Tooltip'; -import Severity from 'TYPO3/CMS/Backend/Severity'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; -import ExtensionManagerRepository from './Repository'; -import ExtensionManagerUpdate from './Update'; -import ExtensionManagerUploadForm from './UploadForm'; +import Modal from '@typo3/backend/modal'; +import Tooltip from '@typo3/backend/tooltip'; +import Severity from '@typo3/backend/severity'; +import SecurityUtility from '@typo3/core/security-utility'; +import ExtensionManagerRepository from './repository'; +import ExtensionManagerUpdate from './update'; +import ExtensionManagerUploadForm from './upload-form'; import Tablesort from 'tablesort'; import 'tablesort.dotsep'; -import 'TYPO3/CMS/Backend/Input/Clearable'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import DebounceEvent from 'TYPO3/CMS/Core/Event/DebounceEvent'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import '@typo3/backend/input/clearable'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import DebounceEvent from '@typo3/core/event/debounce-event'; +import RegularEvent from '@typo3/core/event/regular-event'; const securityUtility = new SecurityUtility(); @@ -36,7 +36,7 @@ enum ExtensionManagerIdentifier { } /** - * Module: TYPO3/CMS/Extensionmanager/Main + * Module: @typo3/extensionmanager/main * main logic holding everything together, consists of multiple parts * ExtensionManager => Various functions for displaying the extension list / sorting * Repository => Various AJAX functions for TER downloads diff --git a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Repository.ts b/Build/Sources/TypeScript/extensionmanager/repository.ts similarity index 93% rename from Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Repository.ts rename to Build/Sources/TypeScript/extensionmanager/repository.ts index cb7d0679538266b8846b2b584a9f2657337dc9ac..10c2319f8e6a4c10cf5b95987ecaad294b71e668 100644 --- a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Repository.ts +++ b/Build/Sources/TypeScript/extensionmanager/repository.ts @@ -13,14 +13,14 @@ import $ from 'jquery'; import NProgress from 'nprogress'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import Severity from 'TYPO3/CMS/Backend/Severity'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import Severity from '@typo3/backend/severity'; import Tablesort from 'tablesort'; -import 'TYPO3/CMS/Backend/Input/Clearable'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import '@typo3/backend/input/clearable'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import RegularEvent from '@typo3/core/event/regular-event'; class Repository { public downloadPath: string = ''; diff --git a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Update.ts b/Build/Sources/TypeScript/extensionmanager/update.ts similarity index 95% rename from Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Update.ts rename to Build/Sources/TypeScript/extensionmanager/update.ts index 651aeeb2ee0a8681eb0d662a84fbcfe387b94f22..45b5d168b92b357f390140083926de0f27c40b01 100644 --- a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/Update.ts +++ b/Build/Sources/TypeScript/extensionmanager/update.ts @@ -13,9 +13,9 @@ import $ from 'jquery'; import NProgress from 'nprogress'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; +import Notification from '@typo3/backend/notification'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; enum ExtensionManagerUpdateIdentifier { extensionTable = '#terTable', diff --git a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/UploadForm.ts b/Build/Sources/TypeScript/extensionmanager/upload-form.ts similarity index 91% rename from Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/UploadForm.ts rename to Build/Sources/TypeScript/extensionmanager/upload-form.ts index c1182d278a1b3e1e3b667ddf0a07d3d6a833c2aa..529b487c0e256c103c8d9541a7e89bc2c15d0621 100644 --- a/Build/Sources/TypeScript/extensionmanager/Resources/Public/TypeScript/UploadForm.ts +++ b/Build/Sources/TypeScript/extensionmanager/upload-form.ts @@ -12,8 +12,8 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; class UploadForm { public expandedUploadFormClass: string = 'transformed'; diff --git a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/ContextMenuActions.ts b/Build/Sources/TypeScript/filelist/context-menu-actions.ts similarity index 95% rename from Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/ContextMenuActions.ts rename to Build/Sources/TypeScript/filelist/context-menu-actions.ts index 4d412a79691708c24ed9239bf67a9ae880ab29b0..e3b157c12ac3a2768500f580c62b9b6305b62543 100644 --- a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/ContextMenuActions.ts +++ b/Build/Sources/TypeScript/filelist/context-menu-actions.ts @@ -11,19 +11,19 @@ * The TYPO3 project - inspiring people to share! */ -import {lll} from 'TYPO3/CMS/Core/lit-helper'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; +import {lll} from '@typo3/core/lit-helper'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; import $ from 'jquery'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Md5 from 'TYPO3/CMS/Backend/Hashing/Md5'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Notification from '@typo3/backend/notification'; +import Modal from '@typo3/backend/modal'; +import Md5 from '@typo3/backend/hashing/md5'; /** - * Module: TYPO3/CMS/Filelist/ContextMenuActions + * Module: @typo3/filelist/context-menu-actions * * JavaScript to handle filelist actions from context menu - * @exports TYPO3/CMS/Filelist/ContextMenuActions + * @exports @typo3/filelist/context-menu-actions */ class ContextMenuActions { public static getReturnUrl(): string { diff --git a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/CreateFolder.ts b/Build/Sources/TypeScript/filelist/create-folder.ts similarity index 89% rename from Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/CreateFolder.ts rename to Build/Sources/TypeScript/filelist/create-folder.ts index 4a1ca98593ed76c17a4206713bd15808f550c210..84db5bf46e28fc39cfb784997edf536560fc2d86 100644 --- a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/CreateFolder.ts +++ b/Build/Sources/TypeScript/filelist/create-folder.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import DocumentService from '@typo3/core/document-service'; +import Modal from '@typo3/backend/modal'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Filelist/CreateFolder - * @exports TYPO3/CMS/Filelist/CreateFolder + * Module: @typo3/filelist/create-folder + * @exports @typo3/filelist/create-folder */ class CreateFolder { private selfUrl: string; diff --git a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileDelete.ts b/Build/Sources/TypeScript/filelist/file-delete.ts similarity index 88% rename from Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileDelete.ts rename to Build/Sources/TypeScript/filelist/file-delete.ts index 9d8c91aa8aa238e2f7050e73391fd86fc9f7c5ed..e8753421bf8467e6156c5ae6fce5711dc4045042 100644 --- a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileDelete.ts +++ b/Build/Sources/TypeScript/filelist/file-delete.ts @@ -11,14 +11,14 @@ * The TYPO3 project - inspiring people to share! */ -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import Modal from 'TYPO3/CMS/Backend/Modal'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import RegularEvent from '@typo3/core/event/regular-event'; +import DocumentService from '@typo3/core/document-service'; +import Modal from '@typo3/backend/modal'; /** - * Module: TYPO3/CMS/Filelist/FileDelete - * @exports TYPO3/CMS/Filelist/FileDelete + * Module: @typo3/filelist/file-delete + * @exports @typo3/filelist/file-delete */ class FileDelete { constructor() { diff --git a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileList.ts b/Build/Sources/TypeScript/filelist/file-list.ts similarity index 92% rename from Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileList.ts rename to Build/Sources/TypeScript/filelist/file-list.ts index faee1b0e7f7166f06c210a0a9da082d23c758c6d..46fdc8ab4d7b58d209483a7f8e42d2c7dc321666 100644 --- a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileList.ts +++ b/Build/Sources/TypeScript/filelist/file-list.ts @@ -11,23 +11,23 @@ * The TYPO3 project - inspiring people to share! */ -import {lll} from 'TYPO3/CMS/Core/lit-helper'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import InfoWindow from 'TYPO3/CMS/Backend/InfoWindow'; -import {BroadcastMessage} from 'TYPO3/CMS/Backend/BroadcastMessage'; -import broadcastService from 'TYPO3/CMS/Backend/BroadcastService'; -import Tooltip from 'TYPO3/CMS/Backend/Tooltip'; +import {lll} from '@typo3/core/lit-helper'; +import DocumentService from '@typo3/core/document-service'; +import Notification from '@typo3/backend/notification'; +import InfoWindow from '@typo3/backend/info-window'; +import {BroadcastMessage} from '@typo3/backend/broadcast-message'; +import broadcastService from '@typo3/backend/broadcast-service'; +import Tooltip from '@typo3/backend/tooltip'; import NProgress from 'nprogress'; -import Icons from 'TYPO3/CMS/Backend/Icons'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import {ModuleStateStorage} from 'TYPO3/CMS/Backend/Storage/ModuleStateStorage'; -import {ActionConfiguration, ActionEventDetails} from 'TYPO3/CMS/Backend/MultiRecordSelectionAction'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import Severity from 'TYPO3/CMS/Backend/Severity'; +import Icons from '@typo3/backend/icons'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import RegularEvent from '@typo3/core/event/regular-event'; +import {ModuleStateStorage} from '@typo3/backend/storage/module-state-storage'; +import {ActionConfiguration, ActionEventDetails} from '@typo3/backend/multi-record-selection-action'; +import Modal from '@typo3/backend/modal'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import Severity from '@typo3/backend/severity'; type QueryParameters = {[key: string]: string}; @@ -55,8 +55,8 @@ enum Selectors { } /** - * Module: TYPO3/CMS/Filelist/Filelist - * @exports TYPO3/CMS/Filelist/Filelist + * Module: @typo3/filelist/filelist + * @exports @typo3/filelist/filelist */ class Filelist { public static submitClipboardFormWithCommand(cmd: string, target: HTMLButtonElement): void { diff --git a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileReplace.ts b/Build/Sources/TypeScript/filelist/file-replace.ts similarity index 91% rename from Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileReplace.ts rename to Build/Sources/TypeScript/filelist/file-replace.ts index 3e89867bd809355293e3e42c2e175d6659da7241..199679fe3391f76fe5596eb2e113ac6b8029c3dd 100644 --- a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/FileReplace.ts +++ b/Build/Sources/TypeScript/filelist/file-replace.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import RegularEvent from '@typo3/core/event/regular-event'; +import DocumentService from '@typo3/core/document-service'; class FileReplace { constructor() { diff --git a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/RenameFile.ts b/Build/Sources/TypeScript/filelist/rename-file.ts similarity index 89% rename from Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/RenameFile.ts rename to Build/Sources/TypeScript/filelist/rename-file.ts index e39aea3b80be4bfc66e14d6b9f31d642b1fab404..f5babdbdad6f43db867207f516362f571592657e 100644 --- a/Build/Sources/TypeScript/filelist/Resources/Public/TypeScript/RenameFile.ts +++ b/Build/Sources/TypeScript/filelist/rename-file.ts @@ -11,16 +11,16 @@ * The TYPO3 project - inspiring people to share! */ -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Modal from '@typo3/backend/modal'; +import DocumentService from '@typo3/core/document-service'; /** - * Module: TYPO3/CMS/Filelist/RenameFile + * Module: @typo3/filelist/rename-file * Modal to pick the required conflict strategy for colliding filenames - * @exports TYPO3/CMS/Filelist/RenameFile + * @exports @typo3/filelist/rename-file */ class RenameFile { diff --git a/Build/Sources/TypeScript/form/Resources/Public/TypeScript/Backend/Helper.ts b/Build/Sources/TypeScript/form/backend/helper.ts similarity index 93% rename from Build/Sources/TypeScript/form/Resources/Public/TypeScript/Backend/Helper.ts rename to Build/Sources/TypeScript/form/backend/helper.ts index 90d178c331fcbd2c7c43a0af481e43a964fd91b0..540d5b833f6023e134522651feb8ed546ad0cc7c 100644 --- a/Build/Sources/TypeScript/form/Resources/Public/TypeScript/Backend/Helper.ts +++ b/Build/Sources/TypeScript/form/backend/helper.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import {loadModule, JavaScriptItemPayload} from 'TYPO3/CMS/Core/JavaScriptItemProcessor'; +import {loadModule, JavaScriptItemPayload} from '@typo3/core/java-script-item-processor'; interface ModuleRequirements { app: JavaScriptItemPayload; @@ -36,7 +36,7 @@ interface ViewModelLike { } /** - * @exports TYPO3/CMS/Form/Backend/Helper + * @exports @typo3/form/backend/helper */ export class Helper { public static dispatchFormEditor(requirements: ModuleRequirements, options: any): void { diff --git a/Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ContextMenuActions.ts b/Build/Sources/TypeScript/impexp/context-menu-actions.ts similarity index 93% rename from Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ContextMenuActions.ts rename to Build/Sources/TypeScript/impexp/context-menu-actions.ts index 6fe3e5e12b20ec73f49837da08c21555aa49a890..2f89324cd76ab6e02b9a78accfe163047bde87c9 100644 --- a/Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ContextMenuActions.ts +++ b/Build/Sources/TypeScript/impexp/context-menu-actions.ts @@ -14,10 +14,10 @@ import $ from 'jquery'; /** - * Module: TYPO3/CMS/Impexp/ContextMenuActions + * Module: @typo3/impexp/context-menu-actions * * JavaScript to handle import/export actions from context menu - * @exports TYPO3/CMS/Impexp/ContextMenuActions + * @exports @typo3/impexp/context-menu-actions */ class ContextMenuActions { diff --git a/Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ImportExport.ts b/Build/Sources/TypeScript/impexp/import-export.ts similarity index 92% rename from Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ImportExport.ts rename to Build/Sources/TypeScript/impexp/import-export.ts index 679ca21c71c55173d5878292707eb68c82b8a702..7885064b26dba22c684e78b3d9068fc0f7f05a40 100644 --- a/Build/Sources/TypeScript/impexp/Resources/Public/TypeScript/ImportExport.ts +++ b/Build/Sources/TypeScript/impexp/import-export.ts @@ -12,12 +12,12 @@ */ import $ from 'jquery'; -import Modal from 'TYPO3/CMS/Backend/Modal'; +import Modal from '@typo3/backend/modal'; /** - * Module: TYPO3/CMS/Impexp/ImportExport + * Module: @typo3/impexp/import-export * JavaScript to handle confirm windows in the Import/Export module - * @exports TYPO3/CMS/Impexp/ImportExport + * @exports @typo3/impexp/import-export */ class ImportExport { constructor() { diff --git a/Build/Sources/TypeScript/info/Resources/Public/TypeScript/TranslationStatus.ts b/Build/Sources/TypeScript/info/translation-status.ts similarity index 97% rename from Build/Sources/TypeScript/info/Resources/Public/TypeScript/TranslationStatus.ts rename to Build/Sources/TypeScript/info/translation-status.ts index 0840b788ee7d64341e4e75d10208a8d2706ed184..b4adc414b404fc0ae955b028ed6e0551d56f367f 100644 --- a/Build/Sources/TypeScript/info/Resources/Public/TypeScript/TranslationStatus.ts +++ b/Build/Sources/TypeScript/info/translation-status.ts @@ -14,7 +14,7 @@ import $ from 'jquery'; /** - * Module: TYPO3/CMS/Info/TranslationStatus + * Module: @typo3/info/translation-status */ class TranslationStatus { constructor() { diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/InitInstall.ts b/Build/Sources/TypeScript/install/Resources/Public/TypeScript/InitInstall.ts deleted file mode 100644 index 408b776bcec1554ef796a046db00f0d840672ec1..0000000000000000000000000000000000000000 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/InitInstall.ts +++ /dev/null @@ -1,2 +0,0 @@ -self.TYPO3 = {}; -import('TYPO3/CMS/Install/Install'); diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/InitInstaller.ts b/Build/Sources/TypeScript/install/Resources/Public/TypeScript/InitInstaller.ts deleted file mode 100644 index 726e5fcb358e263f29bb9de335899be5e10fb0b0..0000000000000000000000000000000000000000 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/InitInstaller.ts +++ /dev/null @@ -1,2 +0,0 @@ -self.TYPO3 = {}; -import('TYPO3/CMS/Install/Installer'); diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Ajax/AjaxQueue.ts b/Build/Sources/TypeScript/install/ajax/ajax-queue.ts similarity index 95% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Ajax/AjaxQueue.ts rename to Build/Sources/TypeScript/install/ajax/ajax-queue.ts index 5a9386fe3f23a31eb0626abd22c4ef801ac80117..2f7de0c935e46fc8065e92889cf796e163c8c4d7 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Ajax/AjaxQueue.ts +++ b/Build/Sources/TypeScript/install/ajax/ajax-queue.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; interface Payload { url: string; @@ -23,7 +23,7 @@ interface Payload { } /** - * Module: TYPO3/CMS/Install/Module/AjaxQueue + * Module: @typo3/install/module/ajax-queue */ class AjaxQueue { private requests: Array<AjaxRequest> = []; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/BackendUserConfirmation.ts b/Build/Sources/TypeScript/install/backend-user-confirmation.ts similarity index 93% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/BackendUserConfirmation.ts rename to Build/Sources/TypeScript/install/backend-user-confirmation.ts index 135538dfcd284f80b5c7647132eb3a3f6df9f8a5..3afd058b82849d299addbbace457bd9e6f82b831 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/BackendUserConfirmation.ts +++ b/Build/Sources/TypeScript/install/backend-user-confirmation.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; +import DocumentService from '@typo3/core/document-service'; class BackendUserConfirmation { diff --git a/Build/Sources/TypeScript/install/init-install.ts b/Build/Sources/TypeScript/install/init-install.ts new file mode 100644 index 0000000000000000000000000000000000000000..90688793deedb56a57b3c6a82630f6f051a41f0a --- /dev/null +++ b/Build/Sources/TypeScript/install/init-install.ts @@ -0,0 +1,2 @@ +self.TYPO3 = {}; +import('@typo3/install/install'); diff --git a/Build/Sources/TypeScript/install/init-installer.ts b/Build/Sources/TypeScript/install/init-installer.ts new file mode 100644 index 0000000000000000000000000000000000000000..9123e6adc1bd1c1e1cf5be6f0a64713f8f7a5ff0 --- /dev/null +++ b/Build/Sources/TypeScript/install/init-installer.ts @@ -0,0 +1,2 @@ +self.TYPO3 = {}; +import('@typo3/install/installer'); diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Install.ts b/Build/Sources/TypeScript/install/install.ts similarity index 95% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Install.ts rename to Build/Sources/TypeScript/install/install.ts index bec151d478b7ba4bbd411acc2da30d47994ac8e5..c1fdb795ba770262095404b3e6f8be2388f5747a 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Install.ts +++ b/Build/Sources/TypeScript/install/install.ts @@ -12,7 +12,7 @@ */ import $ from 'jquery'; -import Router from './Router'; +import Router from './router'; /** * Walk through the installation process of TYPO3 diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Installer.ts b/Build/Sources/TypeScript/install/installer.ts similarity index 98% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Installer.ts rename to Build/Sources/TypeScript/install/installer.ts index f0d6ff81885b34a080ccf8da51a9836bcfda4ee6..a62d74a6ffa4f4ced984c81c6ec061a77abc92c1 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Installer.ts +++ b/Build/Sources/TypeScript/install/installer.ts @@ -12,12 +12,12 @@ */ import $ from 'jquery'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import PasswordStrength from './Module/PasswordStrength'; -import InfoBox from './Renderable/InfoBox'; -import ProgressBar from './Renderable/ProgressBar'; -import Severity from './Renderable/Severity'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import PasswordStrength from './module/password-strength'; +import InfoBox from './renderable/info-box'; +import ProgressBar from './renderable/progress-bar'; +import Severity from './renderable/severity'; /** * Walk through the installation process of TYPO3 diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/AbstractInlineModule.ts b/Build/Sources/TypeScript/install/module/abstract-inline-module.ts similarity index 100% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/AbstractInlineModule.ts rename to Build/Sources/TypeScript/install/module/abstract-inline-module.ts diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/AbstractInteractableModule.ts b/Build/Sources/TypeScript/install/module/abstract-interactable-module.ts similarity index 100% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/AbstractInteractableModule.ts rename to Build/Sources/TypeScript/install/module/abstract-interactable-module.ts diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/EnvironmentCheck.ts b/Build/Sources/TypeScript/install/module/environment/environment-check.ts similarity index 85% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/EnvironmentCheck.ts rename to Build/Sources/TypeScript/install/module/environment/environment-check.ts index 6ebf561b3662666537cd7dab63e9aa39ef891935..80f0949ebc301a4882fa20911a220e2e9f5acb6b 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/EnvironmentCheck.ts +++ b/Build/Sources/TypeScript/install/module/environment/environment-check.ts @@ -13,18 +13,18 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import InfoBox from '../../Renderable/InfoBox'; -import ProgressBar from '../../Renderable/ProgressBar'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import InfoBox from '../../renderable/info-box'; +import ProgressBar from '../../renderable/progress-bar'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/EnvironmentCheck + * Module: @typo3/install/environment-check */ class EnvironmentCheck extends AbstractInteractableModule { private selectorGridderBadge: string = '.t3js-environmentCheck-badge'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/FolderStructure.ts b/Build/Sources/TypeScript/install/module/environment/folder-structure.ts similarity index 91% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/FolderStructure.ts rename to Build/Sources/TypeScript/install/module/environment/folder-structure.ts index 703caa01a505f7bc6b0ee9e081999dc84d4ed787..2948a56acb51761673562553226d50a171536673 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/FolderStructure.ts +++ b/Build/Sources/TypeScript/install/module/environment/folder-structure.ts @@ -13,18 +13,18 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import InfoBox from '../../Renderable/InfoBox'; -import ProgressBar from '../../Renderable/ProgressBar'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import InfoBox from '../../renderable/info-box'; +import ProgressBar from '../../renderable/progress-bar'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/FolderStructure + * Module: @typo3/install/module/folder-structure */ class FolderStructure extends AbstractInteractableModule { private selectorGridderBadge: string = '.t3js-folderStructure-badge'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/ImageProcessing.ts b/Build/Sources/TypeScript/install/module/environment/image-processing.ts similarity index 90% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/ImageProcessing.ts rename to Build/Sources/TypeScript/install/module/environment/image-processing.ts index a40960303ada6893800c0c6d029c090a5a574910..e5bc62ad5515f5efb0bb2f33dbd59ba482cbf9fc 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/ImageProcessing.ts +++ b/Build/Sources/TypeScript/install/module/environment/image-processing.ts @@ -13,17 +13,17 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import InfoBox from '../../Renderable/InfoBox'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import InfoBox from '../../renderable/info-box'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/ImageProcessing + * Module: @typo3/install/module/image-processing */ class ImageProcessing extends AbstractInteractableModule { private selectorExecuteTrigger: string = '.t3js-imageProcessing-execute'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/MailTest.ts b/Build/Sources/TypeScript/install/module/environment/mail-test.ts similarity index 85% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/MailTest.ts rename to Build/Sources/TypeScript/install/module/environment/mail-test.ts index 3452289db6296fbd87b65f45f2a6301f23930c51..9189f8067711d370f67419f1ce5fc9abce624567 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/MailTest.ts +++ b/Build/Sources/TypeScript/install/module/environment/mail-test.ts @@ -12,18 +12,18 @@ */ import 'bootstrap'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import InfoBox from '../../Renderable/InfoBox'; -import ProgressBar from '../../Renderable/ProgressBar'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import InfoBox from '../../renderable/info-box'; +import ProgressBar from '../../renderable/progress-bar'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/CreateAdmin + * Module: @typo3/install/module/create-admin */ class MailTest extends AbstractInteractableModule { private selectorOutputContainer: string = '.t3js-mailTest-output'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/PhpInfo.ts b/Build/Sources/TypeScript/install/module/environment/php-info.ts similarity index 79% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/PhpInfo.ts rename to Build/Sources/TypeScript/install/module/environment/php-info.ts index 9ae118cc0dbfd795bca09c9e20c346c79307fc50..44d4496824a5a94d5596295d1e0fd548385058f9 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/PhpInfo.ts +++ b/Build/Sources/TypeScript/install/module/environment/php-info.ts @@ -11,14 +11,14 @@ * The TYPO3 project - inspiring people to share! */ -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; /** - * Module: TYPO3/CMS/Install/Module/PhpInfo + * Module: @typo3/install/module/php-info */ class PhpInfo extends AbstractInteractableModule { public initialize(currentModal: any): void { diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/SystemInformation.ts b/Build/Sources/TypeScript/install/module/environment/system-information.ts similarity index 79% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/SystemInformation.ts rename to Build/Sources/TypeScript/install/module/environment/system-information.ts index 395dadbc583bd57355c0f4fe08c3b35a583bbd81..2801fdb1b756999663c05f611b6fb53d5d8cb1e6 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Environment/SystemInformation.ts +++ b/Build/Sources/TypeScript/install/module/environment/system-information.ts @@ -11,14 +11,14 @@ * The TYPO3 project - inspiring people to share! */ -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; /** - * Module: TYPO3/CMS/Install/Module/SystemInformation + * Module: @typo3/install/module/system-information */ class SystemInformation extends AbstractInteractableModule { public initialize(currentModal: any): void { diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/Cache.ts b/Build/Sources/TypeScript/install/module/maintenance/cache.ts similarity index 84% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/Cache.ts rename to Build/Sources/TypeScript/install/module/maintenance/cache.ts index 9f96b97127cc5b19b0da353dae9f23afd57960d6..056c8dff3b2efab7aaf177c8c783d770e29db343 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/Cache.ts +++ b/Build/Sources/TypeScript/install/module/maintenance/cache.ts @@ -11,14 +11,14 @@ * The TYPO3 project - inspiring people to share! */ -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInlineModule} from '../AbstractInlineModule'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInlineModule} from '../abstract-inline-module'; /** - * Module: TYPO3/CMS/Install/Module/Cache + * Module: @typo3/install/module/cache */ class Cache extends AbstractInlineModule { public initialize($trigger: JQuery): void { diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/ClearTables.ts b/Build/Sources/TypeScript/install/module/maintenance/clear-tables.ts similarity index 91% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/ClearTables.ts rename to Build/Sources/TypeScript/install/module/maintenance/clear-tables.ts index 0b1613fcf24649783b2967de8f8e65a7527a41ca..72a9fd2c196fa5959bfaa9ac7488fa8c7f776827 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/ClearTables.ts +++ b/Build/Sources/TypeScript/install/module/maintenance/clear-tables.ts @@ -12,15 +12,15 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/ClearTables + * Module: @typo3/install/module/clear-tables */ class ClearTables extends AbstractInteractableModule { private selectorClearTrigger: string = '.t3js-clearTables-clear'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/ClearTypo3tempFiles.ts b/Build/Sources/TypeScript/install/module/maintenance/clear-typo3temp-files.ts similarity index 91% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/ClearTypo3tempFiles.ts rename to Build/Sources/TypeScript/install/module/maintenance/clear-typo3temp-files.ts index 8e45a80ef3ba219cee3980c965bb20d1d8e19606..718a2b03d410f5636d82a904ea30472c7fffa820 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/ClearTypo3tempFiles.ts +++ b/Build/Sources/TypeScript/install/module/maintenance/clear-typo3temp-files.ts @@ -12,15 +12,15 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/ClearTypo3tempFiles + * Module: @typo3/install/module/clear-typo3temp-files */ class ClearTypo3tempFiles extends AbstractInteractableModule { private selectorDeleteTrigger: string = '.t3js-clearTypo3temp-delete'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/CreateAdmin.ts b/Build/Sources/TypeScript/install/module/maintenance/create-admin.ts similarity index 89% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/CreateAdmin.ts rename to Build/Sources/TypeScript/install/module/maintenance/create-admin.ts index c1d72397c665927330cc94e3ade263d620a89d88..8dcab5a720da8db7e572f765cd195afd3eccde1e 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/CreateAdmin.ts +++ b/Build/Sources/TypeScript/install/module/maintenance/create-admin.ts @@ -11,16 +11,16 @@ * The TYPO3 project - inspiring people to share! */ -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; -import PasswordStrength from '../PasswordStrength'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; +import PasswordStrength from '../password-strength'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; /** - * Module: TYPO3/CMS/Install/Module/CreateAdmin + * Module: @typo3/install/module/create-admin */ class CreateAdmin extends AbstractInteractableModule { private selectorAdminCreateButton: string = '.t3js-createAdmin-create'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/DatabaseAnalyzer.ts b/Build/Sources/TypeScript/install/module/maintenance/database-analyzer.ts similarity index 93% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/DatabaseAnalyzer.ts rename to Build/Sources/TypeScript/install/module/maintenance/database-analyzer.ts index c1c2714f8072e9d15259a214c82a8c8dd371550d..81736f315ed4bd7f156c503dcc359ff08531b1d6 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/DatabaseAnalyzer.ts +++ b/Build/Sources/TypeScript/install/module/maintenance/database-analyzer.ts @@ -12,18 +12,18 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import InfoBox from '../../Renderable/InfoBox'; -import ProgressBar from '../../Renderable/ProgressBar'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import InfoBox from '../../renderable/info-box'; +import ProgressBar from '../../renderable/progress-bar'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/DatabaseAnalyzer + * Module: @typo3/install/module/database-analyzer */ class DatabaseAnalyzer extends AbstractInteractableModule { private selectorAnalyzeTrigger: string = '.t3js-databaseAnalyzer-analyze'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/DumpAutoload.ts b/Build/Sources/TypeScript/install/module/maintenance/dump-autoload.ts similarity index 84% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/DumpAutoload.ts rename to Build/Sources/TypeScript/install/module/maintenance/dump-autoload.ts index 217c285758ca1c9291efa86d844f4195688e4ec4..9aa18fcf7e4c1809bbfcac413d17a71e119acc26 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/DumpAutoload.ts +++ b/Build/Sources/TypeScript/install/module/maintenance/dump-autoload.ts @@ -11,14 +11,14 @@ * The TYPO3 project - inspiring people to share! */ -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInlineModule} from '../AbstractInlineModule'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInlineModule} from '../abstract-inline-module'; /** - * Module: TYPO3/CMS/Install/Module/DumpAutoload + * Module: @typo3/install/module/dump-autoload */ class DumpAutoload extends AbstractInlineModule { public initialize($trigger: JQuery): void { diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/LanguagePacks.ts b/Build/Sources/TypeScript/install/module/maintenance/language-packs.ts similarity index 97% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/LanguagePacks.ts rename to Build/Sources/TypeScript/install/module/maintenance/language-packs.ts index df9b1856861f89c9a9bdd9d8ee28a53db348383a..72bef9dc900c17f7bf57df702b8ef67c6d2a3bce 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/LanguagePacks.ts +++ b/Build/Sources/TypeScript/install/module/maintenance/language-packs.ts @@ -13,18 +13,18 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; -import FlashMessage from '../../Renderable/FlashMessage'; -import InfoBox from '../../Renderable/InfoBox'; -import ProgressBar from '../../Renderable/ProgressBar'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import SecurityUtility from '@typo3/core/security-utility'; +import FlashMessage from '../../renderable/flash-message'; +import InfoBox from '../../renderable/info-box'; +import ProgressBar from '../../renderable/progress-bar'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/LanguagePacks + * Module: @typo3/install/module/language-packs */ class LanguagePacks extends AbstractInteractableModule { private selectorOutputContainer: string = '.t3js-languagePacks-output'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/ResetBackendUserUc.ts b/Build/Sources/TypeScript/install/module/maintenance/reset-backend-user-uc.ts similarity index 84% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/ResetBackendUserUc.ts rename to Build/Sources/TypeScript/install/module/maintenance/reset-backend-user-uc.ts index 2eeda525ad457ad01eb87802797f3af3b5d0ece4..43a72a405780e85b37fb343134925bd5be3f6ef5 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Maintenance/ResetBackendUserUc.ts +++ b/Build/Sources/TypeScript/install/module/maintenance/reset-backend-user-uc.ts @@ -11,14 +11,14 @@ * The TYPO3 project - inspiring people to share! */ -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInlineModule} from '../AbstractInlineModule'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import Router from '../../Router'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInlineModule} from '../abstract-inline-module'; +import Notification from '@typo3/backend/notification'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/ResetBackendUserUc + * Module: @typo3/install/module/reset-backend-user-uc */ class ResetBackendUserUc extends AbstractInlineModule { public initialize($trigger: JQuery): void { diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/PasswordStrength.ts b/Build/Sources/TypeScript/install/module/password-strength.ts similarity index 100% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/PasswordStrength.ts rename to Build/Sources/TypeScript/install/module/password-strength.ts diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/ChangeInstallToolPassword.ts b/Build/Sources/TypeScript/install/module/settings/change-install-tool-password.ts similarity index 87% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/ChangeInstallToolPassword.ts rename to Build/Sources/TypeScript/install/module/settings/change-install-tool-password.ts index c007cdbbac75f19c13b020c7807465e543ba31da..801ce9ad5d7e647b958fc5a5798f6923fe0d80cb 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/ChangeInstallToolPassword.ts +++ b/Build/Sources/TypeScript/install/module/settings/change-install-tool-password.ts @@ -11,16 +11,16 @@ * The TYPO3 project - inspiring people to share! */ -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; -import PasswordStrength from '../PasswordStrength'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; +import PasswordStrength from '../password-strength'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; /** - * Module: TYPO3/CMS/Install/Module/ChangeInstallToolPassword + * Module: @typo3/install/module/change-install-tool-password */ class ChangeInstallToolPassword extends AbstractInteractableModule { private selectorChangeButton: string = '.t3js-changeInstallToolPassword-change'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/ExtensionConfiguration.ts b/Build/Sources/TypeScript/install/module/settings/extension-configuration.ts similarity index 91% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/ExtensionConfiguration.ts rename to Build/Sources/TypeScript/install/module/settings/extension-configuration.ts index 9ad787afecf1020b429066c323d3d170dac0b274..d29158704060054a3f14ebae143ef668dcf2cb0a 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/ExtensionConfiguration.ts +++ b/Build/Sources/TypeScript/install/module/settings/extension-configuration.ts @@ -13,17 +13,17 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import '../../Renderable/Clearable'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import ModuleMenu from 'TYPO3/CMS/Backend/ModuleMenu'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; -import {topLevelModuleImport} from 'TYPO3/CMS/Backend/Utility/TopLevelModuleImport'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import '../../renderable/clearable'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import ModuleMenu from '@typo3/backend/module-menu'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; +import {topLevelModuleImport} from '@typo3/backend/utility/top-level-module-import'; /** - * Module: TYPO3/CMS/Install/Module/ExtensionConfiguration + * Module: @typo3/install/module/extension-configuration */ class ExtensionConfiguration extends AbstractInteractableModule { private selectorFormListener: string = '.t3js-extensionConfiguration-form'; @@ -96,11 +96,11 @@ class ExtensionConfiguration extends AbstractInteractableModule { private initializeColorPicker(): void { const isInIframe = window.location !== window.parent.location; if (isInIframe) { - topLevelModuleImport('TYPO3/CMS/Backend/ColorPicker.js').then(({default: ColorPicker}: typeof import('TYPO3/CMS/Backend/ColorPicker')): void => { + topLevelModuleImport('@typo3/backend/color-picker.js').then(({default: ColorPicker}: typeof import('@typo3/backend/color-picker')): void => { ColorPicker.initialize(); }); } else { - import('TYPO3/CMS/Backend/ColorPicker').then(({default: ColorPicker}): void => { + import('@typo3/backend/color-picker').then(({default: ColorPicker}): void => { ColorPicker.initialize(); }); } diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/Features.ts b/Build/Sources/TypeScript/install/module/settings/features.ts similarity index 88% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/Features.ts rename to Build/Sources/TypeScript/install/module/settings/features.ts index 7c1145b28f7dfaf572f05b8d3da798a52047a767..87f826b9ad8ff9f1145cd6793420cc1dc965b881 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/Features.ts +++ b/Build/Sources/TypeScript/install/module/settings/features.ts @@ -12,15 +12,15 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/Features + * Module: @typo3/install/module/features */ class Features extends AbstractInteractableModule { private selectorSaveTrigger: string = '.t3js-features-save'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/LocalConfiguration.ts b/Build/Sources/TypeScript/install/module/settings/local-configuration.ts similarity index 92% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/LocalConfiguration.ts rename to Build/Sources/TypeScript/install/module/settings/local-configuration.ts index 60e5fbc9a185066b0a6c06def77dd528c839b324..1d99ef5d49836e74e31e9cdb53557b886fc866b9 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/LocalConfiguration.ts +++ b/Build/Sources/TypeScript/install/module/settings/local-configuration.ts @@ -13,16 +13,16 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import '../../Renderable/Clearable'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import '../../renderable/clearable'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/LocalConfiguration + * Module: @typo3/install/module/local-configuration */ class LocalConfiguration extends AbstractInteractableModule { private selectorToggleAllTrigger: string = '.t3js-localConfiguration-toggleAll'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/Presets.ts b/Build/Sources/TypeScript/install/module/settings/presets.ts similarity index 92% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/Presets.ts rename to Build/Sources/TypeScript/install/module/settings/presets.ts index 8172cb1a86c844da97332f4cfa09eb92ab628574..e7723dac44960f1fa775ef52f7642c61d0e7ff01 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/Presets.ts +++ b/Build/Sources/TypeScript/install/module/settings/presets.ts @@ -13,15 +13,15 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/Presets + * Module: @typo3/install/module/presets */ class Presets extends AbstractInteractableModule { private selectorActivateTrigger: string = '.t3js-presets-activate'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/SystemMaintainer.ts b/Build/Sources/TypeScript/install/module/settings/system-maintainer.ts similarity index 86% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/SystemMaintainer.ts rename to Build/Sources/TypeScript/install/module/settings/system-maintainer.ts index 3d4b864b96f7a8fadd1dd80d3f732258cd0e1758..9c4d4c052a39be076359ba4338b83b047616d7cb 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Settings/SystemMaintainer.ts +++ b/Build/Sources/TypeScript/install/module/settings/system-maintainer.ts @@ -13,16 +13,16 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import {topLevelModuleImport} from 'TYPO3/CMS/Backend/Utility/TopLevelModuleImport'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import {topLevelModuleImport} from '@typo3/backend/utility/top-level-module-import'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/SystemMaintainer + * Module: @typo3/install/module/system-maintainer */ class SystemMaintainer extends AbstractInteractableModule { private selectorWriteTrigger: string = '.t3js-systemMaintainer-write'; @@ -33,11 +33,11 @@ class SystemMaintainer extends AbstractInteractableModule { this.currentModal = currentModal; const isInIframe = window.location !== window.parent.location; if (isInIframe) { - topLevelModuleImport('TYPO3/CMS/Install/chosen.jquery.min.js').then((): void => { + topLevelModuleImport('@typo3/install/chosen.jquery.min.js').then((): void => { this.getList(); }); } else { - import('TYPO3/CMS/Install/chosen.jquery.min').then((): void => { + import('@typo3/install/chosen.jquery.min').then((): void => { this.getList(); }); } diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/CoreUpdate.ts b/Build/Sources/TypeScript/install/module/upgrade/core-update.ts similarity index 94% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/CoreUpdate.ts rename to Build/Sources/TypeScript/install/module/upgrade/core-update.ts index 4278107d45bec0fc510a641a6d3dd16c27b870e8..f88e66526efa146bad6020ca8e449f84619b856a 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/CoreUpdate.ts +++ b/Build/Sources/TypeScript/install/module/upgrade/core-update.ts @@ -12,14 +12,14 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import FlashMessage from '../../Renderable/FlashMessage'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import FlashMessage from '../../renderable/flash-message'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; interface ActionItem { loadingMessage: string; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/ExtensionCompatTester.ts b/Build/Sources/TypeScript/install/module/upgrade/extension-compat-tester.ts similarity index 93% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/ExtensionCompatTester.ts rename to Build/Sources/TypeScript/install/module/upgrade/extension-compat-tester.ts index 6c7e58cc9a83f05853f68d266f9956e904172686..3f34f3960f6f1e57f13b18d6250b8659f17ef390 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/ExtensionCompatTester.ts +++ b/Build/Sources/TypeScript/install/module/upgrade/extension-compat-tester.ts @@ -13,15 +13,15 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import InfoBox from '../../Renderable/InfoBox'; -import ProgressBar from '../../Renderable/ProgressBar'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import InfoBox from '../../renderable/info-box'; +import ProgressBar from '../../renderable/progress-bar'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; interface BrokenExtension { name: string; @@ -29,7 +29,7 @@ interface BrokenExtension { } /** - * Module: TYPO3/CMS/Install/Module/ExtensionCompatTester + * Module: @typo3/install/module/extension-compat-tester */ class ExtensionCompatTester extends AbstractInteractableModule { private selectorCheckTrigger: string = '.t3js-extensionCompatTester-check'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/ExtensionScanner.ts b/Build/Sources/TypeScript/install/module/upgrade/extension-scanner.ts similarity index 97% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/ExtensionScanner.ts rename to Build/Sources/TypeScript/install/module/upgrade/extension-scanner.ts index 9abb734a24d842c1cc8ba1abb90bed024037808f..5eb5f9966f7f85cce4b486ff1b89570e8f0a0013 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/ExtensionScanner.ts +++ b/Build/Sources/TypeScript/install/module/upgrade/extension-scanner.ts @@ -13,13 +13,13 @@ import 'bootstrap'; import $ from 'jquery'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxQueue from '../../Ajax/AjaxQueue'; -import Router from '../../Router'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxQueue from '../../ajax/ajax-queue'; +import Router from '../../router'; interface FileData { success: boolean; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/TcaExtTablesCheck.ts b/Build/Sources/TypeScript/install/module/upgrade/tca-ext-tables-check.ts similarity index 84% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/TcaExtTablesCheck.ts rename to Build/Sources/TypeScript/install/module/upgrade/tca-ext-tables-check.ts index 683be7ec12e891a851cbe4b9d025d4763a6dd764..90cbdc4e7a90a6250c6699023c79d600920b18f0 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/TcaExtTablesCheck.ts +++ b/Build/Sources/TypeScript/install/module/upgrade/tca-ext-tables-check.ts @@ -12,18 +12,18 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import InfoBox from '../../Renderable/InfoBox'; -import ProgressBar from '../../Renderable/ProgressBar'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import InfoBox from '../../renderable/info-box'; +import ProgressBar from '../../renderable/progress-bar'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/TcaExtTablesCheck + * Module: @typo3/install/module/tca-ext-tables-check */ class TcaExtTablesCheck extends AbstractInteractableModule { private selectorCheckTrigger: string = '.t3js-tcaExtTablesCheck-check'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/TcaMigrationsCheck.ts b/Build/Sources/TypeScript/install/module/upgrade/tca-migrations-check.ts similarity index 84% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/TcaMigrationsCheck.ts rename to Build/Sources/TypeScript/install/module/upgrade/tca-migrations-check.ts index 9dcadb757fec9795d63457a236dd114ed18a47a4..dfcfe00c7cecdd1f0ba656a62eefec3c27534914 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/TcaMigrationsCheck.ts +++ b/Build/Sources/TypeScript/install/module/upgrade/tca-migrations-check.ts @@ -12,18 +12,18 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import FlashMessage from '../../Renderable/FlashMessage'; -import InfoBox from '../../Renderable/InfoBox'; -import ProgressBar from '../../Renderable/ProgressBar'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Modal from '@typo3/backend/modal'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import FlashMessage from '../../renderable/flash-message'; +import InfoBox from '../../renderable/info-box'; +import ProgressBar from '../../renderable/progress-bar'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/TcaMigrationsCheck + * Module: @typo3/install/module/tca-migrations-check */ class TcaMigrationsCheck extends AbstractInteractableModule { private selectorCheckTrigger: string = '.t3js-tcaMigrationsCheck-check'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/UpgradeDocs.ts b/Build/Sources/TypeScript/install/module/upgrade/upgrade-docs.ts similarity index 94% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/UpgradeDocs.ts rename to Build/Sources/TypeScript/install/module/upgrade/upgrade-docs.ts index 402253da58f04aea10a03591f35dc1f339ae9b19..846f2713e1d0aac8e569e2a1b81f723ab5e21de0 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/UpgradeDocs.ts +++ b/Build/Sources/TypeScript/install/module/upgrade/upgrade-docs.ts @@ -13,17 +13,17 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import '../../Renderable/Clearable'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {topLevelModuleImport} from 'TYPO3/CMS/Backend/Utility/TopLevelModuleImport'; -import Router from '../../Router'; -import DebounceEvent from 'TYPO3/CMS/Core/Event/DebounceEvent'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import '../../renderable/clearable'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {topLevelModuleImport} from '@typo3/backend/utility/top-level-module-import'; +import Router from '../../router'; +import DebounceEvent from '@typo3/core/event/debounce-event'; /** - * Module: TYPO3/CMS/Install/Module/UpgradeDocs + * Module: @typo3/install/module/upgrade-docs */ class UpgradeDocs extends AbstractInteractableModule { private selectorFulltextSearch: string = '.t3js-upgradeDocs-fulltext-search'; @@ -53,11 +53,11 @@ class UpgradeDocs extends AbstractInteractableModule { this.currentModal = currentModal; const isInIframe = (window.location !== window.parent.location); if (isInIframe) { - topLevelModuleImport('TYPO3/CMS/Install/chosen.jquery.min.js').then((): void => { + topLevelModuleImport('@typo3/install/chosen.jquery.min.js').then((): void => { this.getContent(); }); } else { - import('TYPO3/CMS/Install/chosen.jquery.min').then((): void => { + import('@typo3/install/chosen.jquery.min').then((): void => { this.getContent(); }); } diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/UpgradeWizards.ts b/Build/Sources/TypeScript/install/module/upgrade/upgrade-wizards.ts similarity index 97% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/UpgradeWizards.ts rename to Build/Sources/TypeScript/install/module/upgrade/upgrade-wizards.ts index 26d8afaec2bd810192ab5f620131b87fa7741829..bfa3c17f8999cd887e7f3044b072cc35e301da75 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Module/Upgrade/UpgradeWizards.ts +++ b/Build/Sources/TypeScript/install/module/upgrade/upgrade-wizards.ts @@ -13,19 +13,19 @@ import 'bootstrap'; import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from '../AbstractInteractableModule'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; -import FlashMessage from '../../Renderable/FlashMessage'; -import InfoBox from '../../Renderable/InfoBox'; -import ProgressBar from '../../Renderable/ProgressBar'; -import Severity from '../../Renderable/Severity'; -import Router from '../../Router'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from '../abstract-interactable-module'; +import Notification from '@typo3/backend/notification'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import SecurityUtility from '@typo3/core/security-utility'; +import FlashMessage from '../../renderable/flash-message'; +import InfoBox from '../../renderable/info-box'; +import ProgressBar from '../../renderable/progress-bar'; +import Severity from '../../renderable/severity'; +import Router from '../../router'; /** - * Module: TYPO3/CMS/Install/Module/UpgradeWizards + * Module: @typo3/install/module/upgrade-wizards */ class UpgradeWizards extends AbstractInteractableModule { private selectorOutputWizardsContainer: string = '.t3js-upgradeWizards-wizards-output'; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/Clearable.ts b/Build/Sources/TypeScript/install/renderable/clearable.ts similarity index 100% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/Clearable.ts rename to Build/Sources/TypeScript/install/renderable/clearable.ts diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/FlashMessage.ts b/Build/Sources/TypeScript/install/renderable/flash-message.ts similarity index 92% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/FlashMessage.ts rename to Build/Sources/TypeScript/install/renderable/flash-message.ts index 0b79eddf70c937969f44f973b00c6a507acd5bb8..a2e56e2124de8aa044099a5a82c09422950577bb 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/FlashMessage.ts +++ b/Build/Sources/TypeScript/install/renderable/flash-message.ts @@ -12,10 +12,10 @@ */ import $ from 'jquery'; -import Severity from './Severity'; +import Severity from './severity'; /** - * Module: TYPO3/CMS/Install/Module/FlashMessage + * Module: @typo3/install/module/flash-message */ class FlashMessage { private template: JQuery = $('<div class="t3js-message typo3-message alert"><h4></h4><p class="messageText"></p></div>'); diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/InfoBox.ts b/Build/Sources/TypeScript/install/renderable/info-box.ts similarity index 93% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/InfoBox.ts rename to Build/Sources/TypeScript/install/renderable/info-box.ts index 3c30097dbc19953df7693286f5a6fcf5b866d6cc..0fedfefaee0f5cf841946d712940268b9a733181 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/InfoBox.ts +++ b/Build/Sources/TypeScript/install/renderable/info-box.ts @@ -12,10 +12,10 @@ */ import $ from 'jquery'; -import Severity from './Severity'; +import Severity from './severity'; /** - * Module: TYPO3/CMS/Install/Module/InfoBox + * Module: @typo3/install/module/info-box */ class InfoBox { private template: JQuery = $( diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/ProgressBar.ts b/Build/Sources/TypeScript/install/renderable/progress-bar.ts similarity index 93% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/ProgressBar.ts rename to Build/Sources/TypeScript/install/renderable/progress-bar.ts index ba9954737e9de71f4e82d57ed7e62fced0c9e864..e9fc843de46fe3b2b52fd071a46fd1b966d4af90 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/ProgressBar.ts +++ b/Build/Sources/TypeScript/install/renderable/progress-bar.ts @@ -12,10 +12,10 @@ */ import $ from 'jquery'; -import Severity from './Severity'; +import Severity from './severity'; /** - * Module: TYPO3/CMS/Install/Module/ProgressBar + * Module: @typo3/install/module/progress-bar */ class ProgressBar { private template: JQuery = $( diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/Severity.ts b/Build/Sources/TypeScript/install/renderable/severity.ts similarity index 96% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/Severity.ts rename to Build/Sources/TypeScript/install/renderable/severity.ts index ec2917f6a8b9283594acc274cb324d7839d42565..6a6b16c268725c56152ee1a932ee35a0d6f36ea0 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Renderable/Severity.ts +++ b/Build/Sources/TypeScript/install/renderable/severity.ts @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/Install/Module/Severity + * Module: @typo3/install/module/severity */ class Severity { public readonly loading: number = -3; diff --git a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Router.ts b/Build/Sources/TypeScript/install/router.ts similarity index 96% rename from Build/Sources/TypeScript/install/Resources/Public/TypeScript/Router.ts rename to Build/Sources/TypeScript/install/router.ts index 5f8ee41d8bdbd7e012bd709fd37c1c81310eafd4..e3d24f5e2b26e53552e45b646e51b5812ffaa16f 100644 --- a/Build/Sources/TypeScript/install/Resources/Public/TypeScript/Router.ts +++ b/Build/Sources/TypeScript/install/router.ts @@ -12,15 +12,15 @@ */ import $ from 'jquery'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {AbstractInteractableModule} from './Module/AbstractInteractableModule'; -import {AbstractInlineModule} from './Module/AbstractInlineModule'; -import Icons from 'TYPO3/CMS/Backend/Icons'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import InfoBox from './Renderable/InfoBox'; -import ProgressBar from './Renderable/ProgressBar'; -import Severity from './Renderable/Severity'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {AbstractInteractableModule} from './module/abstract-interactable-module'; +import {AbstractInlineModule} from './module/abstract-inline-module'; +import Icons from '@typo3/backend/icons'; +import Modal from '@typo3/backend/modal'; +import InfoBox from './renderable/info-box'; +import ProgressBar from './renderable/progress-bar'; +import Severity from './renderable/severity'; class Router { private selectorBody: string = '.t3js-body'; diff --git a/Build/Sources/TypeScript/linkvalidator/Resources/Public/TypeScript/Linkvalidator.ts b/Build/Sources/TypeScript/linkvalidator/linkvalidator.ts similarity index 90% rename from Build/Sources/TypeScript/linkvalidator/Resources/Public/TypeScript/Linkvalidator.ts rename to Build/Sources/TypeScript/linkvalidator/linkvalidator.ts index 089722d61eab951fb19c4e0238d7dd51d16499f3..a53d43c89a74ab0afc916664064d00ca2c9bb83f 100644 --- a/Build/Sources/TypeScript/linkvalidator/Resources/Public/TypeScript/Linkvalidator.ts +++ b/Build/Sources/TypeScript/linkvalidator/linkvalidator.ts @@ -11,8 +11,8 @@ * The TYPO3 project - inspiring people to share! */ -import Notification from 'TYPO3/CMS/Backend/Notification'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import Notification from '@typo3/backend/notification'; +import RegularEvent from '@typo3/core/event/regular-event'; enum Selectors { settingsContainerSelector = '.t3js-linkvalidator-settings', @@ -20,7 +20,7 @@ enum Selectors { } /** - * Module: TYPO3/CMS/Linkvalidator/Linkvalidator + * Module: @typo3/linkvalidator/linkvalidator */ class Linkvalidator { private static toggleActionButtons(settingsContainer: HTMLElement): void { diff --git a/Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/ConfigurationView.ts b/Build/Sources/TypeScript/lowlevel/configuration-view.ts similarity index 91% rename from Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/ConfigurationView.ts rename to Build/Sources/TypeScript/lowlevel/configuration-view.ts index 49daf1865c8b7ee6b165393bdd84a797a343dbb2..64c953bdd6b2961c63e31eecede4772c17a5aa69 100644 --- a/Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/ConfigurationView.ts +++ b/Build/Sources/TypeScript/lowlevel/configuration-view.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import DocumentService from '@typo3/core/document-service'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Lowlevel/ConfigurationView + * Module: @typo3/lowlevel/configuration-view * JavaScript for Configuration View */ class ConfigurationView { diff --git a/Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/QueryGenerator.ts b/Build/Sources/TypeScript/lowlevel/query-generator.ts similarity index 95% rename from Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/QueryGenerator.ts rename to Build/Sources/TypeScript/lowlevel/query-generator.ts index a365cc1f6afbdd40a58994df16125cbb66d62159..78705637eb3af2b1c39a26070c1356ec5c9cec01 100644 --- a/Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/QueryGenerator.ts +++ b/Build/Sources/TypeScript/lowlevel/query-generator.ts @@ -12,11 +12,11 @@ */ import $ from 'jquery'; -import 'TYPO3/CMS/Backend/Input/Clearable'; -import DateTimePicker from 'TYPO3/CMS/Backend/DateTimePicker'; +import '@typo3/backend/input/clearable'; +import DateTimePicker from '@typo3/backend/date-time-picker'; /** - * Module: TYPO3/CMS/Lowlevel/QueryGenerator + * Module: @typo3/lowlevel/query-generator * This module handle the QueryGenerator forms. */ class QueryGenerator { diff --git a/Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/ReferenceIndex.ts b/Build/Sources/TypeScript/lowlevel/reference-index.ts similarity index 92% rename from Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/ReferenceIndex.ts rename to Build/Sources/TypeScript/lowlevel/reference-index.ts index 353b65bb879941d5ea8d178fcd605b943f08addf..cde274843beca60221a919bab6cd8eea69446cdc 100644 --- a/Build/Sources/TypeScript/lowlevel/Resources/Public/TypeScript/ReferenceIndex.ts +++ b/Build/Sources/TypeScript/lowlevel/reference-index.ts @@ -12,14 +12,14 @@ */ import NProgress from 'nprogress'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import RegularEvent from '@typo3/core/event/regular-event'; enum Selectors { actionsContainerSelector = '.t3js-reference-index-actions' } /** - * Module: TYPO3/CMS/Lowlevel/ReferenceIndex + * Module: @typo3/lowlevel/reference-index * Show progress indicator and disable buttons */ class ReferenceIndex { diff --git a/Build/Sources/TypeScript/opendocs/Resources/Public/TypeScript/Toolbar/OpendocsMenu.ts b/Build/Sources/TypeScript/opendocs/toolbar/opendocs-menu.ts similarity index 92% rename from Build/Sources/TypeScript/opendocs/Resources/Public/TypeScript/Toolbar/OpendocsMenu.ts rename to Build/Sources/TypeScript/opendocs/toolbar/opendocs-menu.ts index 8d4da6dc39f1b80e4de3511acd51ca0be383d226..b278d261878d4d4d754516de9794eb8572125f4a 100644 --- a/Build/Sources/TypeScript/opendocs/Resources/Public/TypeScript/Toolbar/OpendocsMenu.ts +++ b/Build/Sources/TypeScript/opendocs/toolbar/opendocs-menu.ts @@ -12,11 +12,11 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import Icons from 'TYPO3/CMS/Backend/Icons'; -import Viewport from 'TYPO3/CMS/Backend/Viewport'; -import {ModuleStateStorage} from 'TYPO3/CMS/Backend/Storage/ModuleStateStorage'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import Icons from '@typo3/backend/icons'; +import Viewport from '@typo3/backend/viewport'; +import {ModuleStateStorage} from '@typo3/backend/storage/module-state-storage'; enum Selectors { containerSelector = '#typo3-cms-opendocs-backend-toolbaritems-opendocstoolbaritem', @@ -29,7 +29,7 @@ enum Selectors { } /** - * Module: TYPO3/CMS/Opendocs/OpendocsMenu + * Module: @typo3/opendocs/opendocs-menu * main JS part taking care of * - navigating to the documents * - updating the menu diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/BrowseDatabase.ts b/Build/Sources/TypeScript/recordlist/browse-database.ts similarity index 81% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/BrowseDatabase.ts rename to Build/Sources/TypeScript/recordlist/browse-database.ts index 207cc20df0f2091d64d7b73db8242db66a9bc12a..e00b35bc943dea3b6804892f25c066b229ab67f7 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/BrowseDatabase.ts +++ b/Build/Sources/TypeScript/recordlist/browse-database.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import ElementBrowser from './ElementBrowser'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import ElementBrowser from './element-browser'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Recordlist/BrowseDatabase + * Module: @typo3/recordlist/browse-database * Database record selection - * @exports TYPO3/CMS/Recordlist/BrowseDatabase + * @exports @typo3/recordlist/browse-database */ class BrowseDatabase { constructor() { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/BrowseFiles.ts b/Build/Sources/TypeScript/recordlist/browse-files.ts similarity index 92% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/BrowseFiles.ts rename to Build/Sources/TypeScript/recordlist/browse-files.ts index 980f792d524f4f77747ae50d6c403616cdd1b5f6..3e7a696bb00e6a511823c8c26e7f9edae027d1d8 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/BrowseFiles.ts +++ b/Build/Sources/TypeScript/recordlist/browse-files.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import {MessageUtility} from 'TYPO3/CMS/Backend/Utility/MessageUtility'; -import ElementBrowser from './ElementBrowser'; +import {MessageUtility} from '@typo3/backend/utility/message-utility'; +import ElementBrowser from './element-browser'; import NProgress from 'nprogress'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import RegularEvent from '@typo3/core/event/regular-event'; import Icons = TYPO3.Icons; -import {ActionEventDetails} from 'TYPO3/CMS/Backend/MultiRecordSelectionAction'; +import {ActionEventDetails} from '@typo3/backend/multi-record-selection-action'; interface LinkElement { fileName: string; diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/BrowseFolders.ts b/Build/Sources/TypeScript/recordlist/browse-folders.ts similarity index 79% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/BrowseFolders.ts rename to Build/Sources/TypeScript/recordlist/browse-folders.ts index 801960720fb32bb38ecc079b9392ae3bfe5aef10..c604e4f77ab2b1edfdd317638eaa324abf357477 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/BrowseFolders.ts +++ b/Build/Sources/TypeScript/recordlist/browse-folders.ts @@ -11,15 +11,15 @@ * The TYPO3 project - inspiring people to share! */ -import ElementBrowser from './ElementBrowser'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Severity from 'TYPO3/CMS/Backend/Severity'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import ElementBrowser from './element-browser'; +import Modal from '@typo3/backend/modal'; +import Severity from '@typo3/backend/severity'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Recordlist/BrowseFolders + * Module: @typo3/recordlist/browse-folders * Folder selection - * @exports TYPO3/CMS/Recordlist/BrowseFolders + * @exports @typo3/recordlist/browse-folders */ class BrowseFolders { constructor() { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/ClearCache.ts b/Build/Sources/TypeScript/recordlist/clear-cache.ts similarity index 88% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/ClearCache.ts rename to Build/Sources/TypeScript/recordlist/clear-cache.ts index d5b3b86f36792a522cdcedb3b8fb1349a0cdd710..0f5c2df689e857dc53eebc0d5638611c3734ea8a 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/ClearCache.ts +++ b/Build/Sources/TypeScript/recordlist/clear-cache.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import Icons from 'TYPO3/CMS/Backend/Icons'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import Notification from '@typo3/backend/notification'; +import Icons from '@typo3/backend/icons'; +import RegularEvent from '@typo3/core/event/regular-event'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; enum Identifiers { clearCache = '.t3js-clear-page-cache', @@ -23,7 +23,7 @@ enum Identifiers { } /** - * Module: TYPO3/CMS/Recordlist/ClearCache + * Module: @typo3/recordlist/clear-cache */ class ClearCache { private static setDisabled(element: HTMLButtonElement, isDisabled: boolean): void { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/ElementBrowser.ts b/Build/Sources/TypeScript/recordlist/element-browser.ts similarity index 94% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/ElementBrowser.ts rename to Build/Sources/TypeScript/recordlist/element-browser.ts index d598162c14a79aca43c913055ff0fec6c2f4a88b..1feb1d019d26efb70ad41c9f9448a3d1f37087ea 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/ElementBrowser.ts +++ b/Build/Sources/TypeScript/recordlist/element-browser.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import {MessageUtility} from 'TYPO3/CMS/Backend/Utility/MessageUtility'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import Modal from 'TYPO3/CMS/Backend/Modal'; +import {MessageUtility} from '@typo3/backend/utility/message-utility'; +import DocumentService from '@typo3/core/document-service'; +import Modal from '@typo3/backend/modal'; interface RTESettings { parameters: string; @@ -36,8 +36,8 @@ declare global { } /** - * Module: TYPO3/CMS/Recordlist/ElementBrowser - * @exports TYPO3/CMS/Recordlist/ElementBrowser + * Module: @typo3/recordlist/element-browser + * @exports @typo3/recordlist/element-browser * ElementBrowser communication with parent windows */ class ElementBrowser { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/FileLinkHandler.ts b/Build/Sources/TypeScript/recordlist/file-link-handler.ts similarity index 83% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/FileLinkHandler.ts rename to Build/Sources/TypeScript/recordlist/file-link-handler.ts index 48cae9febee0eccb6170b8caf7a44ae08cbc97be..dcea0652a3e1d089461718d55ef1cd1806068feb 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/FileLinkHandler.ts +++ b/Build/Sources/TypeScript/recordlist/file-link-handler.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import LinkBrowser from './LinkBrowser'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import LinkBrowser from './link-browser'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Recordlist/FileLinkHandler + * Module: @typo3/recordlist/file-link-handler * File link interaction - * @exports TYPO3/CMS/Recordlist/FileLinkHandler + * @exports @typo3/recordlist/file-link-handler */ class FileLinkHandler { constructor() { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/LinkBrowser.ts b/Build/Sources/TypeScript/recordlist/link-browser.ts similarity index 97% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/LinkBrowser.ts rename to Build/Sources/TypeScript/recordlist/link-browser.ts index 21d33492709780ae6e947333fcef8ccf1f2a8dda..dbe59aed4e86bae4cf92e77d89ff3db48f86bcf0 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/LinkBrowser.ts +++ b/Build/Sources/TypeScript/recordlist/link-browser.ts @@ -18,8 +18,8 @@ interface LinkAttributes { } /** - * Module: TYPO3/CMS/Recordlist/LinkBrowser - * @exports TYPO3/CMS/Recordlist/LinkBrowser + * Module: @typo3/recordlist/link-browser + * @exports @typo3/recordlist/link-browser */ class LinkBrowser { private urlParameters: Object = {}; diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/MailLinkHandler.ts b/Build/Sources/TypeScript/recordlist/mail-link-handler.ts similarity index 83% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/MailLinkHandler.ts rename to Build/Sources/TypeScript/recordlist/mail-link-handler.ts index e4298cfb4642d7ed929c5e6845141d975f2d8937..befca2f799ad12ac308fc65bc7f517329ccc7e72 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/MailLinkHandler.ts +++ b/Build/Sources/TypeScript/recordlist/mail-link-handler.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import LinkBrowser from './LinkBrowser'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import LinkBrowser from './link-browser'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Recordlist/MailLinkHandler - * @exports TYPO3/CMS/Recordlist/MailLinkHandler + * Module: @typo3/recordlist/mail-link-handler + * @exports @typo3/recordlist/mail-link-handler * Mail link interaction */ class MailLinkHandler { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/PageLinkHandler.ts b/Build/Sources/TypeScript/recordlist/page-link-handler.ts similarity index 89% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/PageLinkHandler.ts rename to Build/Sources/TypeScript/recordlist/page-link-handler.ts index ea64e88c38eb3a4ea89ce4b4d00352b923c8d9a4..327a1a11da9f5624400e326841ecc60830d6987a 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/PageLinkHandler.ts +++ b/Build/Sources/TypeScript/recordlist/page-link-handler.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import LinkBrowser from './LinkBrowser'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import LinkBrowser from './link-browser'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Recordlist/PageLinkHandler - * @exports TYPO3/CMS/Recordlist/PageLinkHandler + * Module: @typo3/recordlist/page-link-handler + * @exports @typo3/recordlist/page-link-handler * Page link interaction */ class PageLinkHandler { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/RecordDownloadButton.ts b/Build/Sources/TypeScript/recordlist/record-download-button.ts similarity index 92% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/RecordDownloadButton.ts rename to Build/Sources/TypeScript/recordlist/record-download-button.ts index b09735e58b2128c03e5812f3cc564e9eeffa5e48..d1ff1e02e2e0d55410718f69f08b4870affa2c96 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/RecordDownloadButton.ts +++ b/Build/Sources/TypeScript/recordlist/record-download-button.ts @@ -13,10 +13,10 @@ import {html, TemplateResult, LitElement} from 'lit'; import {customElement, property} from 'lit/decorators'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import Severity from 'TYPO3/CMS/Backend/Severity'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {lll} from 'TYPO3/CMS/Core/lit-helper'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import Severity from '@typo3/backend/severity'; +import Modal from '@typo3/backend/modal'; +import {lll} from '@typo3/core/lit-helper'; enum Selectors { formatSelector = '.t3js-record-download-format-selector', @@ -24,7 +24,7 @@ enum Selectors { } /** - * Module: TYPO3/CMS/Recordlist/RecordDownloadButton + * Module: @typo3/recordlist/record-download-button * * @example * <typo3-recordlist-record-download-button url="/url/to/configuration/form" title="Download records" ok="Download" close="Cancel"> diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/RecordLinkHandler.ts b/Build/Sources/TypeScript/recordlist/record-link-handler.ts similarity index 87% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/RecordLinkHandler.ts rename to Build/Sources/TypeScript/recordlist/record-link-handler.ts index 738d9984d2081e45d6e05b05e433fa575d3433ee..d4b9c13abe9d876c14451ebd1e3b33a6f813680a 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/RecordLinkHandler.ts +++ b/Build/Sources/TypeScript/recordlist/record-link-handler.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import LinkBrowser from './LinkBrowser'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import LinkBrowser from './link-browser'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Recordlist/RecordLinkHandler + * Module: @typo3/recordlist/record-link-handler * record link interaction */ class RecordLinkHandler { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/RecordSearch.ts b/Build/Sources/TypeScript/recordlist/record-search.ts similarity index 84% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/RecordSearch.ts rename to Build/Sources/TypeScript/recordlist/record-search.ts index 25b8c7cd76b4d0f82ac1a2c0fff9b7d89f94b372..2dc1061a1370b446a4604640e93493dc9e227f5b 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/RecordSearch.ts +++ b/Build/Sources/TypeScript/recordlist/record-search.ts @@ -11,17 +11,17 @@ * The TYPO3 project - inspiring people to share! */ -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import DocumentService from '@typo3/core/document-service'; +import RegularEvent from '@typo3/core/event/regular-event'; enum Selectors { searchFieldSelector = '#search_field', } /** - * Module: TYPO3/CMS/Recordlist/RecordSearch + * Module: @typo3/recordlist/record-search * Usability improvements for the record search - * @exports TYPO3/CMS/Recordlist/RecordSearch + * @exports @typo3/recordlist/record-search */ class RecordSearch { private searchField: HTMLInputElement = document.querySelector(Selectors.searchFieldSelector); diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/Recordlist.ts b/Build/Sources/TypeScript/recordlist/recordlist.ts similarity index 94% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/Recordlist.ts rename to Build/Sources/TypeScript/recordlist/recordlist.ts index e86281a3797c521ecef6c212ce582c72413f845f..f02de7a476ffae4936ad88f4960906ef1ba24c6a 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/Recordlist.ts +++ b/Build/Sources/TypeScript/recordlist/recordlist.ts @@ -12,15 +12,15 @@ */ import $ from 'jquery'; -import Icons from 'TYPO3/CMS/Backend/Icons'; -import PersistentStorage from 'TYPO3/CMS/Backend/Storage/Persistent'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import Tooltip from 'TYPO3/CMS/Backend/Tooltip'; -import DocumentService from 'TYPO3/CMS/Core/DocumentService'; -import {ActionConfiguration, ActionEventDetails} from 'TYPO3/CMS/Backend/MultiRecordSelectionAction'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import Severity from 'TYPO3/CMS/Backend/Severity'; +import Icons from '@typo3/backend/icons'; +import PersistentStorage from '@typo3/backend/storage/persistent'; +import RegularEvent from '@typo3/core/event/regular-event'; +import Tooltip from '@typo3/backend/tooltip'; +import DocumentService from '@typo3/core/document-service'; +import {ActionConfiguration, ActionEventDetails} from '@typo3/backend/multi-record-selection-action'; +import Modal from '@typo3/backend/modal'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import Severity from '@typo3/backend/severity'; interface IconIdentifier { collapse: string; @@ -53,9 +53,9 @@ interface DeleteRecordsConfiguration extends ActionConfiguration { } /** - * Module: TYPO3/CMS/Recordlist/Recordlist + * Module: @typo3/recordlist/recordlist * Usability improvements for the record list - * @exports TYPO3/CMS/Recordlist/Recordlist + * @exports @typo3/recordlist/recordlist */ class Recordlist { identifier: RecordlistIdentifier = { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/TelephoneLinkHandler.ts b/Build/Sources/TypeScript/recordlist/telephone-link-handler.ts similarity index 83% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/TelephoneLinkHandler.ts rename to Build/Sources/TypeScript/recordlist/telephone-link-handler.ts index aafedabe40d1e5a05621585ffbcdaccc333c379d..3681cb6c3abc757f1e38c9aaff89ec634bdcf5fe 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/TelephoneLinkHandler.ts +++ b/Build/Sources/TypeScript/recordlist/telephone-link-handler.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import LinkBrowser from './LinkBrowser'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import LinkBrowser from './link-browser'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Recordlist/TelephoneLinkHandler - * @exports TYPO3/CMS/Recordlist/TelephoneLinkHandler + * Module: @typo3/recordlist/telephone-link-handler + * @exports @typo3/recordlist/telephone-link-handler * Telephone link interaction */ class TelephoneLinkHandler { diff --git a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/UrlLinkHandler.ts b/Build/Sources/TypeScript/recordlist/url-link-handler.ts similarity index 82% rename from Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/UrlLinkHandler.ts rename to Build/Sources/TypeScript/recordlist/url-link-handler.ts index 2f861aba739a92239240c6b8613c48711fbf68b3..2fd0d4400b507c24058a517a012a680d7bba991f 100644 --- a/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/UrlLinkHandler.ts +++ b/Build/Sources/TypeScript/recordlist/url-link-handler.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import LinkBrowser from './LinkBrowser'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import LinkBrowser from './link-browser'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Recordlist/UrlLinkHandler - * @exports TYPO3/CMS/Recordlist/UrlLinkHandler + * Module: @typo3/recordlist/url-link-handler + * @exports @typo3/recordlist/url-link-handler * URL link interaction */ class UrlLinkHandler { diff --git a/Build/Sources/TypeScript/recycler/Resources/Public/TypeScript/Recycler.ts b/Build/Sources/TypeScript/recycler/recycler.ts similarity index 97% rename from Build/Sources/TypeScript/recycler/Resources/Public/TypeScript/Recycler.ts rename to Build/Sources/TypeScript/recycler/recycler.ts index 98ddfab50e0d0abc824648c7582ccde208987269..ce0ba14eeb21ebd6506f76d2e381c92a275e33d7 100644 --- a/Build/Sources/TypeScript/recycler/Resources/Public/TypeScript/Recycler.ts +++ b/Build/Sources/TypeScript/recycler/recycler.ts @@ -13,13 +13,13 @@ import $ from 'jquery'; import NProgress from 'nprogress'; -import 'TYPO3/CMS/Backend/Input/Clearable'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import DeferredAction from 'TYPO3/CMS/Backend/ActionButton/DeferredAction'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Notification from 'TYPO3/CMS/Backend/Notification'; -import Severity from 'TYPO3/CMS/Backend/Severity'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import '@typo3/backend/input/clearable'; +import '@typo3/backend/element/icon-element'; +import DeferredAction from '@typo3/backend/action-button/deferred-action'; +import Modal from '@typo3/backend/modal'; +import Notification from '@typo3/backend/notification'; +import Severity from '@typo3/backend/severity'; +import RegularEvent from '@typo3/core/event/regular-event'; enum RecyclerIdentifiers { searchForm = '#recycler-form', @@ -37,7 +37,7 @@ enum RecyclerIdentifiers { } /** - * Module: TYPO3/CMS/Recycler/Recycler + * Module: @typo3/recycler/recycler * RequireJS module for Recycler */ class Recycler { diff --git a/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/EventHandler.ts b/Build/Sources/TypeScript/redirects/event-handler.ts similarity index 88% rename from Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/EventHandler.ts rename to Build/Sources/TypeScript/redirects/event-handler.ts index 284917e16f3bc84db8f401be0386ddbc423ece32..d1608d12c20df03580ee721ec3528f32c9512aed 100644 --- a/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/EventHandler.ts +++ b/Build/Sources/TypeScript/redirects/event-handler.ts @@ -11,14 +11,14 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import NotificationService from 'TYPO3/CMS/Backend/Notification'; -import DeferredAction from 'TYPO3/CMS/Backend/ActionButton/DeferredAction'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import NotificationService from '@typo3/backend/notification'; +import DeferredAction from '@typo3/backend/action-button/deferred-action'; /** - * Module: TYPO3/CMS/Redirects/EventHandler - * @exports TYPO3/CMS/Redirects/EventHandler + * Module: @typo3/redirects/event-handler + * @exports @typo3/redirects/event-handler */ class EventHandler { public constructor() { diff --git a/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/FormEngineEvaluation.ts b/Build/Sources/TypeScript/redirects/form-engine-evaluation.ts similarity index 82% rename from Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/FormEngineEvaluation.ts rename to Build/Sources/TypeScript/redirects/form-engine-evaluation.ts index 75a1cf89fb548273ea395807899c6eb3183ba8ef..ce58a973734604587c43e6538ed5af399fe70cf0 100644 --- a/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/FormEngineEvaluation.ts +++ b/Build/Sources/TypeScript/redirects/form-engine-evaluation.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import FormEngineValidation from 'TYPO3/CMS/Backend/FormEngineValidation' +import FormEngineValidation from '@typo3/backend/form-engine-validation' /** - * Module: TYPO3/CMS/Redirects/FormEngineEvaluation - * @exports TYPO3/CMS/Redirects/FormEngineEvaluation + * Module: @typo3/redirects/form-engine-evaluation + * @exports @typo3/redirects/form-engine-evaluation */ export class FormEngineEvaluation { static registerCustomEvaluation(name: string): void { diff --git a/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/RedirectsModule.ts b/Build/Sources/TypeScript/redirects/redirects-module.ts similarity index 91% rename from Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/RedirectsModule.ts rename to Build/Sources/TypeScript/redirects/redirects-module.ts index 1cb088bcc36bb56f64a8cdd86b67e13a27c79a37..2d0bd5374f1e356ee7a9dc4abda64d24e8d2f87c 100644 --- a/Build/Sources/TypeScript/redirects/Resources/Public/TypeScript/RedirectsModule.ts +++ b/Build/Sources/TypeScript/redirects/redirects-module.ts @@ -11,11 +11,11 @@ * The TYPO3 project - inspiring people to share! */ -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Redirects/RedirectsModule - * @exports TYPO3/CMS/Redirects/RedirectsModule + * Module: @typo3/redirects/redirects-module + * @exports @typo3/redirects/redirects-module */ class RedirectsModule { public constructor() { diff --git a/Build/Sources/TypeScript/rte_ckeditor/Resources/Public/TypeScript/CKEditorLoader.ts b/Build/Sources/TypeScript/rte_ckeditor/ckeditor-loader.ts similarity index 100% rename from Build/Sources/TypeScript/rte_ckeditor/Resources/Public/TypeScript/CKEditorLoader.ts rename to Build/Sources/TypeScript/rte_ckeditor/ckeditor-loader.ts diff --git a/Build/Sources/TypeScript/rte_ckeditor/Resources/Public/TypeScript/FormEngineInitializer.ts b/Build/Sources/TypeScript/rte_ckeditor/form-engine-initializer.ts similarity index 93% rename from Build/Sources/TypeScript/rte_ckeditor/Resources/Public/TypeScript/FormEngineInitializer.ts rename to Build/Sources/TypeScript/rte_ckeditor/form-engine-initializer.ts index 71e8ab6ad8e13a518e210f3369c6b52b0d63f439..3828b3da0f39cc5e65e8d1c1079e2443e43aec03 100644 --- a/Build/Sources/TypeScript/rte_ckeditor/Resources/Public/TypeScript/FormEngineInitializer.ts +++ b/Build/Sources/TypeScript/rte_ckeditor/form-engine-initializer.ts @@ -11,9 +11,9 @@ * The TYPO3 project - inspiring people to share! */ -import {loadCKEditor} from 'TYPO3/CMS/RteCkeditor/CKEditorLoader'; +import {loadCKEditor} from '@typo3/rte-ckeditor/ckeditor-loader'; import $ from 'jquery'; -import FormEngine from 'TYPO3/CMS/Backend/FormEngine'; +import FormEngine from '@typo3/backend/form-engine'; interface CKEditorOptions { fieldId: string; @@ -28,7 +28,7 @@ interface CKEditorExternalPlugin { } /** - * @exports TYPO3/CMS/RteCkeditor/FormEngineInitializer + * @exports @typo3/rte-ckeditor/form-engine-initializer */ export class FormEngineInitializer { public static initializeCKEditor(options: CKEditorOptions): void { diff --git a/Build/Sources/TypeScript/rte_ckeditor/Resources/Public/TypeScript/RteLinkBrowser.ts b/Build/Sources/TypeScript/rte_ckeditor/rte-link-browser.ts similarity index 96% rename from Build/Sources/TypeScript/rte_ckeditor/Resources/Public/TypeScript/RteLinkBrowser.ts rename to Build/Sources/TypeScript/rte_ckeditor/rte-link-browser.ts index 6ea8db361ccb1daea50e4685c29607324cf7f256..dca5f344e65a366309f38146e07c80abd4c7034f 100644 --- a/Build/Sources/TypeScript/rte_ckeditor/Resources/Public/TypeScript/RteLinkBrowser.ts +++ b/Build/Sources/TypeScript/rte_ckeditor/rte-link-browser.ts @@ -12,11 +12,11 @@ */ import $ from 'jquery'; -import LinkBrowser from 'TYPO3/CMS/Recordlist/LinkBrowser'; -import Modal from 'TYPO3/CMS/Backend/Modal'; +import LinkBrowser from '@typo3/recordlist/link-browser'; +import Modal from '@typo3/backend/modal'; /** - * Module: TYPO3/CMS/RteCkeditor/RteLinkBrowser + * Module: @typo3/rte-ckeditor/rte-link-browser * LinkBrowser communication with parent window */ class RteLinkBrowser { diff --git a/Build/Sources/TypeScript/scheduler/Resources/Public/TypeScript/Scheduler.ts b/Build/Sources/TypeScript/scheduler/scheduler.ts similarity index 94% rename from Build/Sources/TypeScript/scheduler/Resources/Public/TypeScript/Scheduler.ts rename to Build/Sources/TypeScript/scheduler/scheduler.ts index db802836253ccc26574d4f1ba675d91d02030387..3a8df2d1e7fcfecf2bf9d208f0d238fde6e77f94 100644 --- a/Build/Sources/TypeScript/scheduler/Resources/Public/TypeScript/Scheduler.ts +++ b/Build/Sources/TypeScript/scheduler/scheduler.ts @@ -13,22 +13,22 @@ import $ from 'jquery'; import Tablesort from 'tablesort'; -import DocumentSaveActions from 'TYPO3/CMS/Backend/DocumentSaveActions'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Icons from 'TYPO3/CMS/Backend/Icons'; -import { MessageUtility } from 'TYPO3/CMS/Backend/Utility/MessageUtility'; -import {ActionEventDetails} from 'TYPO3/CMS/Backend/MultiRecordSelectionAction'; -import PersistentStorage from 'TYPO3/CMS/Backend/Storage/Persistent'; -import DateTimePicker from 'TYPO3/CMS/Backend/DateTimePicker'; +import DocumentSaveActions from '@typo3/backend/document-save-actions'; +import RegularEvent from '@typo3/core/event/regular-event'; +import Modal from '@typo3/backend/modal'; +import Icons from '@typo3/backend/icons'; +import { MessageUtility } from '@typo3/backend/utility/message-utility'; +import {ActionEventDetails} from '@typo3/backend/multi-record-selection-action'; +import PersistentStorage from '@typo3/backend/storage/persistent'; +import DateTimePicker from '@typo3/backend/date-time-picker'; interface TableNumberMapping { [s: string]: number; } /** - * Module: TYPO3/CMS/Scheduler/Scheduler - * @exports TYPO3/CMS/Scheduler/Scheduler + * Module: @typo3/scheduler/scheduler + * @exports @typo3/scheduler/scheduler */ class Scheduler { private static updateElementBrowserTriggers(): void { diff --git a/Build/Sources/TypeScript/setup/Resources/Public/TypeScript/SetupModule.ts b/Build/Sources/TypeScript/setup/setup-module.ts similarity index 93% rename from Build/Sources/TypeScript/setup/Resources/Public/TypeScript/SetupModule.ts rename to Build/Sources/TypeScript/setup/setup-module.ts index 4fe4b606d0ae835eac4afcd1f05073b1e8c9c97b..17c42824d3bf5964046070e44aba18a309a289f1 100644 --- a/Build/Sources/TypeScript/setup/Resources/Public/TypeScript/SetupModule.ts +++ b/Build/Sources/TypeScript/setup/setup-module.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import {ModalResponseEvent} from 'TYPO3/CMS/Backend/ModalInterface'; -import {MessageUtility} from 'TYPO3/CMS/Backend/Utility/MessageUtility'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import {ModalResponseEvent} from '@typo3/backend/modal-interface'; +import {MessageUtility} from '@typo3/backend/utility/message-utility'; +import RegularEvent from '@typo3/core/event/regular-event'; /** - * Module: TYPO3/CMS/Setup/SetupModule - * @exports TYPO3/CMS/Setup/SetupModule + * Module: @typo3/setup/setup-module + * @exports @typo3/setup/setup-module */ class SetupModule { private avatarWindowRef: Window; diff --git a/Build/Sources/TypeScript/t3editor/Resources/Public/TypeScript/Element/CodeMirrorElement.ts b/Build/Sources/TypeScript/t3editor/element/code-mirror-element.ts similarity index 98% rename from Build/Sources/TypeScript/t3editor/Resources/Public/TypeScript/Element/CodeMirrorElement.ts rename to Build/Sources/TypeScript/t3editor/element/code-mirror-element.ts index 8ee93229359b7aa2ab32cc21f46edb8723a30989..a1e7f70b2921fdf3f5dff36254802dad79717410 100644 --- a/Build/Sources/TypeScript/t3editor/Resources/Public/TypeScript/Element/CodeMirrorElement.ts +++ b/Build/Sources/TypeScript/t3editor/element/code-mirror-element.ts @@ -14,7 +14,7 @@ import {LitElement, html, css, CSSResult} from 'lit'; import {customElement, property, state} from 'lit/decorators'; -import 'TYPO3/CMS/Backend/Element/SpinnerElement' +import '@typo3/backend/element/spinner-element' interface MarkTextPosition { line: number; @@ -26,7 +26,7 @@ interface MarkText { } /** - * Module: TYPO3/CMS/T3editor/Element/CodeMirrorElement + * Module: @typo3/t3editor/element/code-mirror-element * Renders CodeMirror into FormEngine */ @customElement('typo3-t3editor-codemirror') diff --git a/Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/ConstantEditor.ts b/Build/Sources/TypeScript/tstemplate/constant-editor.ts similarity index 98% rename from Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/ConstantEditor.ts rename to Build/Sources/TypeScript/tstemplate/constant-editor.ts index 0bbe9b6be3438692d634edf903fc40e3b871ec30..9aa5f2c16db2128f6569b5ef78ac6de241f9323d 100644 --- a/Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/ConstantEditor.ts +++ b/Build/Sources/TypeScript/tstemplate/constant-editor.ts @@ -21,7 +21,7 @@ enum Selectors { } /** - * Module: TYPO3/CMS/Tstemplate/ConstantEditor + * Module: @typo3/tstemplate/constant-editor * Various functions related to the Constant Editor * e.g. updating the field and working with colors */ diff --git a/Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/InformationModule.ts b/Build/Sources/TypeScript/tstemplate/information-module.ts similarity index 93% rename from Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/InformationModule.ts rename to Build/Sources/TypeScript/tstemplate/information-module.ts index 170a5d43e1b88dce959b666040c163caf683e140..729641804463d8646aad1a2f0003d0729362937c 100644 --- a/Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/InformationModule.ts +++ b/Build/Sources/TypeScript/tstemplate/information-module.ts @@ -11,7 +11,7 @@ * The TYPO3 project - inspiring people to share! */ -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import RegularEvent from '@typo3/core/event/regular-event'; class InformationModule { constructor() { diff --git a/Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/TypoScriptObjectBrowser.ts b/Build/Sources/TypeScript/tstemplate/typo-script-object-browser.ts similarity index 87% rename from Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/TypoScriptObjectBrowser.ts rename to Build/Sources/TypeScript/tstemplate/typo-script-object-browser.ts index 287dd46eb0679ae12643f1bf52d91dedb3f477a3..2c18dac1983c05891d231a215aed3072f9fefa09 100644 --- a/Build/Sources/TypeScript/tstemplate/Resources/Public/TypeScript/TypoScriptObjectBrowser.ts +++ b/Build/Sources/TypeScript/tstemplate/typo-script-object-browser.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import 'TYPO3/CMS/Backend/Input/Clearable'; +import '@typo3/backend/input/clearable'; /** - * Module: TYPO3/CMS/Tstemplate/TypoScriptObjectBrowser + * Module: @typo3/tstemplate/typo-script-object-browser * JavaScript for TypoScript Object Browser - * @exports TYPO3/CMS/Tstemplate/TypoScriptObjectBrowser + * @exports @typo3/tstemplate/typo-script-object-browser */ class TypoScriptObjectBrowser { private searchField: HTMLInputElement; diff --git a/Build/Sources/TypeScript/viewpage/Resources/Public/TypeScript/Main.ts b/Build/Sources/TypeScript/viewpage/main.ts similarity index 98% rename from Build/Sources/TypeScript/viewpage/Resources/Public/TypeScript/Main.ts rename to Build/Sources/TypeScript/viewpage/main.ts index f6f91b9b3849a296dbec359e2ca43b17f13cfe80..baadcc514dad3a040445a03e9e03fc84dbdad148 100644 --- a/Build/Sources/TypeScript/viewpage/Resources/Public/TypeScript/Main.ts +++ b/Build/Sources/TypeScript/viewpage/main.ts @@ -13,8 +13,8 @@ import $ from 'jquery'; import 'jquery-ui/resizable'; -import PersistentStorage from 'TYPO3/CMS/Backend/Storage/Persistent'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; +import PersistentStorage from '@typo3/backend/storage/persistent'; +import SecurityUtility from '@typo3/core/security-utility'; enum Selectors { resizableContainerIdentifier = '.t3js-viewpage-resizeable', @@ -33,7 +33,7 @@ enum Selectors { } /** - * Module: TYPO3/CMS/Viewpage/Main + * Module: @typo3/viewpage/main * Main logic for resizing the view of the frame */ class ViewPage { diff --git a/Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Backend.ts b/Build/Sources/TypeScript/workspaces/backend.ts similarity index 98% rename from Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Backend.ts rename to Build/Sources/TypeScript/workspaces/backend.ts index ed39d0706fc690ae19c80bdedb5bdf5e65833539..439852c1ada17309d3c09a7c1b055e786c7a1834 100644 --- a/Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Backend.ts +++ b/Build/Sources/TypeScript/workspaces/backend.ts @@ -11,20 +11,20 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; import $ from 'jquery'; -import 'TYPO3/CMS/Backend/Element/IconElement'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; -import 'TYPO3/CMS/Backend/Input/Clearable'; -import Workspaces from './Workspaces'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Persistent from 'TYPO3/CMS/Backend/Storage/Persistent'; -import Tooltip from 'TYPO3/CMS/Backend/Tooltip'; -import Utility from 'TYPO3/CMS/Backend/Utility'; -import Wizard from 'TYPO3/CMS/Backend/Wizard'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility'; -import windowManager from 'TYPO3/CMS/Backend/WindowManager'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; +import '@typo3/backend/element/icon-element'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; +import '@typo3/backend/input/clearable'; +import Workspaces from './workspaces'; +import Modal from '@typo3/backend/modal'; +import Persistent from '@typo3/backend/storage/persistent'; +import Tooltip from '@typo3/backend/tooltip'; +import Utility from '@typo3/backend/utility'; +import Wizard from '@typo3/backend/wizard'; +import SecurityUtility from '@typo3/core/security-utility'; +import windowManager from '@typo3/backend/window-manager'; +import RegularEvent from '@typo3/core/event/regular-event'; enum Identifiers { searchForm = '#workspace-settings-form', diff --git a/Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Preview.ts b/Build/Sources/TypeScript/workspaces/preview.ts similarity index 96% rename from Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Preview.ts rename to Build/Sources/TypeScript/workspaces/preview.ts index 57720e19ecff556b1b761c97dbb3700af419e9a1..0f8fdf9d091b7f63c91da41ee03ce3acf7525bc8 100644 --- a/Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Preview.ts +++ b/Build/Sources/TypeScript/workspaces/preview.ts @@ -11,13 +11,13 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; import $ from 'jquery'; -import Modal from 'TYPO3/CMS/Backend/Modal'; -import Utility from 'TYPO3/CMS/Backend/Utility'; -import Workspaces from './Workspaces'; -import ThrottleEvent from 'TYPO3/CMS/Core/Event/ThrottleEvent'; +import Modal from '@typo3/backend/modal'; +import Utility from '@typo3/backend/utility'; +import Workspaces from './workspaces'; +import ThrottleEvent from '@typo3/core/event/throttle-event'; enum Identifiers { topbar = '#typo3-topbar', diff --git a/Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Toolbar/WorkspacesMenu.ts b/Build/Sources/TypeScript/workspaces/toolbar/workspaces-menu.ts similarity index 94% rename from Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Toolbar/WorkspacesMenu.ts rename to Build/Sources/TypeScript/workspaces/toolbar/workspaces-menu.ts index 26ed2b88bb3cfbdbdbec64b0d5f3581ffadfca52..0d2f04834968bf83ed422a63c5d87eb7bdc38ace 100644 --- a/Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Toolbar/WorkspacesMenu.ts +++ b/Build/Sources/TypeScript/workspaces/toolbar/workspaces-menu.ts @@ -12,13 +12,13 @@ */ import $ from 'jquery'; -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import ModuleMenu from 'TYPO3/CMS/Backend/ModuleMenu'; -import Viewport from 'TYPO3/CMS/Backend/Viewport'; -import RegularEvent from 'TYPO3/CMS/Core/Event/RegularEvent'; -import {ModuleStateStorage} from 'TYPO3/CMS/Backend/Storage/ModuleStateStorage'; -import Icons from 'TYPO3/CMS/Backend/Icons'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import ModuleMenu from '@typo3/backend/module-menu'; +import Viewport from '@typo3/backend/viewport'; +import RegularEvent from '@typo3/core/event/regular-event'; +import {ModuleStateStorage} from '@typo3/backend/storage/module-state-storage'; +import Icons from '@typo3/backend/icons'; enum Identifiers { containerSelector = '#typo3-cms-workspaces-backend-toolbaritems-workspaceselectortoolbaritem', @@ -42,7 +42,7 @@ interface WorkspaceState { } /** - * Module: TYPO3/CMS/Workspaces/Toolbar/WorkspacesMenu + * Module: @typo3/workspaces/toolbar/workspaces-menu * toolbar menu for the workspaces functionality to switch between the workspaces * and jump to the workspaces module */ diff --git a/Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Workspaces.ts b/Build/Sources/TypeScript/workspaces/workspaces.ts similarity index 96% rename from Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Workspaces.ts rename to Build/Sources/TypeScript/workspaces/workspaces.ts index 84d19c8067405d4a2e5aaf73d4a941c1a8f811f6..a93a73263d2f7f6e5b223e0a68fe978df675d901 100644 --- a/Build/Sources/TypeScript/workspaces/Resources/Public/TypeScript/Workspaces.ts +++ b/Build/Sources/TypeScript/workspaces/workspaces.ts @@ -11,12 +11,12 @@ * The TYPO3 project - inspiring people to share! */ -import {AjaxResponse} from 'TYPO3/CMS/Core/Ajax/AjaxResponse'; -import AjaxRequest from 'TYPO3/CMS/Core/Ajax/AjaxRequest'; -import {SeverityEnum} from 'TYPO3/CMS/Backend/Enum/Severity'; +import {AjaxResponse} from '@typo3/core/ajax/ajax-response'; +import AjaxRequest from '@typo3/core/ajax/ajax-request'; +import {SeverityEnum} from '@typo3/backend/enum/severity'; import $ from 'jquery'; import NProgress from 'nprogress'; -import Modal from 'TYPO3/CMS/Backend/Modal'; +import Modal from '@typo3/backend/modal'; export default class Workspaces { private tid: number = 0; diff --git a/Build/tsconfig.json b/Build/tsconfig.json index 9dcacc3b382a5615f7a1204a95bb1c613aee79cd..7aec6cd83a9e0b8cd682602cda397f86755f83ab 100644 --- a/Build/tsconfig.json +++ b/Build/tsconfig.json @@ -18,80 +18,80 @@ "pretty": true, "baseUrl": "Sources/TypeScript", "paths": { - "TYPO3/CMS/Adminpanel/*": [ - "adminpanel/Resources/Public/TypeScript/*" + "@typo3/adminpanel/*": [ + "adminpanel/*" ], - "TYPO3/CMS/Backend/*": [ - "backend/Resources/Public/TypeScript/*" + "@typo3/backend/*": [ + "backend/*" ], - "TYPO3/CMS/Belog/*": [ - "belog/Resources/Public/TypeScript/*" + "@typo3/belog/*": [ + "belog/*" ], - "TYPO3/CMS/Beuser/*": [ - "beuser/Resources/Public/TypeScript/*" + "@typo3/beuser/*": [ + "beuser/*" ], - "TYPO3/CMS/Core/*": [ - "core/Resources/Public/TypeScript/*" + "@typo3/core/*": [ + "core/*" ], - "TYPO3/CMS/Dashboard/*": [ - "dashboard/Resources/Public/TypeScript/*" + "@typo3/dashboard/*": [ + "dashboard/*" ], - "TYPO3/CMS/Extensionmanager/*": [ - "extensionmanager/Resources/Public/TypeScript/*" + "@typo3/extensionmanager/*": [ + "extensionmanager/*" ], - "TYPO3/CMS/Filelist/*": [ - "filelist/Resources/Public/TypeScript/*" + "@typo3/filelist/*": [ + "filelist/*" ], - "TYPO3/CMS/Form/*": [ - "form/Resources/Public/TypeScript/*" + "@typo3/form/*": [ + "form/*" ], - "TYPO3/CMS/Impexp/*": [ - "impexp/Resources/Public/TypeScript/*" + "@typo3/impexp/*": [ + "impexp/*" ], - "TYPO3/CMS/Info/*": [ - "info/Resources/Public/TypeScript/*" + "@typo3/info/*": [ + "info/*" ], - "TYPO3/CMS/Install/*": [ - "install/Resources/Public/TypeScript/*" + "@typo3/install/*": [ + "install/*" ], - "TYPO3/CMS/Linkvalidator/*": [ - "linkvalidator/Resources/Public/TypeScript/*" + "@typo3/linkvalidator/*": [ + "linkvalidator/*" ], - "TYPO3/CMS/Lowlevel/*": [ - "lowlevel/Resources/Public/TypeScript/*" + "@typo3/lowlevel/*": [ + "lowlevel/*" ], - "TYPO3/CMS/Opendocs/*": [ - "opendocs/Resources/Public/TypeScript/*" + "@typo3/opendocs/*": [ + "opendocs/*" ], - "TYPO3/CMS/Recordlist/*": [ - "recordlist/Resources/Public/TypeScript/*" + "@typo3/recordlist/*": [ + "recordlist/*" ], - "TYPO3/CMS/Recycler/*": [ - "recycler/Resources/Public/TypeScript/*" + "@typo3/recycler/*": [ + "recycler/*" ], - "TYPO3/CMS/Redirects/*": [ - "redirects/Resources/Public/TypeScript/*" + "@typo3/redirects/*": [ + "redirects/*" ], - "TYPO3/CMS/RteCkeditor/*": [ - "rte_ckeditor/Resources/Public/TypeScript/*" + "@typo3/rte-ckeditor/*": [ + "rte_ckeditor/*" ], - "TYPO3/CMS/Scheduler/*": [ - "scheduler/Resources/Public/TypeScript/*" + "@typo3/scheduler/*": [ + "scheduler/*" ], - "TYPO3/CMS/Setup/*": [ - "setup/Resources/Public/TypeScript/*" + "@typo3/setup/*": [ + "setup/*" ], - "TYPO3/CMS/T3editor/*": [ - "t3editor/Resources/Public/TypeScript/*" + "@typo3/t3editor/*": [ + "t3editor/*" ], - "TYPO3/CMS/Tstemplate/*": [ - "tstemplate/Resources/Public/TypeScript/*" + "@typo3/tstemplate/*": [ + "tstemplate/*" ], - "TYPO3/CMS/Viewpage/*": [ - "viewpage/Resources/Public/TypeScript/*" + "@typo3/viewpage/*": [ + "viewpage/*" ], - "TYPO3/CMS/Workspaces/*": [ - "workspaces/Resources/Public/TypeScript/*" + "@typo3/workspaces/*": [ + "workspaces/*" ] }, "outDir": "./JavaScript/", diff --git a/Build/types/TYPO3/index.d.ts b/Build/types/TYPO3/index.d.ts index 77e42723c591c0c2cd191f757247b7bb67962825..e251c25385bcf0b920d05647039e46f76f6648d9 100644 --- a/Build/types/TYPO3/index.d.ts +++ b/Build/types/TYPO3/index.d.ts @@ -115,12 +115,12 @@ declare namespace TBE_EDITOR { * Current AMD/RequireJS modules are returning *instances* of ad-hoc *classes*, make that known to TypeScript */ -declare module 'TYPO3/CMS/Backend/FormEngineValidation' { +declare module '@typo3/backend/form-engine-validation' { const _exported: TYPO3.CMS.Backend.FormEngineValidation; export default _exported; } -declare module 'TYPO3/CMS/Backend/FormEngine' { +declare module '@typo3/backend/form-engine' { const _exported: TYPO3.CMS.Backend.FormEngine; export default _exported; } @@ -147,10 +147,10 @@ declare module 'codemirror'; declare module 'flatpickr/flatpickr.min'; declare module 'flatpickr/locales'; declare module 'moment'; -declare module 'TYPO3/CMS/Backend/LegacyTree'; -declare module 'TYPO3/CMS/Install/chosen.jquery.min'; -declare module 'TYPO3/CMS/Recordlist/LinkBrowser'; -declare module 'TYPO3/CMS/Dashboard/Contrib/chartjs'; +declare module '@typo3/backend/legacy-tree'; +declare module '@typo3/install/chosen.jquery.min'; +declare module '@typo3/recordlist/link-browser'; +declare module '@typo3/dashboard/contrib/chartjs'; interface Taboverride { set(elems: HTMLElement|HTMLElement[], enable?: boolean): Taboverride } diff --git a/Build/util/map-import.js b/Build/util/map-import.js index 6f97a111a9d4de58a817adc9fae6647d1b0bbb67..1ee11d8490c1874de984faab55c8574839d318c3 100644 --- a/Build/util/map-import.js +++ b/Build/util/map-import.js @@ -19,7 +19,7 @@ const mapImport = (targetModule, context) => { if (targetModule.charAt(0) === '.') { targetModule = path .resolve(path.dirname(context), targetModule) - .replace(/^.*\/Build\/JavaScript\/([^\/]+?)\/Resources\/Public\/TypeScript/, (match, extname) => 'TYPO3/CMS/' + ('_' + extname).replace(/_./g, (e) => e.charAt(1).toUpperCase())); + .replace(/^.*\/Build\/JavaScript\/([^\/]+?)/, (match, extname) => '@typo3/' + extname.replace(/_/g, '-')); } return targetModule + suffix; diff --git a/typo3/sysext/adminpanel/Classes/Utility/ResourceUtility.php b/typo3/sysext/adminpanel/Classes/Utility/ResourceUtility.php index 5aa18cda543cf6b30b82831b595fa61b0f1d8b38..13af60c5cf06b47855a3189e9dab7419dc0c749a 100644 --- a/typo3/sysext/adminpanel/Classes/Utility/ResourceUtility.php +++ b/typo3/sysext/adminpanel/Classes/Utility/ResourceUtility.php @@ -128,7 +128,7 @@ class ResourceUtility */ public static function getResources(): array { - $jsFileLocation = 'EXT:adminpanel/Resources/Public/JavaScript/AdminPanel.js'; + $jsFileLocation = 'EXT:adminpanel/Resources/Public/JavaScript/admin-panel.js'; $js = self::getJsTag($jsFileLocation); $cssFileLocation = 'EXT:adminpanel/Resources/Public/Css/adminpanel.css'; $css = self::getCssTag($cssFileLocation); diff --git a/typo3/sysext/adminpanel/Configuration/JavaScriptModules.php b/typo3/sysext/adminpanel/Configuration/JavaScriptModules.php index de22158a6aee02c7e11896eb13530f2ee90fc744..f9e301f17b0dd8ee3fade7537ad5fefa2237d7c6 100644 --- a/typo3/sysext/adminpanel/Configuration/JavaScriptModules.php +++ b/typo3/sysext/adminpanel/Configuration/JavaScriptModules.php @@ -3,6 +3,6 @@ return [ 'dependencies' => [], 'imports' => [ - 'TYPO3/CMS/Adminpanel/' => 'EXT:adminpanel/Resources/Public/JavaScript/', + '@typo3/adminpanel/' => 'EXT:adminpanel/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/adminpanel/Resources/Public/JavaScript/AdminPanel.js b/typo3/sysext/adminpanel/Resources/Public/JavaScript/admin-panel.js similarity index 100% rename from typo3/sysext/adminpanel/Resources/Public/JavaScript/AdminPanel.js rename to typo3/sysext/adminpanel/Resources/Public/JavaScript/admin-panel.js diff --git a/typo3/sysext/adminpanel/Resources/Public/JavaScript/Modules/Cache.js b/typo3/sysext/adminpanel/Resources/Public/JavaScript/modules/cache.js similarity index 100% rename from typo3/sysext/adminpanel/Resources/Public/JavaScript/Modules/Cache.js rename to typo3/sysext/adminpanel/Resources/Public/JavaScript/modules/cache.js diff --git a/typo3/sysext/adminpanel/Resources/Public/JavaScript/Modules/Preview.js b/typo3/sysext/adminpanel/Resources/Public/JavaScript/modules/preview.js similarity index 100% rename from typo3/sysext/adminpanel/Resources/Public/JavaScript/Modules/Preview.js rename to typo3/sysext/adminpanel/Resources/Public/JavaScript/modules/preview.js diff --git a/typo3/sysext/backend/Classes/ContextMenu/ImportMapConfigurator.php b/typo3/sysext/backend/Classes/ContextMenu/ImportMapConfigurator.php index 425a6a2dd6bf9c7c716da28f19367768c8bd3297..5a5005a6f02091d169f831c5fc42b20fa5f5021f 100644 --- a/typo3/sysext/backend/Classes/ContextMenu/ImportMapConfigurator.php +++ b/typo3/sysext/backend/Classes/ContextMenu/ImportMapConfigurator.php @@ -23,7 +23,7 @@ class ImportMapConfigurator { public function __invoke(ResolveJavaScriptImportEvent $event): void { - if ($event->specifier === 'TYPO3/CMS/Backend/ContextMenu.js') { + if ($event->specifier === '@typo3/backend/context-menu.js') { $event->importMap->includeTaggedImports('backend.contextmenu'); } } diff --git a/typo3/sysext/backend/Classes/Controller/BackendController.php b/typo3/sysext/backend/Classes/Controller/BackendController.php index e23f8e4d236f744d16f7e69dc864c64e52592e22..423a168c613c954033e80e79edabde2fef7e5d92 100644 --- a/typo3/sysext/backend/Classes/Controller/BackendController.php +++ b/typo3/sysext/backend/Classes/Controller/BackendController.php @@ -85,7 +85,7 @@ class BackendController $javaScriptRenderer = $pageRenderer->getJavaScriptRenderer(); $javaScriptRenderer->addJavaScriptModuleInstruction( - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/LoginRefresh.js') + JavaScriptModuleInstruction::create('@typo3/backend/login-refresh.js') ->invoke('initialize', [ 'intervalTime' => MathUtility::forceIntegerInRange((int)$GLOBALS['TYPO3_CONF_VARS']['BE']['sessionTimeout'] - 60, 60), 'loginFramesetUrl' => (string)$this->uriBuilder->buildUriFromRoute('login_frameset'), @@ -93,11 +93,11 @@ class BackendController ]) ); $javaScriptRenderer->addJavaScriptModuleInstruction( - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/BroadcastService.js')->invoke('listen') + JavaScriptModuleInstruction::create('@typo3/backend/broadcast-service.js')->invoke('listen') ); // load the storage API and fill the UC into the PersistentStorage, so no additional AJAX call is needed $javaScriptRenderer->addJavaScriptModuleInstruction( - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/Storage/Persistent.js') + JavaScriptModuleInstruction::create('@typo3/backend/storage/persistent.js') ->invoke('load', $backendUser->uc) ); $javaScriptRenderer->addGlobalAssignment([ diff --git a/typo3/sysext/backend/Classes/Controller/ContentElement/MoveElementController.php b/typo3/sysext/backend/Classes/Controller/ContentElement/MoveElementController.php index ebfaa60433ad2f28098bd8f27a490d7d99231288..03efbf170a3a9d7271b2b59e6d8913e66bd64d2d 100644 --- a/typo3/sysext/backend/Classes/Controller/ContentElement/MoveElementController.php +++ b/typo3/sysext/backend/Classes/Controller/ContentElement/MoveElementController.php @@ -86,7 +86,7 @@ class MoveElementController } $assigns = []; $backendUser = $this->getBackendUser(); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tooltip.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tooltip.js'); // Get record for element: $elRow = BackendUtility::getRecordWSOL($this->table, $this->moveUid); // Headerline: Icon, record title: diff --git a/typo3/sysext/backend/Classes/Controller/LinkBrowserController.php b/typo3/sysext/backend/Classes/Controller/LinkBrowserController.php index b8cbb7897f06423b1f839265433a2a8093cb456c..a85e19b86556c98f2d2a83e4a877992ecdf9e2f2 100644 --- a/typo3/sysext/backend/Classes/Controller/LinkBrowserController.php +++ b/typo3/sysext/backend/Classes/Controller/LinkBrowserController.php @@ -65,7 +65,7 @@ class LinkBrowserController extends AbstractLinkBrowserController $this->parameters['fieldChangeFunc'] = []; } $this->pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction( - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngineLinkBrowserAdapter.js') + JavaScriptModuleInstruction::create('@typo3/backend/form-engine-link-browser-adapter.js') // @todo use a proper constructor when migrating to TypeScript ->invoke('setOnFieldChangeItems', $this->parameters['fieldChangeFunc']) ); diff --git a/typo3/sysext/backend/Classes/Controller/NewRecordController.php b/typo3/sysext/backend/Classes/Controller/NewRecordController.php index d5d0a34f7769878719a7a37b1ec789860c840506..de932d8fb1e52c50542dd3f6babd2b0aaaeed1cd 100644 --- a/typo3/sysext/backend/Classes/Controller/NewRecordController.php +++ b/typo3/sysext/backend/Classes/Controller/NewRecordController.php @@ -210,10 +210,10 @@ class NewRecordController $this->id = (int)($parsedBody['id'] ?? $queryParams['id'] ?? 0); $this->returnUrl = GeneralUtility::sanitizeLocalUrl($parsedBody['returnUrl'] ?? $queryParams['returnUrl'] ?? ''); // Setting up the context sensitive menu: - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ContextMenu.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tooltip.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/PageActions.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/NewContentElementWizardButton.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-menu.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tooltip.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/page-actions.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/new-content-element-wizard-button.js'); // Id a positive id is supplied, ask for the page record with permission information contained: if ($this->id > 0) { $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause) ?: []; diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php index e5edc26a8f4bcf0f083c8bc64e15737f0a4f5c13..d4f24577ffd6330a3cf3fad7723f5226a6cff6ab 100644 --- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php +++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php @@ -409,7 +409,7 @@ class PageLayoutController protected function addJavaScriptModuleInstructions(int $pageId, PageLayoutContext $pageLayoutContext, int $currentSelectedLanguage): void { - $pageActionsInstruction = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/PageActions.js'); + $pageActionsInstruction = JavaScriptModuleInstruction::create('@typo3/backend/page-actions.js'); if ($pageLayoutContext->isPageEditable()) { $languageOverlayId = 0; $pageLocalizationRecord = BackendUtility::getRecordLocalization('pages', $pageId, $currentSelectedLanguage); @@ -497,7 +497,7 @@ class PageLayoutController $pasteRecord = BackendUtility::getRecordWSOL('tt_content', $pasteItem); $pasteTitle = BackendUtility::getRecordTitle('tt_content', $pasteRecord, false, true); $this->pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction( - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/LayoutModule/Paste.js') + JavaScriptModuleInstruction::create('@typo3/backend/layout-module/paste.js') ->assign([ 'itemOnClipboardUid' => $pasteItem, 'itemOnClipboardTitle' => $pasteTitle, diff --git a/typo3/sysext/backend/Classes/Controller/ResetPasswordController.php b/typo3/sysext/backend/Classes/Controller/ResetPasswordController.php index 8e1ca155f9d621b8a90157e07279c3fd736c46c4..181b4282c85ea45f537d7ef77939fa0f50e24dcb 100644 --- a/typo3/sysext/backend/Classes/Controller/ResetPasswordController.php +++ b/typo3/sysext/backend/Classes/Controller/ResetPasswordController.php @@ -209,7 +209,7 @@ class ResetPasswordController $this->setUpBasicPageRendererForBackend($this->pageRenderer, $this->extensionConfiguration, $request, $languageService); $this->pageRenderer->setTitle('TYPO3 CMS Login: ' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ?? ''); $this->pageRenderer->loadJavaScriptModule('bootstrap'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Login.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/login.js'); $this->view = GeneralUtility::makeInstance(BackendTemplateView::class); $this->view->setTemplateRootPaths(['EXT:backend/Resources/Private/Templates']); diff --git a/typo3/sysext/backend/Classes/Form/Container/FlexFormSectionContainer.php b/typo3/sysext/backend/Classes/Form/Container/FlexFormSectionContainer.php index ddfe2fe38a735846a7595e706c69a2255bf10a04..2c5babd20dd18ae3d26b74ba0ce27a2d80ec195d 100644 --- a/typo3/sysext/backend/Classes/Form/Container/FlexFormSectionContainer.php +++ b/typo3/sysext/backend/Classes/Form/Container/FlexFormSectionContainer.php @@ -149,7 +149,7 @@ class FlexFormSectionContainer extends AbstractContainer $resultArray['html'] = implode(LF, $html); $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Container/FlexFormSectionContainer.js' + '@typo3/backend/form-engine/container/flex-form-section-container.js' )->instance($containerId); return $resultArray; diff --git a/typo3/sysext/backend/Classes/Form/Container/FlexFormTabsContainer.php b/typo3/sysext/backend/Classes/Form/Container/FlexFormTabsContainer.php index 4da74d9714d29be103d33ebde7ae0b2acf543902..ab753b68d41028dd9477c743fae4129d67805c22 100644 --- a/typo3/sysext/backend/Classes/Form/Container/FlexFormTabsContainer.php +++ b/typo3/sysext/backend/Classes/Form/Container/FlexFormTabsContainer.php @@ -55,7 +55,7 @@ class FlexFormTabsContainer extends AbstractContainer $flexFormRowData = $this->data['flexFormRowData']; $resultArray = $this->initializeResultArray(); - $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/Tabs.js'); + $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('@typo3/backend/tabs.js'); $domIdPrefix = 'DTM-' . md5($this->data['parameterArray']['itemFormElName']); $tabCounter = 0; diff --git a/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php b/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php index 0f3e5590716a4c33bc58171284831c798c57a3fc..14bc80a16c5e05345f521a755db962b073ace1bd 100644 --- a/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php +++ b/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php @@ -380,7 +380,7 @@ class InlineControlContainer extends AbstractContainer } $resultArray['requireJsModules'] = array_merge($resultArray['requireJsModules'], $this->requireJsModules); $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Container/InlineControlContainer.js' + '@typo3/backend/form-engine/container/inline-control-container.js' )->instance($nameObject); // Publish the uids of the child records in the given order to the browser @@ -563,14 +563,14 @@ class InlineControlContainer extends AbstractContainer $item .= htmlspecialchars($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:file_upload.select-and-submit')); $item .= '</button>'; - $this->requireJsModules[] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/DragUploader.js'); + $this->requireJsModules[] = JavaScriptModuleInstruction::create('@typo3/backend/drag-uploader.js'); } if (!empty($onlineMediaAllowed) && $showByUrl) { $buttonStyle = ''; if (isset($inlineConfiguration['inline']['inlineOnlineMediaAddButtonStyle'])) { $buttonStyle = ' style="' . $inlineConfiguration['inline']['inlineOnlineMediaAddButtonStyle'] . '"'; } - $this->requireJsModules[] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/OnlineMedia.js'); + $this->requireJsModules[] = JavaScriptModuleInstruction::create('@typo3/backend/online-media.js'); $buttonText = htmlspecialchars($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:online_media.new_media.button')); $placeholder = htmlspecialchars($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:online_media.new_media.placeholder')); $buttonSubmit = htmlspecialchars($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:online_media.new_media.submit')); diff --git a/typo3/sysext/backend/Classes/Form/Container/SiteLanguageContainer.php b/typo3/sysext/backend/Classes/Form/Container/SiteLanguageContainer.php index 3098642a71469c60a84f37ed0d3acbc501b3eb27..364be304bb47030e180fa67f8aa5375487775646 100644 --- a/typo3/sysext/backend/Classes/Form/Container/SiteLanguageContainer.php +++ b/typo3/sysext/backend/Classes/Form/Container/SiteLanguageContainer.php @@ -200,7 +200,7 @@ class SiteLanguageContainer extends AbstractContainer ]); $resultArray['html'] = $view->render('Form/SiteLanguageContainer'); - $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/Container/SiteLanguageContainer.js'); + $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('@typo3/backend/form-engine/container/site-language-container.js'); return $resultArray; } diff --git a/typo3/sysext/backend/Classes/Form/Container/TabsContainer.php b/typo3/sysext/backend/Classes/Form/Container/TabsContainer.php index e5010d01d65c51da57f985f891a303fa55c141fe..e3d60caf05e334ec23ef7c212fb2fd876f414296 100644 --- a/typo3/sysext/backend/Classes/Form/Container/TabsContainer.php +++ b/typo3/sysext/backend/Classes/Form/Container/TabsContainer.php @@ -63,7 +63,7 @@ class TabsContainer extends AbstractContainer } $resultArray = $this->initializeResultArray(); - $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/Tabs.js'); + $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('@typo3/backend/tabs.js'); $domIdPrefix = 'DTM-' . md5($this->data['tableName'] . $this->data['databaseRow']['uid']); $tabCounter = 0; diff --git a/typo3/sysext/backend/Classes/Form/Element/BackendLayoutWizardElement.php b/typo3/sysext/backend/Classes/Form/Element/BackendLayoutWizardElement.php index 665b23a198684210b575baa2f61a6a40d2dfb8cd..1db25f29b02190cf8bb03cddae084fa73e7d109d 100644 --- a/typo3/sysext/backend/Classes/Form/Element/BackendLayoutWizardElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/BackendLayoutWizardElement.php @@ -198,7 +198,7 @@ class BackendLayoutWizardElement extends AbstractFormElement $html = implode(LF, $html); $resultArray['html'] = $html; $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/GridEditor.js', + '@typo3/backend/grid-editor.js', 'GridEditor' )->instance(); $resultArray['additionalInlineLanguageLabelFiles'][] = 'EXT:core/Resources/Private/Language/locallang_wizards.xlf'; diff --git a/typo3/sysext/backend/Classes/Form/Element/CategoryElement.php b/typo3/sysext/backend/Classes/Form/Element/CategoryElement.php index 53483cce60c123047784458d1f1739a70f97f71f..1b7d80be60ef1a9a3c8bcd897cf933323b7a2cc8 100644 --- a/typo3/sysext/backend/Classes/Form/Element/CategoryElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/CategoryElement.php @@ -165,7 +165,7 @@ class CategoryElement extends AbstractFormElement $resultArray['additionalInlineLanguageLabelFiles'][] = 'EXT:core/Resources/Private/Language/locallang_csh_corebe.xlf'; } - $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/Element/CategoryElement.js'); + $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('@typo3/backend/form-engine/element/category-element.js'); return $resultArray; } diff --git a/typo3/sysext/backend/Classes/Form/Element/GroupElement.php b/typo3/sysext/backend/Classes/Form/Element/GroupElement.php index 663fc70c6baa9fee0b3c759056e3c3a32b611eb8..77012c16d7c369651fe0fc2d2d5c30c0146d7c4f 100644 --- a/typo3/sysext/backend/Classes/Form/Element/GroupElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/GroupElement.php @@ -373,7 +373,7 @@ class GroupElement extends AbstractFormElement $html[] = '</div>'; $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/GroupElement.js' + '@typo3/backend/form-engine/element/group-element.js' )->instance($fieldId); $resultArray['html'] = implode(LF, $html); diff --git a/typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php b/typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php index 5f311cad2c0ebf02f4da567c8c638e69e0f44db2..f2c1900261912da9a13eab2c71b9295286450878 100644 --- a/typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/ImageManipulationElement.php @@ -195,7 +195,7 @@ class ImageManipulationElement extends AbstractFormElement if ($arguments['isAllowedFileExtension']) { $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/ImageManipulation.js' + '@typo3/backend/image-manipulation.js' )->invoke('initializeTrigger'); $arguments['formEngine']['field']['id'] = StringUtility::getUniqueId('formengine-image-manipulation-'); if (GeneralUtility::inList($config['eval'] ?? '', 'required')) { diff --git a/typo3/sysext/backend/Classes/Form/Element/InputColorPickerElement.php b/typo3/sysext/backend/Classes/Form/Element/InputColorPickerElement.php index 8e4eb8932eaf61b43ba2c4ca832b685636cc419e..d2bee612d28fb265ccbc87f490df4fca4ac9717f 100644 --- a/typo3/sysext/backend/Classes/Form/Element/InputColorPickerElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/InputColorPickerElement.php @@ -122,7 +122,7 @@ class InputColorPickerElement extends AbstractFormElement // Load needed js library $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/ColorPicker.js' + '@typo3/backend/color-picker.js' )->invoke('initialize'); $attributes = [ diff --git a/typo3/sysext/backend/Classes/Form/Element/InputDateTimeElement.php b/typo3/sysext/backend/Classes/Form/Element/InputDateTimeElement.php index eafe3039346707399da73d73d571668f3e936d59..9808af515f304eeb15e45929fc1853ec5e9e99c9 100644 --- a/typo3/sysext/backend/Classes/Form/Element/InputDateTimeElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/InputDateTimeElement.php @@ -278,7 +278,7 @@ class InputDateTimeElement extends AbstractFormElement } $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/InputDateTimeElement.js' + '@typo3/backend/form-engine/element/input-date-time-element.js' )->instance($fieldId); $resultArray['html'] = '<div class="formengine-field-item t3js-formengine-field-item">' . $fieldInformationHtml . $fullElement . '</div>'; return $resultArray; diff --git a/typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php b/typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php index aad03654c80e78827e601abd2b77453dfe7ea746..eacbc105a7cae2d0398b518bf9d3920c0ce86f9b 100644 --- a/typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/InputLinkElement.php @@ -201,7 +201,7 @@ class InputLinkElement extends AbstractFormElement $valuePickerHtml[] = '</select>'; $valuePickerHtml[] = '</typo3-formengine-valuepicker>'; - $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/FieldWizard/ValuePicker.js'); + $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-wizard/value-picker.js'); } $fieldWizardResult = $this->renderFieldWizard(); @@ -303,7 +303,7 @@ class InputLinkElement extends AbstractFormElement } $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/InputLinkElement.js' + '@typo3/backend/form-engine/element/input-link-element.js' )->instance($fieldId); $resultArray['html'] = '<div class="formengine-field-item t3js-formengine-field-item">' . $fieldInformationHtml . $fullElement . '</div>'; return $resultArray; diff --git a/typo3/sysext/backend/Classes/Form/Element/InputSlugElement.php b/typo3/sysext/backend/Classes/Form/Element/InputSlugElement.php index f92b00c83175352f5a0eb417773baa708bfcec20..d0d06494227ec1209bd04a0d1771d1b217fd0e84 100644 --- a/typo3/sysext/backend/Classes/Form/Element/InputSlugElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/InputSlugElement.php @@ -248,7 +248,7 @@ class InputSlugElement extends AbstractFormElement 'includeUidInValues' => $includeUidInValues, ]; $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/SlugElement.js' + '@typo3/backend/form-engine/element/slug-element.js' )->instance('#' . $thisSlugId, $optionsForModule); return $resultArray; } diff --git a/typo3/sysext/backend/Classes/Form/Element/InputTextElement.php b/typo3/sysext/backend/Classes/Form/Element/InputTextElement.php index d2b9384bcf32500548f7a009dbabf936668db855..a516e4078349e4767f0b46604e5fd0c4d8774e64 100644 --- a/typo3/sysext/backend/Classes/Form/Element/InputTextElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/InputTextElement.php @@ -191,14 +191,14 @@ class InputTextElement extends AbstractFormElement $valuePickerHtml[] = '</select>'; $valuePickerHtml[] = '</typo3-formengine-valuepicker>'; - $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/FieldWizard/ValuePicker.js'); + $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-wizard/value-picker.js'); } $valueSliderHtml = []; if (isset($config['slider']) && is_array($config['slider'])) { $id = 'slider-' . $fieldId; $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/FieldWizard/ValueSlider.js' + '@typo3/backend/form-engine/field-wizard/value-slider.js' )->instance($id); $min = $config['range']['lower'] ?? 0; $max = $config['range']['upper'] ?? 10000; diff --git a/typo3/sysext/backend/Classes/Form/Element/MfaInfoElement.php b/typo3/sysext/backend/Classes/Form/Element/MfaInfoElement.php index b7472035f283334915de1f4ca812d3823f45049c..eb59c2735806bf4bdb07313c987e51fb33fd861a 100644 --- a/typo3/sysext/backend/Classes/Form/Element/MfaInfoElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/MfaInfoElement.php @@ -172,7 +172,7 @@ class MfaInfoElement extends AbstractFormElement // JavaScript is not needed in case deactivation is not allowed or no active providers exist if ($isDeactivationAllowed && $activeProviders !== []) { $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/MfaInfoElement.js' + '@typo3/backend/form-engine/element/mfa-info-element.js' )->instance('#' . $fieldId, ['userId' => $userId, 'tableName' => $tableName]); } diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php index e50784d69839a4c19e924b0e36f3f0166767db9f..cec5612eff333f6235b2eb177afc470ee20a223f 100644 --- a/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php @@ -247,7 +247,7 @@ class SelectCheckBoxElement extends AbstractFormElement // Add RequireJS module. This is only needed, in case the element // is not readOnly, since otherwise no checkbox changes take place. $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/SelectCheckBoxElement.js' + '@typo3/backend/form-engine/element/select-check-box-element.js' )->instance($checkboxId); } $html[] = '<tbody>' . implode(LF, $tableRows) . '</tbody>'; @@ -270,7 +270,7 @@ class SelectCheckBoxElement extends AbstractFormElement $html[] = '</div>'; $resultArray['html'] = implode(LF, $html); - $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/Tooltip.js'); + $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('@typo3/backend/tooltip.js'); return $resultArray; } } diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php index 409c5815e94f4101f721e2b18dbb325df81b4e07..26cbbfc98b5f25e5bad5cb6c5cad687565a2836f 100644 --- a/typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php @@ -395,7 +395,7 @@ class SelectMultipleSideBySideElement extends AbstractFormElement $html[] = '</div>'; $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/SelectMultipleSideBySideElement.js' + '@typo3/backend/form-engine/element/select-multiple-side-by-side-element.js' )->instance($selectedOptionsFieldId, $availableOptionsFieldId); $resultArray['html'] = implode(LF, $html); diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php index 347d8095e817ac40cb2c33ac124b3f57eb9db094..91ccc70eb3cec46b4d496542e5a3586ba8b8f208 100644 --- a/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php @@ -259,7 +259,7 @@ class SelectSingleElement extends AbstractFormElement $onFieldChangeItems = $this->getOnFieldChangeItems($parameterArray['fieldChangeFunc'] ?? []); $resultArray['requireJsModules']['selectSingleElement'] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/SelectSingleElement.js' + '@typo3/backend/form-engine/element/select-single-element.js' )->invoke('initializeOnReady', '#' . $selectId, ['onChange' => $onFieldChangeItems]); $resultArray['html'] = implode(LF, $html); diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php index 08a04b6e75056997012b398b7f134351e14ca27c..2b8d98efcd3c2accf0a82e7f083680a28c24714e 100644 --- a/typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php @@ -195,7 +195,7 @@ class SelectTreeElement extends AbstractFormElement $onFieldChangeItems = $this->getOnFieldChangeItems($this->getFieldChangeFuncs()); $resultArray['requireJsModules']['selectTreeElement'] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/SelectTreeElement.js', + '@typo3/backend/form-engine/element/select-tree-element.js', 'SelectTreeElement' )->instance($treeWrapperId, $fieldId, null, $onFieldChangeItems); diff --git a/typo3/sysext/backend/Classes/Form/Element/TextElement.php b/typo3/sysext/backend/Classes/Form/Element/TextElement.php index 9094d3b2af1c7dc99ac6ccdb65c99407358d3d21..596d26774a8f999a3688fda0eb25a68a3ccf0ee0 100644 --- a/typo3/sysext/backend/Classes/Form/Element/TextElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/TextElement.php @@ -211,7 +211,7 @@ class TextElement extends AbstractFormElement $valuePickerHtml[] = '</select>'; $valuePickerHtml[] = '</typo3-formengine-valuepicker>'; - $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/FieldWizard/ValuePicker.js'); + $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-wizard/value-picker.js'); } $fieldControlResult = $this->renderFieldControl(); @@ -311,7 +311,7 @@ class TextElement extends AbstractFormElement } $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/TextElement.js' + '@typo3/backend/form-engine/element/text-element.js' )->instance($fieldId); $resultArray['html'] = '<div class="formengine-field-item t3js-formengine-field-item">' . $fieldInformationHtml . $fullElement . '</div>'; return $resultArray; diff --git a/typo3/sysext/backend/Classes/Form/Element/TextTableElement.php b/typo3/sysext/backend/Classes/Form/Element/TextTableElement.php index ff37745f8c57fd0e03e7e1467a8a3b7600c210d0..4d04b88d8701dd198cce925cbd1baf607555da87 100644 --- a/typo3/sysext/backend/Classes/Form/Element/TextTableElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/TextTableElement.php @@ -230,10 +230,10 @@ class TextTableElement extends AbstractFormElement $html[] = '</div>'; $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/Element/TextTableElement.js' + '@typo3/backend/form-engine/element/text-table-element.js' )->instance($fieldId); - $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/Element/TableWizardElement.js'); + $resultArray['requireJsModules'][] = JavaScriptModuleInstruction::create('@typo3/backend/element/table-wizard-element.js'); $resultArray['additionalInlineLanguageLabelFiles'][] = 'EXT:core/Resources/Private/Language/locallang_wizards.xlf'; $resultArray['html'] = implode(LF, $html); diff --git a/typo3/sysext/backend/Classes/Form/FieldControl/AddRecord.php b/typo3/sysext/backend/Classes/Form/FieldControl/AddRecord.php index 972a962fd7a375e3641680a916f315c87082dff8..a58b6d11b07e78a630ae93bb68a552829935fda3 100644 --- a/typo3/sysext/backend/Classes/Form/FieldControl/AddRecord.php +++ b/typo3/sysext/backend/Classes/Form/FieldControl/AddRecord.php @@ -100,7 +100,7 @@ class AddRecord extends AbstractNode 'href' => (string)$uriBuilder->buildUriFromRoute('wizard_add', $urlParameters), ], 'requireJsModules' => [ - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/FieldControl/AddRecord.js')->instance('#' . $id), + JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-control/add-record.js')->instance('#' . $id), ], ]; } diff --git a/typo3/sysext/backend/Classes/Form/FieldControl/EditPopup.php b/typo3/sysext/backend/Classes/Form/FieldControl/EditPopup.php index 9bbe287bf2a4316ef2494a30cde69bcfcb2a9c0a..0fde6cd2682cef710e2e08f7a04d2125dd0d1577 100644 --- a/typo3/sysext/backend/Classes/Form/FieldControl/EditPopup.php +++ b/typo3/sysext/backend/Classes/Form/FieldControl/EditPopup.php @@ -96,7 +96,7 @@ class EditPopup extends AbstractNode 'data-window-parameters' => $windowOpenParameters, ], 'requireJsModules' => [ - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/FieldControl/EditPopup.js')->instance('#' . $id), + JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-control/edit-popup.js')->instance('#' . $id), ], ]; } diff --git a/typo3/sysext/backend/Classes/Form/FieldControl/InsertClipboard.php b/typo3/sysext/backend/Classes/Form/FieldControl/InsertClipboard.php index e1b5354e416f95565e58241c94e59082983d7c42..1fd27a8fa182d27a3d82c7cc268981c57f60ba36 100644 --- a/typo3/sysext/backend/Classes/Form/FieldControl/InsertClipboard.php +++ b/typo3/sysext/backend/Classes/Form/FieldControl/InsertClipboard.php @@ -75,7 +75,7 @@ class InsertClipboard extends AbstractNode 'data-clipboard-items' => json_encode($dataAttributes['clipboardItems']), ], 'requireJsModules' => [ - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/FieldControl/InsertClipboard.js')->instance('#' . $id), + JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-control/insert-clipboard.js')->instance('#' . $id), ], ]; } diff --git a/typo3/sysext/backend/Classes/Form/FieldControl/LinkPopup.php b/typo3/sysext/backend/Classes/Form/FieldControl/LinkPopup.php index 51eaf8f81becdee7e2d232a7a11e015f2ebaafa1..17940d25fc20e07f27462333634c3f47714899a6 100644 --- a/typo3/sysext/backend/Classes/Form/FieldControl/LinkPopup.php +++ b/typo3/sysext/backend/Classes/Form/FieldControl/LinkPopup.php @@ -83,7 +83,7 @@ class LinkPopup extends AbstractNode 'data-item-name' => htmlspecialchars($itemName), ], 'requireJsModules' => [ - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/FieldControl/LinkPopup.js')->instance('#' . $id), + JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-control/link-popup.js')->instance('#' . $id), ], ]; } diff --git a/typo3/sysext/backend/Classes/Form/FieldControl/ListModule.php b/typo3/sysext/backend/Classes/Form/FieldControl/ListModule.php index 8eda36f4ad60cce9c627e17684cce55689b143ac..717f66f961ca91f2751ce12bbcf957beb112b07c 100644 --- a/typo3/sysext/backend/Classes/Form/FieldControl/ListModule.php +++ b/typo3/sysext/backend/Classes/Form/FieldControl/ListModule.php @@ -102,7 +102,7 @@ class ListModule extends AbstractNode 'href' => (string)$uriBuilder->buildUriFromRoute('wizard_list', $urlParameters), ], 'requireJsModules' => [ - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/FieldControl/ListModule.js')->instance('#' . $id), + JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-control/list-module.js')->instance('#' . $id), ], ]; } diff --git a/typo3/sysext/backend/Classes/Form/FieldControl/ResetSelection.php b/typo3/sysext/backend/Classes/Form/FieldControl/ResetSelection.php index 9782bf12599b285ddb184f840595122a88f7965f..2d2904044e25597a94f46732b820bfd8099e7975 100644 --- a/typo3/sysext/backend/Classes/Form/FieldControl/ResetSelection.php +++ b/typo3/sysext/backend/Classes/Form/FieldControl/ResetSelection.php @@ -62,7 +62,7 @@ class ResetSelection extends AbstractNode 'data-selected-indices' => json_encode($initiallySelectedIndices), ], 'requireJsModules' => [ - JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine/FieldControl/ResetSelection.js')->instance('#' . $id), + JavaScriptModuleInstruction::create('@typo3/backend/form-engine/field-control/reset-selection.js')->instance('#' . $id), ], ]; } diff --git a/typo3/sysext/backend/Classes/Form/FieldWizard/LocalizationStateSelector.php b/typo3/sysext/backend/Classes/Form/FieldWizard/LocalizationStateSelector.php index 48e35be1c58f34380590359d84eaf33113a7b2d6..4843ca588ed003c546474b65a87d7a1114286371 100644 --- a/typo3/sysext/backend/Classes/Form/FieldWizard/LocalizationStateSelector.php +++ b/typo3/sysext/backend/Classes/Form/FieldWizard/LocalizationStateSelector.php @@ -128,7 +128,7 @@ class LocalizationStateSelector extends AbstractNode $html[] = '</div>'; $result['requireJsModules'][] = JavaScriptModuleInstruction::create( - 'TYPO3/CMS/Backend/FormEngine/FieldWizard/LocalizationStateSelector.js' + '@typo3/backend/form-engine/field-wizard/localization-state-selector.js' )->instance($fieldElementName); $result['html'] = implode(LF, $html); return $result; diff --git a/typo3/sysext/backend/Classes/Form/FormResultCompiler.php b/typo3/sysext/backend/Classes/Form/FormResultCompiler.php index 754662d6150c6f7fb11c1572252dfd04e918593b..4f3c1bd01e927b7e5e4983014bfeb97913de76fb 100644 --- a/typo3/sysext/backend/Classes/Form/FormResultCompiler.php +++ b/typo3/sysext/backend/Classes/Form/FormResultCompiler.php @@ -178,12 +178,12 @@ class FormResultCompiler // @todo: this is messy here - "additional hidden fields" should be handled elsewhere $html = implode(LF, $this->hiddenFieldAccum); // load the main module for FormEngine with all important JS functions - $this->requireJsModules[] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngine.js') + $this->requireJsModules[] = JavaScriptModuleInstruction::create('@typo3/backend/form-engine.js') ->invoke( 'initialize', (string)$uriBuilder->buildUriFromRoute('wizard_element_browser') ); - $this->requireJsModules[] = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/FormEngineReview.js'); + $this->requireJsModules[] = JavaScriptModuleInstruction::create('@typo3/backend/form-engine-review.js'); foreach ($this->requireJsModules as $module) { $pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction($module); @@ -200,7 +200,7 @@ class FormResultCompiler } } - $pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/FormEngine/RequestUpdate.js'); + $pageRenderer->loadJavaScriptModule('@typo3/backend/form-engine/request-update.js'); // todo: change these things in JS $pageRenderer->addInlineLanguageLabelArray([ diff --git a/typo3/sysext/backend/Classes/Module/BaseModule.php b/typo3/sysext/backend/Classes/Module/BaseModule.php index 75423953e69d0521e07b62a2e85fa0fb89c60739..4cdd3cd64de34de81313c49de416944f2bf4c720 100644 --- a/typo3/sysext/backend/Classes/Module/BaseModule.php +++ b/typo3/sysext/backend/Classes/Module/BaseModule.php @@ -38,7 +38,7 @@ abstract class BaseModule protected ?ModuleInterface $parentModule = null; protected array $subModules = []; protected bool $standalone = false; - protected string $component = 'TYPO3/CMS/Backend/Module/Iframe'; + protected string $component = '@typo3/backend/module/iframe'; protected string $navigationComponent = ''; protected array $defaultModuleData = []; protected bool $inheritNavigationComponent = true; diff --git a/typo3/sysext/backend/Classes/Routing/PreviewUriBuilder.php b/typo3/sysext/backend/Classes/Routing/PreviewUriBuilder.php index 4f5a50e8a2db8b5dedcf1cea16be20a26eeee9c3..e6534f144a38f996a38b48804f2335ab1e7bf46f 100644 --- a/typo3/sysext/backend/Classes/Routing/PreviewUriBuilder.php +++ b/typo3/sysext/backend/Classes/Routing/PreviewUriBuilder.php @@ -296,7 +296,7 @@ class PreviewUriBuilder return; } $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); - $pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ActionDispatcher.js'); + $pageRenderer->loadJavaScriptModule('@typo3/backend/action-dispatcher.js'); } protected function loadImmediateActionElement(): void @@ -305,7 +305,7 @@ class PreviewUriBuilder return; } $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); - $pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Element/ImmediateActionElement.js'); + $pageRenderer->loadJavaScriptModule('@typo3/backend/element/immediate-action-element.js'); } protected function prefixAttributeNames(string $prefix, array $attributes): array diff --git a/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php b/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php index 44446714eab2085d5bddbf7fb0ed3d16e6bf0261..0b8ad264b91f70756033932af20976e4175819f5 100644 --- a/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php +++ b/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php @@ -246,7 +246,7 @@ class ShortcutButton implements ButtonInterface, PositionInterface } $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); - $pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/CopyToClipboard.js'); + $pageRenderer->loadJavaScriptModule('@typo3/backend/copy-to-clipboard.js'); $pageRenderer->addInlineLanguageLabelFile('EXT:backend/Resources/Private/Language/locallang_copytoclipboard.xlf'); $currentUrl = (string)GeneralUtility::makeInstance(UriBuilder::class)->buildUriFromRoute( diff --git a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php index 367aedab5db9f1f8aff28372969921fcbf43f3b7..172ee68e7b81762a5a654e7272d365fbe07ba5b4 100644 --- a/typo3/sysext/backend/Classes/Template/ModuleTemplate.php +++ b/typo3/sysext/backend/Classes/Template/ModuleTemplate.php @@ -86,11 +86,11 @@ final class ModuleTemplate implements ViewInterface, ResponsableViewInterface $this->docHeaderComponent = GeneralUtility::makeInstance(DocHeaderComponent::class); $this->setUpBasicPageRendererForBackend($pageRenderer, $extensionConfiguration, $request, $this->getLanguageService()); $this->pageRenderer->loadJavaScriptModule('bootstrap'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ContextHelp.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/DocumentHeader.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/GlobalEventHandler.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ActionDispatcher.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Element/ImmediateActionElement.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-help.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/document-header.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/global-event-handler.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/action-dispatcher.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/element/immediate-action-element.js'); } /** @@ -350,7 +350,7 @@ final class ModuleTemplate implements ViewInterface, ResponsableViewInterface */ public function getDynamicTabMenu(array $menuItems, string $domId, int $defaultTabIndex = 1, bool $collapsible = false, bool $wrapContent = true, bool $storeLastActiveTab = true): string { - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tabs.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tabs.js'); $view = GeneralUtility::makeInstance(BackendTemplateView::class); $view->setTemplateRootPaths(['EXT:backend/Resources/Private/Templates']); $view->setPartialRootPaths(['EXT:backend/Resources/Private/Partials']); diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php index 4e6a8e7e0421d83e2de8be0c71531c93ee93928c..5ccfa6c29433171a2b1fa5fd59cf428e778a532f 100644 --- a/typo3/sysext/backend/Classes/View/PageLayoutView.php +++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php @@ -231,7 +231,7 @@ class PageLayoutView implements LoggerAwareInterface $this->pageinfo = BackendUtility::readPageAccess($this->id, '') ?: []; $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); - $pageActionsInstruction = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/PageActions.js'); + $pageActionsInstruction = JavaScriptModuleInstruction::create('@typo3/backend/page-actions.js'); if ($this->isPageEditable()) { $languageOverlayId = 0; $pageLocalizationRecord = BackendUtility::getRecordLocalization('pages', $this->id, (int)$this->tt_contentConfig['sys_language_uid']); diff --git a/typo3/sysext/backend/Configuration/JavaScriptModules.php b/typo3/sysext/backend/Configuration/JavaScriptModules.php index 3c8fdd643f64e73bc96bc9547113ca7437b79a10..a52c8cf153dd6577d4c4675b4b5cf022cdae9f60 100644 --- a/typo3/sysext/backend/Configuration/JavaScriptModules.php +++ b/typo3/sysext/backend/Configuration/JavaScriptModules.php @@ -9,6 +9,6 @@ return [ 'backend.navigation-component', ], 'imports' => [ - 'TYPO3/CMS/Backend/' => 'EXT:backend/Resources/Public/JavaScript/', + '@typo3/backend/' => 'EXT:backend/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/backend/Resources/Private/Layouts/Login.html b/typo3/sysext/backend/Resources/Private/Layouts/Login.html index b52eb13a33443dddc75767656b61c41da242737f..6bd22ed832ab3447752d1c5ce6fcae19696cd489 100644 --- a/typo3/sysext/backend/Resources/Private/Layouts/Login.html +++ b/typo3/sysext/backend/Resources/Private/Layouts/Login.html @@ -6,7 +6,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ 0: 'bootstrap', - 1: 'TYPO3/CMS/Backend/Login.js' + 1: '@typo3/backend/login.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/Backend/Main.html b/typo3/sysext/backend/Resources/Private/Templates/Backend/Main.html index c0c55cab72761cff7b1863aae1bdf37170e8a073..145e272d66d60814ed0cbb8c00886821d0be8e38 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/Backend/Main.html +++ b/typo3/sysext/backend/Resources/Private/Templates/Backend/Main.html @@ -9,20 +9,20 @@ }" includeJavaScriptModules="{ 0: 'bootstrap', - 1: 'TYPO3/CMS/Backend/Module/Router.js', - 2: 'TYPO3/CMS/Backend/ModuleMenu.js', - 3: 'TYPO3/CMS/Backend/JavaScriptModuleImportEventHandler.js', - 4: 'TYPO3/CMS/Backend/Storage/ModuleStateStorage.js', - 5: 'TYPO3/CMS/Backend/Toolbar.js', - 6: 'TYPO3/CMS/Backend/Notification.js', - 7: 'TYPO3/CMS/Backend/Modal.js', - 8: 'TYPO3/CMS/Backend/InfoWindow.js', - 9: 'TYPO3/CMS/Backend/Viewport/ResizableNavigation.js', - 10: 'TYPO3/CMS/Backend/DebugConsole.js', - 11: 'TYPO3/CMS/Backend/ContextMenu.js', - 12: 'TYPO3/CMS/Backend/GlobalEventHandler.js', - 13: 'TYPO3/CMS/Backend/ActionDispatcher.js', - 14: 'TYPO3/CMS/Backend/Element/ImmediateActionElement.js' + 1: '@typo3/backend/module/router.js', + 2: '@typo3/backend/module-menu.js', + 3: '@typo3/backend/java-script-module-import-event-handler.js', + 4: '@typo3/backend/storage/module-state-storage.js', + 5: '@typo3/backend/toolbar.js', + 6: '@typo3/backend/notification.js', + 7: '@typo3/backend/modal.js', + 8: '@typo3/backend/info-window.js', + 9: '@typo3/backend/viewport/resizable-navigation.js', + 10: '@typo3/backend/debug-console.js', + 11: '@typo3/backend/context-menu.js', + 12: '@typo3/backend/global-event-handler.js', + 13: '@typo3/backend/action-dispatcher.js', + 14: '@typo3/backend/element/immediate-action-element.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/Form/EditDocument.html b/typo3/sysext/backend/Resources/Private/Templates/Form/EditDocument.html index 9dd36a9e8da5f9ba544c4ded598a66260819f615..c866197308642672968f78b67c61d5c82cc7948d 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/Form/EditDocument.html +++ b/typo3/sysext/backend/Resources/Private/Templates/Form/EditDocument.html @@ -9,7 +9,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/ContextMenu.js' + 0: '@typo3/backend/context-menu.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/Login/UserPassLoginForm.html b/typo3/sysext/backend/Resources/Private/Templates/Login/UserPassLoginForm.html index 87916f66e0dd1daf3278f60c30a82a40270150bd..24b62c5de8d20911981a8c62dff1e6d22844a866 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/Login/UserPassLoginForm.html +++ b/typo3/sysext/backend/Resources/Private/Templates/Login/UserPassLoginForm.html @@ -8,7 +8,7 @@ <f:section name="loginFormFields"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/UserPassLogin.js' + 0: '@typo3/backend/user-pass-login.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/ModuleTemplate/Collapse.html b/typo3/sysext/backend/Resources/Private/Templates/ModuleTemplate/Collapse.html index 5d5cd9f7f9245dc4f14da7ebf0dd1c40aaaba1f4..1d0061f5a3843d8fb668d87db122a7bcbfcd1d24 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ModuleTemplate/Collapse.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ModuleTemplate/Collapse.html @@ -4,7 +4,7 @@ > <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Tabs.js' + 0: '@typo3/backend/tabs.js' }" /> <div class="panel-group" id="{id}" role="tablist" aria-multiselectable="true"> diff --git a/typo3/sysext/backend/Resources/Private/Templates/ModuleTemplate/Tabs.html b/typo3/sysext/backend/Resources/Private/Templates/ModuleTemplate/Tabs.html index d9565412c29c63ce34343ec0e706a598ce105269..5562df8490fba7f446f014141261100855545cac 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ModuleTemplate/Tabs.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ModuleTemplate/Tabs.html @@ -4,7 +4,7 @@ > <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Tabs.js' + 0: '@typo3/backend/tabs.js' }" /> <f:render partial="ModuleTemplate/Tabs" arguments="{_all}" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/NewContentElement/Wizard.html b/typo3/sysext/backend/Resources/Private/Templates/NewContentElement/Wizard.html index 7ae08dd3452676a55032509783011245934f3e21..80b21ee50243cea2ee01b174989464bbe526c243 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/NewContentElement/Wizard.html +++ b/typo3/sysext/backend/Resources/Private/Templates/NewContentElement/Wizard.html @@ -5,7 +5,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Tabs.js' + 0: '@typo3/backend/tabs.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/Page/NewPages.html b/typo3/sysext/backend/Resources/Private/Templates/Page/NewPages.html index 43df1eef610c06efc082b70944e25755ea883567..20f700962cde3127b97b4b6775dd38dbf35fe203 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/Page/NewPages.html +++ b/typo3/sysext/backend/Resources/Private/Templates/Page/NewPages.html @@ -11,8 +11,8 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0:'TYPO3/CMS/Backend/ContextMenu.js', - 1:'TYPO3/CMS/Backend/NewMultiplePages.js' + 0:'@typo3/backend/context-menu.js', + 1:'@typo3/backend/new-multiple-pages.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/Page/SortSubPages.html b/typo3/sysext/backend/Resources/Private/Templates/Page/SortSubPages.html index 0188e9b13a5db3bbcb005da21b303cace88af8db..a1a1e8c1113f6317d929850f4ce6ce37a22f58c4 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/Page/SortSubPages.html +++ b/typo3/sysext/backend/Resources/Private/Templates/Page/SortSubPages.html @@ -11,9 +11,9 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0:'TYPO3/CMS/Backend/ContextMenu.js', - 1:'TYPO3/CMS/Backend/Modal.js', - 2:'TYPO3/CMS/Backend/Tooltip.js' + 0:'@typo3/backend/context-menu.js', + 1:'@typo3/backend/modal.js', + 2:'@typo3/backend/tooltip.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/PageLayout/PageModule.html b/typo3/sysext/backend/Resources/Private/Templates/PageLayout/PageModule.html index 443eebfdf4925f802d1789bf578b6be7f83c70a1..04b1f08e1be10f5045f4ec83712c0fe865d553ac 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/PageLayout/PageModule.html +++ b/typo3/sysext/backend/Resources/Private/Templates/PageLayout/PageModule.html @@ -9,13 +9,13 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Recordlist/ClearCache.js', - 1: 'TYPO3/CMS/Backend/NewContentElementWizardButton.js', - 2: 'TYPO3/CMS/Backend/ContextMenu.js', - 3: 'TYPO3/CMS/Backend/Tooltip.js', - 4: 'TYPO3/CMS/Backend/Localization.js', - 5: 'TYPO3/CMS/Backend/LayoutModule/DragDrop.js', - 6: 'TYPO3/CMS/Backend/Modal.js' + 0: '@typo3/recordlist/clear-cache.js', + 1: '@typo3/backend/new-content-element-wizard-button.js', + 2: '@typo3/backend/context-menu.js', + 3: '@typo3/backend/tooltip.js', + 4: '@typo3/backend/localization.js', + 5: '@typo3/backend/layout-module/drag-drop.js', + 6: '@typo3/backend/modal.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Edit.html b/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Edit.html index b08fd2d9442d47e35dad23bd871b1c11d0b3ba1c..e4b69359f3b9c21f357a423817c893d5d9fb817b 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Edit.html +++ b/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Edit.html @@ -9,9 +9,9 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/ContextMenu.js', - 1: 'TYPO3/CMS/Backend/Modal.js', - 2: 'TYPO3/CMS/Backend/SiteInlineActions.js' + 0: '@typo3/backend/context-menu.js', + 1: '@typo3/backend/modal.js', + 2: '@typo3/backend/site-inline-actions.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Overview.html b/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Overview.html index 9a8a1c56215c1c8ba778434f83f003ee027b9da9..30ce4eb0dd17f34bb7a5c6c6b531a803a5e95e4a 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Overview.html +++ b/typo3/sysext/backend/Resources/Private/Templates/SiteConfiguration/Overview.html @@ -11,8 +11,8 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/ContextMenu.js', - 1: 'TYPO3/CMS/Backend/Modal.js' + 0: '@typo3/backend/context-menu.js', + 1: '@typo3/backend/modal.js' }" /> diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItem.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItem.html index 18f798235ff404230d9353b073caa3aa17ba190c..ddcc6b199f416a3dde6defeee2c4c16a05112718 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItem.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItem.html @@ -1,7 +1,7 @@ <html xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Toolbar/ClearCacheMenu.js' + 0: '@typo3/backend/toolbar/clear-cache-menu.js' }" /> <f:render partial="ToolbarItems/ToolbarItem" arguments="{ diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemSingle.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemSingle.html index a57755ce1672266142442973e945be437b916960..b57210304f853f9989821d7a769b82e2f770e2cf 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemSingle.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ClearCacheToolbarItemSingle.html @@ -1,7 +1,7 @@ <html xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Toolbar/ClearCacheMenu.js' + 0: '@typo3/backend/toolbar/clear-cache-menu.js' }" /> <a href="{link}" class="toolbar-cache-flush-action toolbar-item-link" title="{f:translate(key: title, default: title)}"> diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/LiveSearchToolbarItem.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/LiveSearchToolbarItem.html index bf44a5abced5298412d8187c8d61205519a0ca2d..3afbfa217ac6d783a480164aac0aec815ddf84e4 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/LiveSearchToolbarItem.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/LiveSearchToolbarItem.html @@ -1,7 +1,7 @@ <html xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Toolbar/LiveSearch.js' + 0: '@typo3/backend/toolbar/live-search.js' }" /> <form class="t3js-topbar-navigation-search toolbar-item-search-form live-search-wrapper" role="search"> diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ShortcutToolbarItemItem.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ShortcutToolbarItemItem.html index 4079c8ef17f985809c38b2556da94183a4bdb9eb..80ed079672ac85322a00f7c29ec02ab6eebe0338 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ShortcutToolbarItemItem.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/ShortcutToolbarItemItem.html @@ -1,7 +1,7 @@ <html xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Toolbar/ShortcutMenu.js' + 0: '@typo3/backend/toolbar/shortcut-menu.js' }" addJsInlineLabels="{ 'bookmark.delete': 'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:toolbarItems.bookmarksDelete', diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/SystemInformationToolbarItem.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/SystemInformationToolbarItem.html index fbd8cccbfb586ddbc28354a0b768ff28f30af370..ccebe1d758848f284d868e8ed19c16b57c3231f1 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/SystemInformationToolbarItem.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/SystemInformationToolbarItem.html @@ -1,7 +1,7 @@ <html xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Toolbar/SystemInformationMenu.js' + 0: '@typo3/backend/toolbar/system-information-menu.js' }" /> <f:render partial="ToolbarItems/ToolbarItem" arguments="{ diff --git a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/UserToolbarItemDropDown.html b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/UserToolbarItemDropDown.html index ca8177d85cd0a78583f488f8446286398d3f9ddf..b3e027a1b1857f81c32ac168fc7c0129021c594f 100644 --- a/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/UserToolbarItemDropDown.html +++ b/typo3/sysext/backend/Resources/Private/Templates/ToolbarItems/UserToolbarItemDropDown.html @@ -5,7 +5,7 @@ > <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/SwitchUser.js' + 0: '@typo3/backend/switch-user.js' }" /> <h3 class="dropdown-headline"> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/DeferredAction.js b/typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/DeferredAction.js deleted file mode 100644 index a120cc267fa72ad6f550c252d49327625e1d6dd0..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/DeferredAction.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{AbstractAction}from"TYPO3/CMS/Backend/ActionButton/AbstractAction.js";import Icons from"TYPO3/CMS/Backend/Icons.js";class DeferredAction extends AbstractAction{async execute(t){return Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(e=>{t.innerHTML=e}),await this.executeCallback()}async executeCallback(){return await this.callback()}}export default DeferredAction; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/ImmediateAction.js b/typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/ImmediateAction.js deleted file mode 100644 index 2452188f3056e81d4c5f22dc3520d599a046fb1e..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/ImmediateAction.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{AbstractAction}from"TYPO3/CMS/Backend/ActionButton/AbstractAction.js";class ImmediateAction extends AbstractAction{execute(){return this.executeCallback()}async executeCallback(){return Promise.resolve(this.callback())}}export default ImmediateAction; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ActionDispatcher.js b/typo3/sysext/backend/Resources/Public/JavaScript/ActionDispatcher.js deleted file mode 100644 index d9d15a58dedcfd95e05f13b55f3add4d9a291f0f..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ActionDispatcher.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import InfoWindow from"TYPO3/CMS/Backend/InfoWindow.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import shortcutMenu from"TYPO3/CMS/Backend/Toolbar/ShortcutMenu.js";import windowManager from"TYPO3/CMS/Backend/WindowManager.js";import moduleMenuApp from"TYPO3/CMS/Backend/ModuleMenu.js";import documentService from"TYPO3/CMS/Core/DocumentService.js";import Utility from"TYPO3/CMS/Backend/Utility.js";class ActionDispatcher{constructor(){this.delegates={},this.createDelegates(),documentService.ready().then(()=>this.registerEvents())}static resolveArguments(e){if(e.dataset.dispatchArgs){const t=e.dataset.dispatchArgs.replace(/"/g,'"'),n=JSON.parse(t);return n instanceof Array?Utility.trimItems(n):null}if(e.dataset.dispatchArgsList){const t=e.dataset.dispatchArgsList.split(",");return Utility.trimItems(t)}return null}static enrichItems(e,t,n){return e.map(e=>e instanceof Object&&e.$event?e.$target?n:e.$event?t:void 0:e)}createDelegates(){this.delegates={"TYPO3.InfoWindow.showItem":InfoWindow.showItem.bind(null),"TYPO3.ShortcutMenu.createShortcut":shortcutMenu.createShortcut.bind(shortcutMenu),"TYPO3.WindowManager.localOpen":windowManager.localOpen.bind(windowManager),"TYPO3.ModuleMenu.showModule":moduleMenuApp.App.showModule.bind(moduleMenuApp.App)}}registerEvents(){new RegularEvent("click",this.handleClickEvent.bind(this)).delegateTo(document,"[data-dispatch-action]")}handleClickEvent(e,t){e.preventDefault(),this.delegateTo(e,t)}delegateTo(e,t){if(t.hasAttribute("data-dispatch-disabled"))return;const n=t.dataset.dispatchAction;let r=ActionDispatcher.resolveArguments(t);r instanceof Array&&(r=r.map(n=>{switch(n){case"{$target}":return t;case"{$event}":return e;default:return n}})),this.delegates[n]&&this.delegates[n].apply(null,r||[])}}export default new ActionDispatcher; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js b/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js deleted file mode 100644 index 5bbcdc930effc7e1f7e3589d176c79bf4afc3a6a..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{BroadcastMessage}from"TYPO3/CMS/Backend/BroadcastMessage.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import $ from"jquery";import BroadcastService from"TYPO3/CMS/Backend/BroadcastService.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";var Identifiers;!function(e){e.hide=".t3js-record-hide",e.delete=".t3js-record-delete",e.icon=".t3js-icon"}(Identifiers||(Identifiers={}));class AjaxDataHandler{static refreshPageTree(){top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}static call(e){return new AjaxRequest(TYPO3.settings.ajaxUrls.record_process).withQueryArguments(e).get().then(async e=>await e.resolve())}constructor(){$(()=>{this.initialize()})}process(e,t){return AjaxDataHandler.call(e).then(e=>{if(e.hasErrors&&this.handleErrors(e),t){const a={...t,hasErrors:e.hasErrors},n=new BroadcastMessage("datahandler","process",a);BroadcastService.post(n);const s=new CustomEvent("typo3:datahandler:process",{detail:{payload:a}});document.dispatchEvent(s)}return e})}initialize(){$(document).on("click",Identifiers.hide,e=>{e.preventDefault();const t=$(e.currentTarget),a=t.find(Identifiers.icon),n=t.closest("tr[data-uid]"),s=t.data("params");this._showSpinnerIcon(a),this.process(s).then(e=>{e.hasErrors||this.toggleRow(n)})}),$(document).on("click",Identifiers.delete,e=>{e.preventDefault();const t=$(e.currentTarget);t.tooltip("hide");Modal.confirm(t.data("title"),t.data("message"),SeverityEnum.warning,[{text:t.data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:t.data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",e=>{"cancel"===e.target.getAttribute("name")?Modal.dismiss():"delete"===e.target.getAttribute("name")&&(Modal.dismiss(),this.deleteRecord(t))})})}toggleRow(e){const t=e.find(Identifiers.hide),a=t.closest("table[data-table]").data("table"),n=t.data("params");let s,i,o;"hidden"===t.data("state")?(i="visible",s=n.replace("=0","=1"),o="actions-edit-hide"):(i="hidden",s=n.replace("=1","=0"),o="actions-edit-unhide"),t.data("state",i).data("params",s),t.one("hidden.bs.tooltip",()=>{const e=t.data("toggleTitle");t.data("toggleTitle",t.attr("data-bs-original-title")).attr("data-bs-original-title",e)}),t.tooltip("hide");const r=t.find(Identifiers.icon);Icons.getIcon(o,Icons.sizes.small).then(e=>{r.replaceWith(e)});const d=e.find(".col-icon "+Identifiers.icon);"hidden"===i?Icons.getIcon("miscellaneous-placeholder",Icons.sizes.small,"overlay-hidden").then(e=>{d.append($(e).find(".icon-overlay"))}):d.find(".icon-overlay").remove(),e.fadeTo("fast",.4,()=>{e.fadeTo("fast",1)}),"pages"===a&&AjaxDataHandler.refreshPageTree()}deleteRecord(e){const t=e.data("params");let a=e.find(Identifiers.icon);this._showSpinnerIcon(a);const n=e.closest("table[data-table]"),s=n.data("table");let i=e.closest("tr[data-uid]");const o=i.data("uid"),r={component:"datahandler",action:"delete",table:s,uid:o};this.process(t,r).then(t=>{if(Icons.getIcon("actions-edit-delete",Icons.sizes.small).then(t=>{a=e.find(Identifiers.icon),a.replaceWith(t)}),!t.hasErrors){const t=e.closest(".panel"),a=t.find(".panel-heading"),r=n.find("[data-l10nparent="+o+"]").closest("tr[data-uid]");if(i=i.add(r),i.fadeTo("slow",.4,()=>{i.slideUp("slow",()=>{i.remove(),0===n.find("tbody tr").length&&t.slideUp("slow")})}),"0"===e.data("l10parent")||""===e.data("l10parent")){const e=Number(a.find(".t3js-table-total-items").html());a.find(".t3js-table-total-items").text(e-1)}"pages"===s&&AjaxDataHandler.refreshPageTree()}})}handleErrors(e){$.each(e.messages,(e,t)=>{Notification.error(t.title,t.message)})}_showSpinnerIcon(e){Icons.getIcon("spinner-circle-dark",Icons.sizes.small).then(t=>{e.replaceWith(t)})}}export default new AjaxDataHandler; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/BroadcastService.js b/typo3/sysext/backend/Resources/Public/JavaScript/BroadcastService.js deleted file mode 100644 index a4348e41144c004bafd8e3ea8ebf3a711642d0ea..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/BroadcastService.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"broadcastchannel.js";import{BroadcastMessage}from"TYPO3/CMS/Backend/BroadcastMessage.js";import{MessageUtility}from"TYPO3/CMS/Backend/Utility/MessageUtility.js";class BroadcastService{constructor(){this.channel=new BroadcastChannel("typo3")}get isListening(){return"function"==typeof this.channel.onmessage}static onMessage(e){if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;const s=BroadcastMessage.fromData(e.data);document.dispatchEvent(s.createCustomEvent("typo3"))}listen(){this.isListening||(this.channel.onmessage=BroadcastService.onMessage)}post(e){this.channel.postMessage(e)}}export default new BroadcastService; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ColumnSelectorButton.js b/typo3/sysext/backend/Resources/Public/JavaScript/ColumnSelectorButton.js deleted file mode 100644 index 92053985394ed9e220605816acbbd4a5072df992..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ColumnSelectorButton.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var ColumnSelectorButton_1,Selectors,SelectorActions,__decorate=function(e,t,o,l){var r,n=arguments.length,c=n<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,o):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,l);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(c=(n<3?r(c):n>3?r(t,o,c):r(t,o))||c);return n>3&&c&&Object.defineProperty(t,o,c),c};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Notification from"TYPO3/CMS/Backend/Notification.js";!function(e){e.columnsSelector=".t3js-column-selector",e.columnsContainerSelector=".t3js-column-selector-container",e.columnsFilterSelector='input[name="columns-filter"]',e.columnsSelectorActionsSelector=".t3js-column-selector-actions"}(Selectors||(Selectors={})),function(e){e.toggle="select-toggle",e.all="select-all",e.none="select-none"}(SelectorActions||(SelectorActions={}));let ColumnSelectorButton=ColumnSelectorButton_1=class extends LitElement{constructor(){super(),this.title="Show columns",this.ok=lll("button.ok")||"Update",this.close=lll("button.close")||"Close",this.error="Could not update columns",this.addEventListener("click",e=>{e.preventDefault(),this.showColumnSelectorModal()})}static toggleSelectorActions(e,t,o,l=!1){t.classList.add("disabled");for(let o=0;o<e.length;o++)if(!e[o].disabled&&!e[o].checked&&(l||!ColumnSelectorButton_1.isColumnHidden(e[o]))){t.classList.remove("disabled");break}o.classList.add("disabled");for(let t=0;t<e.length;t++)if(!e[t].disabled&&e[t].checked&&(l||!ColumnSelectorButton_1.isColumnHidden(e[t]))){o.classList.remove("disabled");break}}static isColumnHidden(e){return e.closest(Selectors.columnsContainerSelector)?.classList.contains("hidden")}static filterColumns(e,t){t.forEach(t=>{const o=t.closest(Selectors.columnsContainerSelector);if(!t.disabled&&null!==o){const t=o.querySelector(".form-check-label-text")?.textContent;t&&t.length&&o.classList.toggle("hidden",""!==e.value&&!RegExp(e.value,"i").test(t.trim().replace(/\[\]/g,"").replace(/\s+/g," ")))}})}render(){return html`<slot></slot>`}showColumnSelectorModal(){this.url&&this.target&&Modal.advanced({content:this.url,title:this.title,severity:SeverityEnum.notice,size:Modal.sizes.medium,type:Modal.types.ajax,buttons:[{text:this.close,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>Modal.dismiss()},{text:this.ok,btnClass:"btn-"+Severity.getCssClass(SeverityEnum.info),name:"update",trigger:()=>this.proccessSelection(Modal.currentModal[0])}],ajaxCallback:()=>this.handleModalContentLoaded(Modal.currentModal[0])})}proccessSelection(e){const t=e.querySelector("form");null!==t?new AjaxRequest(TYPO3.settings.ajaxUrls.show_columns).post("",{body:new FormData(t)}).then(async e=>{const t=await e.resolve();!0===t.success?(this.ownerDocument.location.href=this.target,this.ownerDocument.location.reload()):Notification.error(t.message||"No update was performed"),Modal.dismiss()}).catch(()=>{this.abortSelection()}):this.abortSelection()}handleModalContentLoaded(e){const t=e.querySelector("form");if(null===t)return;t.addEventListener("submit",e=>{e.preventDefault()});const o=e.querySelectorAll(Selectors.columnsSelector),l=e.querySelector(Selectors.columnsFilterSelector),r=e.querySelector(Selectors.columnsSelectorActionsSelector),n=r.querySelector('button[data-action="'+SelectorActions.all+'"]'),c=r.querySelector('button[data-action="'+SelectorActions.none+'"]');o.length&&null!==l&&null!==n&&null!==c&&(ColumnSelectorButton_1.toggleSelectorActions(o,n,c,!0),o.forEach(e=>{e.addEventListener("change",()=>{ColumnSelectorButton_1.toggleSelectorActions(o,n,c)})}),l.addEventListener("keydown",e=>{const t=e.target;"Escape"===e.code&&(e.stopImmediatePropagation(),t.value="")}),l.addEventListener("keyup",e=>{ColumnSelectorButton_1.filterColumns(e.target,o),ColumnSelectorButton_1.toggleSelectorActions(o,n,c)}),l.addEventListener("search",e=>{ColumnSelectorButton_1.filterColumns(e.target,o),ColumnSelectorButton_1.toggleSelectorActions(o,n,c)}),r.querySelectorAll("button[data-action]").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault();const t=e.currentTarget;if(t.dataset.action){switch(t.dataset.action){case SelectorActions.toggle:o.forEach(e=>{e.disabled||ColumnSelectorButton_1.isColumnHidden(e)||(e.checked=!e.checked)});break;case SelectorActions.all:o.forEach(e=>{e.disabled||ColumnSelectorButton_1.isColumnHidden(e)||(e.checked=!0)});break;case SelectorActions.none:o.forEach(e=>{e.disabled||ColumnSelectorButton_1.isColumnHidden(e)||(e.checked=!1)});break;default:Notification.warning("Unknown selector action")}ColumnSelectorButton_1.toggleSelectorActions(o,n,c)}})}))}abortSelection(){Notification.error(this.error),Modal.dismiss()}};__decorate([property({type:String})],ColumnSelectorButton.prototype,"url",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"target",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"title",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"ok",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"close",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"error",void 0),ColumnSelectorButton=ColumnSelectorButton_1=__decorate([customElement("typo3-backend-column-selector-button")],ColumnSelectorButton); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js b/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js deleted file mode 100644 index e6dd66c68296635bc584fa749a57aff6c1d93e14..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Popover from"TYPO3/CMS/Backend/Popover.js";class ContextHelp{constructor(){this.ajaxUrl=TYPO3.settings.ajaxUrls.context_help,this.trigger="click",this.placement="auto",this.selector=".help-link",this.initialize()}static resolveBackend(){return void 0!==window.opener&&null!==window.opener?window.opener.top:top}initialize(){const t=ContextHelp.resolveBackend();void 0!==t.TYPO3.settings.ContextHelp&&(this.helpModuleUrl=t.TYPO3.settings.ContextHelp.moduleUrl),void 0===TYPO3.ShortcutMenu&&void 0===t.TYPO3.ShortcutMenu&&$(".icon-actions-system-shortcut-new").closest(".btn").hide();let e=" ";void 0!==t.TYPO3.lang&&(e=t.TYPO3.lang.csh_tooltip_loading);const o=$(this.selector);o.attr("data-loaded","false").attr("data-bs-html","true").attr("data-bs-original-title",e).attr("data-bs-placement",this.placement).attr("data-bs-trigger",this.trigger),Popover.popover(o),$(document).on("show.bs.popover",this.selector,t=>{const e=$(t.currentTarget),o=e.data("description");if(void 0!==o&&""!==o){const t={title:e.data("title")||"",content:o};Popover.setOptions(e,t)}else"false"===e.attr("data-loaded")&&e.data("table")&&this.loadHelp(e);e.closest(".t3js-module-docheader").length&&Popover.setOption(e,"placement","bottom")}).on("click",".help-has-link",t=>{$(".popover").each((e,o)=>{const a=$(o);a.has(t.target).length&&this.showHelpPopup($('[aria-describedby="'+a.attr("id")+'"]'))})}).on("click","body",t=>{$(this.selector).each((e,o)=>{const a=$(o);a.is(t.target)||0!==a.has(t.target).length||0!==$(".popover").has(t.target).length||Popover.hide(a)})})}showHelpPopup(t){try{const e=window.open(this.helpModuleUrl+"&table="+t.data("table")+"&field="+t.data("field")+"&action=detail","ContextHelpWindow","height=400,width=600,status=0,menubar=0,scrollbars=1");return e.focus(),Popover.hide(t),e}catch{}}loadHelp(t){const e=t.data("table"),o=t.data("field");e&&new AjaxRequest(this.ajaxUrl).withQueryArguments({params:{action:"getContextHelp",table:e,field:o}}).get().then(async e=>{const o=await e.resolve(),a={title:o.title||"",content:o.content||"<p></p>"};Popover.setOptions(t,a),Popover.update(t),t.attr("data-loaded","true")})}}export default new ContextHelp; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ContextMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/ContextMenu.js deleted file mode 100644 index c34537669dc7edd9625b75e20d0b22f04aec6396..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ContextMenu.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import ContextMenuActions from"TYPO3/CMS/Backend/ContextMenuActions.js";import DebounceEvent from"TYPO3/CMS/Core/Event/DebounceEvent.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import ThrottleEvent from"TYPO3/CMS/Core/Event/ThrottleEvent.js";class ContextMenu{constructor(){this.mousePos={X:null,Y:null},this.record={uid:null,table:null},this.eventSources=[],this.storeMousePositionEvent=t=>{this.mousePos={X:t.pageX,Y:t.pageY}},$(document).on("click contextmenu",".t3js-contextmenutrigger",t=>{const e=$(t.currentTarget);e.prop("onclick")&&"click"===t.type||(t.preventDefault(),this.show(e.data("table"),e.data("uid"),e.data("context"),e.data("iteminfo"),e.data("parameters"),t.target))}),new ThrottleEvent("mousemove",this.storeMousePositionEvent.bind(this),50).bindTo(document)}static drawActionItem(t){const e=t.additionalAttributes||{};let n="";for(const t of Object.entries(e)){const[e,s]=t;n+=" "+e+'="'+s+'"'}return'<li role="menuitem" class="list-group-item" tabindex="-1" data-callback-action="'+t.callbackAction+'"'+n+'><span class="list-group-item-icon">'+t.icon+"</span> "+t.label+"</li>"}static within(t,e,n){const s=t.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop,r=e>=s.left+o&&e<=s.left+o+s.width,a=n>=s.top+i&&n<=s.top+i+s.height;return r&&a}show(t,e,n,s,o,i=null){this.hideAll(),this.record={table:t,uid:e};const r=i.matches("a, button, [tabindex]")?i:i.closest("a, button, [tabindex]");this.eventSources.push(r);let a="";void 0!==t&&(a+="table="+encodeURIComponent(t)),void 0!==e&&(a+=(a.length>0?"&":"")+"uid="+e),void 0!==n&&(a+=(a.length>0?"&":"")+"context="+n),void 0!==s&&(a+=(a.length>0?"&":"")+"enDisItems="+s),void 0!==o&&(a+=(a.length>0?"&":"")+"addParams="+o),this.fetch(a)}initializeContextMenuContainer(){if(0===$("#contentMenu0").length){const t='<div id="contentMenu0" class="context-menu" style="display: none;"></div><div id="contentMenu1" class="context-menu" data-parent="#contentMenu0" style="display: none;"></div>';$("body").append(t),document.querySelectorAll(".context-menu").forEach(t=>{new RegularEvent("mouseenter",t=>{t.target;this.storeMousePositionEvent(t)}).bindTo(t),new DebounceEvent("mouseleave",t=>{const e=t.target,n=document.querySelector('[data-parent="#'+e.id+'"]');if(!ContextMenu.within(e,this.mousePos.X,this.mousePos.Y)&&(null===n||null===n.offsetParent)){let t;this.hide("#"+e.id),void 0!==e.dataset.parent&&null!==(t=document.querySelector(e.dataset.parent))&&(ContextMenu.within(t,this.mousePos.X,this.mousePos.Y)||this.hide(e.dataset.parent))}},500).bindTo(t)})}}fetch(t){const e=TYPO3.settings.ajaxUrls.contextmenu;new AjaxRequest(e).withQueryArguments(t).get().then(async t=>{const e=await t.resolve();void 0!==t&&Object.keys(t).length>0&&this.populateData(e,0)})}populateData(t,e){this.initializeContextMenuContainer();const n=$("#contentMenu"+e);if(n.length&&(0===e||$("#contentMenu"+(e-1)).is(":visible"))){const s=this.drawMenu(t,e);n.html('<ul class="list-group" role="menu">'+s+"</ul>"),$("li.list-group-item",n).on("click",t=>{t.preventDefault();const n=$(t.currentTarget);if(n.hasClass("list-group-item-submenu"))return void this.openSubmenu(e,n,!1);const s=n.data("callback-action"),o=n.data("callback-module");n.data("callback-module")?import(o+".js").then(({default:t})=>{t[s].bind(n)(this.record.table,this.record.uid)}):ContextMenuActions&&"function"==typeof ContextMenuActions[s]?ContextMenuActions[s].bind(n)(this.record.table,this.record.uid):console.log("action: "+s+" not found"),this.hideAll()}),$("li.list-group-item",n).on("keydown",t=>{const n=$(t.currentTarget);switch(t.key){case"Down":case"ArrowDown":this.setFocusToNextItem(n.get(0));break;case"Up":case"ArrowUp":this.setFocusToPreviousItem(n.get(0));break;case"Right":case"ArrowRight":if(!n.hasClass("list-group-item-submenu"))return;this.openSubmenu(e,n,!0);break;case"Home":this.setFocusToFirstItem(n.get(0));break;case"End":this.setFocusToLastItem(n.get(0));break;case"Enter":case"Space":n.click();break;case"Esc":case"Escape":case"Left":case"ArrowLeft":this.hide("#"+n.parents(".context-menu").first().attr("id"));break;case"Tab":this.hideAll();break;default:return}t.preventDefault()}),n.css(this.getPosition(n,!1)).show(),$("li.list-group-item[tabindex=-1]",n).first().focus()}}setFocusToPreviousItem(t){let e=this.getItemBackward(t.previousElementSibling);e||(e=this.getLastItem(t)),e.focus()}setFocusToNextItem(t){let e=this.getItemForward(t.nextElementSibling);e||(e=this.getFirstItem(t)),e.focus()}setFocusToFirstItem(t){let e=this.getFirstItem(t);e&&e.focus()}setFocusToLastItem(t){let e=this.getLastItem(t);e&&e.focus()}getItemBackward(t){for(;t&&(!t.classList.contains("list-group-item")||"-1"!==t.getAttribute("tabindex"));)t=t.previousElementSibling;return t}getItemForward(t){for(;t&&(!t.classList.contains("list-group-item")||"-1"!==t.getAttribute("tabindex"));)t=t.nextElementSibling;return t}getFirstItem(t){return this.getItemForward(t.parentElement.firstElementChild)}getLastItem(t){return this.getItemBackward(t.parentElement.lastElementChild)}openSubmenu(t,e,n){this.eventSources.push(e[0]);const s=$("#contentMenu"+(t+1)).html("");e.next().find(".list-group").clone(!0).appendTo(s),s.css(this.getPosition(s,n)).show(),$(".list-group-item[tabindex=-1]",s).first().focus()}getPosition(t,e){let n=0,s=0;if(this.eventSources.length&&(null===this.mousePos.X||e)){const t=this.eventSources[this.eventSources.length-1].getBoundingClientRect();n=this.eventSources.length>1?t.right:t.x,s=t.y}else n=this.mousePos.X-1,s=this.mousePos.Y-1;const o=$(window).width()-20,i=$(window).height(),r=t.width(),a=t.height(),l=n-$(document).scrollLeft(),u=s-$(document).scrollTop();return i-a<u&&(u>a?s-=a-10:s+=i-a-u),o-r<l&&(l>r?n-=r-10:o-r-l<$(document).scrollLeft()?n=$(document).scrollLeft():n+=o-r-l),{left:n+"px",top:s+"px"}}drawMenu(t,e){let n="";for(const s of Object.values(t))if("item"===s.type)n+=ContextMenu.drawActionItem(s);else if("divider"===s.type)n+='<li role="separator" class="list-group-item list-group-item-divider"></li>';else if("submenu"===s.type||s.childItems){n+='<li role="menuitem" aria-haspopup="true" class="list-group-item list-group-item-submenu" tabindex="-1"><span class="list-group-item-icon">'+s.icon+"</span> "+s.label+' <span class="fa fa-caret-right"></span></li>';n+='<div class="context-menu contentMenu'+(e+1)+'" style="display:none;"><ul role="menu" class="list-group">'+this.drawMenu(s.childItems,1)+"</ul></div>"}return n}hide(t){$(t).hide();const e=this.eventSources.pop();e&&$(e).focus()}hideAll(){this.hide("#contentMenu0"),this.hide("#contentMenu1")}}export default new ContextMenu; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ContextMenuActions.js b/typo3/sysext/backend/Resources/Public/JavaScript/ContextMenuActions.js deleted file mode 100644 index bfbd84a41f696eb33d51d68ad50c34b32f183939..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ContextMenuActions.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import $ from"jquery";import AjaxDataHandler from"TYPO3/CMS/Backend/AjaxDataHandler.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import InfoWindow from"TYPO3/CMS/Backend/InfoWindow.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import ModuleMenu from"TYPO3/CMS/Backend/ModuleMenu.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import Viewport from"TYPO3/CMS/Backend/Viewport.js";import{ModuleStateStorage}from"TYPO3/CMS/Backend/Storage/ModuleStateStorage.js";import{NewContentElementWizard}from"TYPO3/CMS/Backend/NewContentElementWizard.js";class ContextMenuActions{static getReturnUrl(){return encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search)}static editRecord(t,e){let n="",o=$(this).data("pages-language-uid");o&&(n="&overrideVals[pages][sys_language_uid]="+o),Viewport.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"]["+e+"]=edit"+n+"&returnUrl="+ContextMenuActions.getReturnUrl())}static viewRecord(){const t=$(this).data("preview-url");if(t){window.open(t,"newTYPO3frontendWindow").focus()}}static openInfoPopUp(t,e){InfoWindow.showItem(t,e)}static mountAsTreeRoot(t,e){if("pages"===t){const t=new CustomEvent("typo3:pagetree:mountPoint",{detail:{pageId:e}});top.document.dispatchEvent(t)}}static newPageWizard(t,e){const n=$(this).data("pages-new-wizard-url");Viewport.ContentContainer.setUrl(n+"&returnUrl="+ContextMenuActions.getReturnUrl())}static newContentWizard(){const t=$(this);let e=t.data("new-wizard-url");e&&(e+="&returnUrl="+ContextMenuActions.getReturnUrl(),Modal.advanced({title:t.data("title"),type:Modal.types.ajax,size:Modal.sizes.medium,content:e,severity:SeverityEnum.notice,ajaxCallback:()=>{const t=Modal.currentModal.get(0);t&&t.querySelector(".t3-new-content-element-wizard-inner")&&new NewContentElementWizard(t)}}))}static newRecord(t,e){Viewport.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"]["+("pages"!==t?"-":"")+e+"]=new&returnUrl="+ContextMenuActions.getReturnUrl())}static openHistoryPopUp(t,e){Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordHistory.moduleUrl+"&element="+t+":"+e+"&returnUrl="+ContextMenuActions.getReturnUrl())}static openListModule(t,e){const n="pages"===t?e:$(this).data("page-uid");ModuleMenu.App.showModule("web_list","id="+n)}static pagesSort(){const t=$(this).data("pages-sort-url");t&&Viewport.ContentContainer.setUrl(t)}static pagesNewMultiple(){const t=$(this).data("pages-new-multiple-url");t&&Viewport.ContentContainer.setUrl(t)}static disableRecord(t,e){const n=$(this).data("disable-field")||"hidden";Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+e+"]["+n+"]=1&redirect="+ContextMenuActions.getReturnUrl()).done(()=>{ContextMenuActions.refreshPageTree()})}static enableRecord(t,e){const n=$(this).data("disable-field")||"hidden";Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+e+"]["+n+"]=0&redirect="+ContextMenuActions.getReturnUrl()).done(()=>{ContextMenuActions.refreshPageTree()})}static showInMenus(t,e){Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+e+"][nav_hide]=0&redirect="+ContextMenuActions.getReturnUrl()).done(()=>{ContextMenuActions.refreshPageTree()})}static hideInMenus(t,e){Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+e+"][nav_hide]=1&redirect="+ContextMenuActions.getReturnUrl()).done(()=>{ContextMenuActions.refreshPageTree()})}static deleteRecord(t,e){const n=$(this);Modal.confirm(n.data("title"),n.data("message"),SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",n=>{if("delete"===n.target.getAttribute("name")){const n={component:"contextmenu",action:"delete",table:t,uid:e};AjaxDataHandler.process("cmd["+t+"]["+e+"][delete]=1",n).then(()=>{"pages"===t?(ModuleStateStorage.current("web").identifier===e.toString()&&top.document.dispatchEvent(new CustomEvent("typo3:pagetree:selectFirstNode")),ContextMenuActions.refreshPageTree()):"tt_content"===t&&Viewport.ContentContainer.refresh()})}Modal.dismiss()})}static copy(t,e){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+e+"]=1&CB[setCopyMode]=1";new AjaxRequest(n).get().finally(()=>{ContextMenuActions.triggerRefresh(Viewport.ContentContainer.get().location.href)})}static clipboardRelease(t,e){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+e+"]=0";new AjaxRequest(n).get().finally(()=>{ContextMenuActions.triggerRefresh(Viewport.ContentContainer.get().location.href)})}static cut(t,e){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+e+"]=1&CB[setCopyMode]=0";new AjaxRequest(n).get().finally(()=>{ContextMenuActions.triggerRefresh(Viewport.ContentContainer.get().location.href)})}static triggerRefresh(t){t.includes("record%2Fedit")||Viewport.ContentContainer.refresh()}static clearCache(t,e){new AjaxRequest(TYPO3.settings.ajaxUrls.web_list_clearpagecache).withQueryArguments({id:e}).get({cache:"no-cache"}).then(async t=>{const e=await t.resolve();!0===e.success?Notification.success(e.title,e.message,1):Notification.error(e.title,e.message,1)},()=>{Notification.error("Clearing page caches went wrong on the server side.")})}static pasteAfter(t,e){ContextMenuActions.pasteInto.bind($(this))(t,-e)}static pasteInto(t,e){const n=$(this),o=()=>{const n="&CB[paste]="+t+"%7C"+e+"&CB[pad]=normal&redirect="+ContextMenuActions.getReturnUrl();Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+n).done(()=>{"pages"===t&&ContextMenuActions.refreshPageTree()})};if(!n.data("title"))return void o();Modal.confirm(n.data("title"),n.data("message"),SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-warning",name:"ok"}]).on("button.clicked",t=>{"ok"===t.target.getAttribute("name")&&o(),Modal.dismiss()})}static refreshPageTree(){top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}}export default ContextMenuActions; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/CopyToClipboard.js b/typo3/sysext/backend/Resources/Public/JavaScript/CopyToClipboard.js deleted file mode 100644 index 84a1ac3ebb61db96d1fbccdccd843fbd519fc1de..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/CopyToClipboard.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var __decorate=function(o,t,e,r){var i,c=arguments.length,l=c<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(o,t,e,r);else for(var p=o.length-1;p>=0;p--)(i=o[p])&&(l=(c<3?i(l):c>3?i(t,e,l):i(t,e))||l);return c>3&&l&&Object.defineProperty(t,e,l),l};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";let CopyToClipboard=class extends LitElement{constructor(){super(),this.addEventListener("click",o=>{o.preventDefault(),this.copyToClipboard()})}render(){return html`<slot></slot>`}copyToClipboard(){if("string"!=typeof this.text||!this.text.length)return console.warn("No text for copy to clipboard given."),void Notification.error(lll("copyToClipboard.error"));if(navigator.clipboard)navigator.clipboard.writeText(this.text).then(()=>{Notification.success(lll("copyToClipboard.success"),"",1)}).catch(()=>{Notification.error(lll("copyToClipboard.error"))});else{const o=document.createElement("textarea");o.value=this.text,document.body.appendChild(o),o.focus(),o.select();try{document.execCommand("copy")?Notification.success(lll("copyToClipboard.success"),"",1):Notification.error(lll("copyToClipboard.error"))}catch(o){Notification.error(lll("copyToClipboard.error"))}document.body.removeChild(o)}}};__decorate([property({type:String})],CopyToClipboard.prototype,"text",void 0),CopyToClipboard=__decorate([customElement("typo3-copy-to-clipboard")],CopyToClipboard); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/DateTimePicker.js b/typo3/sysext/backend/Resources/Public/JavaScript/DateTimePicker.js deleted file mode 100644 index 2dcb21cf23e49b7b00c5bb396e4e75e1fa50c485..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/DateTimePicker.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import flatpickr from"flatpickr/flatpickr.min.js";import moment from"moment";import PersistentStorage from"TYPO3/CMS/Backend/Storage/Persistent.js";import ThrottleEvent from"TYPO3/CMS/Core/Event/ThrottleEvent.js";class DateTimePicker{constructor(){this.format=(void 0!==opener?.top?.TYPO3?opener.top:top).TYPO3.settings.DateTimePicker.DateFormat}static formatDateForHiddenField(e,t){return"time"!==t&&"timesec"!==t||e.year(1970).month(0).date(1),e.format()}initialize(e){if(!(e instanceof HTMLInputElement)||void 0!==e.dataset.datepickerInitialized)return;let t=PersistentStorage.get("lang");""===t?t="default":"ch"===t&&(t="zh"),e.dataset.datepickerInitialized="1",import("flatpickr/locales.js").then(()=>{this.initializeField(e,t)})}initializeField(e,t){const a=this.getScrollEvent(),n=this.getDateOptions(e);n.locale=t,n.onOpen=[()=>{a.bindTo(document.querySelector(".t3js-module-body"))}],n.onClose=()=>{a.release()};const r=flatpickr(e,n);e.addEventListener("input",()=>{const e=r._input.value,t=r.parseDate(e);e===r.formatDate(t,r.config.dateFormat)&&r.setDate(e)}),e.addEventListener("change",t=>{t.stopImmediatePropagation();const a=t.target,n=e.parentElement.parentElement.querySelector('input[type="hidden"]');if(""!==a.value){const e=a.dataset.dateType,t=moment.utc(a.value,a._flatpickr.config.dateFormat);t.isValid()?n.value=DateTimePicker.formatDateForHiddenField(t,e):a.value=DateTimePicker.formatDateForHiddenField(moment.utc(n.value),e)}else n.value="";a.dispatchEvent(new Event("formengine.dp.change"))})}getScrollEvent(){return new ThrottleEvent("scroll",()=>{const e=document.querySelector(".flatpickr-input.active");if(null===e)return;const t=e.getBoundingClientRect(),a=e._flatpickr.calendarContainer.offsetHeight;let n,r;window.innerHeight-t.bottom<a&&t.top>a?(n=t.y-a-2,r="arrowBottom"):(n=t.y+t.height+2,r="arrowTop"),e._flatpickr.calendarContainer.style.top=n+"px",e._flatpickr.calendarContainer.classList.remove("arrowBottom","arrowTop"),e._flatpickr.calendarContainer.classList.add(r)},15)}getDateOptions(e){const t=this.format,a=e.dataset.dateType,n={allowInput:!0,dateFormat:"",defaultDate:e.value,enableSeconds:!1,enableTime:!1,formatDate:(e,t)=>moment(e).format(t),parseDate:(e,t)=>moment(e,t,!0).toDate(),maxDate:"",minDate:"",minuteIncrement:1,noCalendar:!1,weekNumbers:!0};switch(a){case"datetime":n.dateFormat=t[1],n.enableTime=!0;break;case"date":n.dateFormat=t[0];break;case"time":n.dateFormat="HH:mm",n.enableTime=!0,n.noCalendar=!0;break;case"timesec":n.dateFormat="HH:mm:ss",n.enableSeconds=!0,n.enableTime=!0,n.noCalendar=!0;break;case"year":n.dateFormat="Y"}return"undefined"!==e.dataset.dateMindate&&(n.minDate=e.dataset.dateMindate),"undefined"!==e.dataset.dateMaxdate&&(n.maxDate=e.dataset.dateMaxdate),n}}export default new DateTimePicker; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/DocumentHeader.js b/typo3/sysext/backend/Resources/Public/JavaScript/DocumentHeader.js deleted file mode 100644 index 786027e08f6f7d3a4f47298252952a52967eb87f..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/DocumentHeader.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import ThrottleEvent from"TYPO3/CMS/Core/Event/ThrottleEvent.js";class DocumentHeader{constructor(){this.documentHeader=null,this.direction="down",this.reactionRange=300,this.lastPosition=0,this.currentPosition=0,this.changedPosition=0,this.settings={margin:24,offset:100,selectors:{moduleDocumentHeader:".t3js-module-docheader",moduleSearchBar:".t3js-module-docheader-bar-search"}},this.scroll=t=>{this.currentPosition=t.target.scrollTop,this.currentPosition>this.lastPosition?"down"!==this.direction&&(this.direction="down",this.changedPosition=this.currentPosition):this.currentPosition<this.lastPosition&&"up"!==this.direction&&(this.direction="up",this.changedPosition=this.currentPosition),"up"===this.direction&&this.changedPosition-this.reactionRange<this.currentPosition&&this.documentHeader.classList.remove("module-docheader-folded"),"down"===this.direction&&this.changedPosition+this.reactionRange<this.currentPosition&&this.documentHeader.classList.add("module-docheader-folded"),this.lastPosition=this.currentPosition},DocumentService.ready().then(()=>{if(this.documentHeader=document.querySelector(this.settings.selectors.moduleDocumentHeader),null===this.documentHeader)return;const t=this.documentHeader.parentElement;new ThrottleEvent("scroll",this.scroll,100).bindTo(t)})}}export default new DocumentHeader; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/DocumentSaveActions.js b/typo3/sysext/backend/Resources/Public/JavaScript/DocumentSaveActions.js deleted file mode 100644 index 394c2906d7881a87dea12267c95927697b942841..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/DocumentSaveActions.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Icons from"TYPO3/CMS/Backend/Icons.js";class DocumentSaveActions{constructor(){this.preSubmitCallbacks=[],$(()=>{this.initializeSaveHandling()})}static getInstance(){return null===DocumentSaveActions.instance&&(DocumentSaveActions.instance=new DocumentSaveActions),DocumentSaveActions.instance}addPreSubmitCallback(t){if("function"!=typeof t)throw"callback must be a function.";this.preSubmitCallbacks.push(t)}initializeSaveHandling(){let t=!1;const e=["button[form]",'button[name^="_save"]','a[data-name^="_save"]','button[name="CMD"][value^="save"]','a[data-name="CMD"][data-value^="save"]'].join(",");$(".t3js-module-docheader").on("click",e,e=>{if(!t){t=!0;const a=$(e.currentTarget),n=a.attr("form")||a.attr("data-form")||null,r=n?$("#"+n):a.closest("form"),i=a.data("name")||e.currentTarget.getAttribute("name"),o=a.data("value")||e.currentTarget.getAttribute("value"),s=$("<input />").attr("type","hidden").attr("name",i).attr("value",o);for(let a of this.preSubmitCallbacks)if(a(e),e.isPropagationStopped())return t=!1,!1;r.append(s),r.on("submit",()=>{if(r.find(".has-error").length>0)return t=!1,!1;let e;const n=a.closest(".t3js-splitbutton");return n.length>0?(n.find("button").prop("disabled",!0),e=n.children().first()):(a.prop("disabled",!0),e=a),Icons.getIcon("spinner-circle-dark",Icons.sizes.small).then(t=>{e.find(".t3js-icon").replaceWith(t)}).catch(t=>{}),!0}),"A"!==e.currentTarget.tagName&&!a.attr("form")||e.isDefaultPrevented()||(r.find('[name="doSave"]').val("1"),r.trigger("submit"),e.preventDefault())}return!0})}}DocumentSaveActions.instance=null;export default DocumentSaveActions; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js b/typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js deleted file mode 100644 index 2951aa028c00f7d26001517b8924130508cf34f9..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import moment from"moment";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import{MessageUtility}from"TYPO3/CMS/Backend/Utility/MessageUtility.js";import NProgress from"nprogress";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import ImmediateAction from"TYPO3/CMS/Backend/ActionButton/ImmediateAction.js";import Md5 from"TYPO3/CMS/Backend/Hashing/Md5.js";var Action;!function(e){e.OVERRIDE="replace",e.RENAME="rename",e.SKIP="cancel",e.USE_EXISTING="useExisting"}(Action||(Action={}));class DragUploaderPlugin{constructor(e){this.askForOverride=[],this.percentagePerFile=1,this.hideDropzone=e=>{e.stopPropagation(),e.preventDefault(),this.$dropzone.hide(),this.$dropzone.removeClass("drop-status-ok"),this.manuallyTriggered=!1},this.dragFileIntoDocument=e=>(e.stopPropagation(),e.preventDefault(),$(e.currentTarget).addClass("drop-in-progress"),this.$element.get(0)?.offsetParent&&this.showDropzone(),!1),this.dragAborted=e=>(e.stopPropagation(),e.preventDefault(),$(e.currentTarget).removeClass("drop-in-progress"),!1),this.ignoreDrop=e=>(e.stopPropagation(),e.preventDefault(),this.dragAborted(e),!1),this.handleDrop=e=>{this.ignoreDrop(e),this.hideDropzone(e),this.processFiles(e.originalEvent.dataTransfer.files)},this.fileInDropzone=()=>{this.$dropzone.addClass("drop-status-ok")},this.fileOutOfDropzone=()=>{this.$dropzone.removeClass("drop-status-ok"),this.manuallyTriggered||this.manualTable||this.$dropzone.hide()},this.$body=$("body"),this.$element=$(e);const t=void 0!==this.$element.data("dropzoneTrigger");this.$trigger=$(this.$element.data("dropzoneTrigger")),this.defaultAction=this.$element.data("defaultAction")||Action.SKIP,this.$dropzone=$("<div />").addClass("dropzone").hide(),this.irreObjectUid=this.$element.data("fileIrreObject");const i=this.$element.data("dropzoneTarget");this.irreObjectUid&&0!==this.$element.nextAll(i).length?(this.dropZoneInsertBefore=!0,this.$dropzone.insertBefore(i)):(this.dropZoneInsertBefore=!1,this.$dropzone.insertAfter(i)),this.$dropzoneMask=$("<div />").addClass("dropzone-mask").appendTo(this.$dropzone),this.fileInput=document.createElement("input"),this.fileInput.setAttribute("type","file"),this.fileInput.setAttribute("multiple","multiple"),this.fileInput.setAttribute("name","files[]"),this.fileInput.classList.add("upload-file-picker"),this.$body.append(this.fileInput),this.$fileList=$(this.$element.data("progress-container")),this.fileListColumnCount=$("thead tr:first th",this.$fileList).length+1,this.filesExtensionsAllowed=this.$element.data("file-allowed"),this.fileDenyPattern=this.$element.data("file-deny-pattern")?new RegExp(this.$element.data("file-deny-pattern"),"i"):null,this.maxFileSize=parseInt(this.$element.data("max-file-size"),10),this.target=this.$element.data("target-folder"),this.reloadUrl=this.$element.data("reload-url"),this.browserCapabilities={fileReader:"undefined"!=typeof FileReader,DnD:"draggable"in document.createElement("span"),Progress:"upload"in new XMLHttpRequest},this.browserCapabilities.DnD?(this.$body.on("dragover",this.dragFileIntoDocument),this.$body.on("dragend",this.dragAborted),this.$body.on("drop",this.ignoreDrop),this.$dropzone.on("dragenter",this.fileInDropzone),this.$dropzoneMask.on("dragenter",this.fileInDropzone),this.$dropzoneMask.on("dragleave",this.fileOutOfDropzone),this.$dropzoneMask.on("drop",e=>this.handleDrop(e)),this.$dropzone.prepend('<button type="button" class="dropzone-hint" aria-labelledby="dropzone-title"><div class="dropzone-hint-media"><div class="dropzone-hint-icon"></div></div><div class="dropzone-hint-body"><h3 id="dropzone-title" class="dropzone-hint-title">'+TYPO3.lang["file_upload.dropzonehint.title"]+'</h3><p class="dropzone-hint-message">'+TYPO3.lang["file_upload.dropzonehint.message"]+"</p></div></div>").on("click",()=>{this.fileInput.click()}),$('<button type="button" />').addClass("dropzone-close").attr("aria-label",TYPO3.lang["file_upload.dropzone.close"]).on("click",this.hideDropzone).appendTo(this.$dropzone),0===this.$fileList.length&&(this.$fileList=$("<table />").attr("id","typo3-filelist").addClass("table table-striped table-hover upload-queue").html("<tbody></tbody>").hide(),this.dropZoneInsertBefore?this.$fileList.insertAfter(this.$dropzone):this.$fileList.insertBefore(this.$dropzone),this.fileListColumnCount=8,this.manualTable=!0),this.fileInput.addEventListener("change",e=>{this.hideDropzone(e),this.processFiles(Array.apply(null,this.fileInput.files))}),document.addEventListener("keydown",e=>{"Escape"===e.code&&this.$dropzone.is(":visible")&&!this.manualTable&&this.hideDropzone(e)}),this.bindUploadButton(!0===t?this.$trigger:this.$element)):console.warn("Browser has no Drag and drop capabilities; cannot initialize DragUploader")}showDropzone(){this.$dropzone.show()}processFiles(e){this.queueLength=e.length,this.$fileList.is(":visible")||(this.$fileList.show(),this.$fileList.closest(".t3-filelist-table-container")?.removeClass("hidden"),this.$fileList.closest("form")?.find(".t3-filelist-info-container")?.hide()),NProgress.start(),this.percentagePerFile=1/e.length;const t=[];Array.from(e).forEach(e=>{const i=new AjaxRequest(TYPO3.settings.ajaxUrls.file_exists).withQueryArguments({fileName:e.name,fileTarget:this.target}).get({cache:"no-cache"}).then(async t=>{const i=await t.resolve();void 0!==i.uid?(this.askForOverride.push({original:i,uploaded:e,action:this.irreObjectUid?Action.USE_EXISTING:this.defaultAction}),NProgress.inc(this.percentagePerFile)):new FileQueueItem(this,e,Action.SKIP)});t.push(i)}),Promise.all(t).then(()=>{this.drawOverrideModal(),NProgress.done()}),this.fileInput.value=""}bindUploadButton(e){e.on("click",e=>{e.preventDefault(),this.fileInput.click(),this.showDropzone(),this.manuallyTriggered=!0})}decrementQueueLength(){this.queueLength>0&&(this.queueLength--,0===this.queueLength&&new AjaxRequest(TYPO3.settings.ajaxUrls.flashmessages_render).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();for(let e of t)Notification.showMessage(e.title,e.message,e.severity);this.reloadUrl&&!this.manualTable&&setTimeout(()=>{Notification.info(TYPO3.lang["file_upload.reload.filelist"],TYPO3.lang["file_upload.reload.filelist.message"],10,[{label:TYPO3.lang["file_upload.reload.filelist.actions.dismiss"]},{label:TYPO3.lang["file_upload.reload.filelist.actions.reload"],action:new ImmediateAction(()=>{top.list_frame.document.location.href=this.reloadUrl})}])},5e3)}))}drawOverrideModal(){const e=Object.keys(this.askForOverride).length;if(0===e)return;const t=$("<div/>").append($("<p/>").text(TYPO3.lang["file_upload.existingfiles.description"]),$("<table/>",{class:"table"}).append($("<thead/>").append($("<tr />").append($("<th/>"),$("<th/>").text(TYPO3.lang["file_upload.header.originalFile"]),$("<th/>").text(TYPO3.lang["file_upload.header.uploadedFile"]),$("<th/>").text(TYPO3.lang["file_upload.header.action"])))));for(let i=0;i<e;++i){const e=$("<tr />").append($("<td />").append(""!==this.askForOverride[i].original.thumbUrl?$("<img />",{src:this.askForOverride[i].original.thumbUrl,height:40}):$(this.askForOverride[i].original.icon)),$("<td />").html(this.askForOverride[i].original.name+" ("+DragUploader.fileSizeAsString(this.askForOverride[i].original.size)+")<br>"+moment(this.askForOverride[i].original.mtime).format("YYYY-MM-DD HH:mm")),$("<td />").html(this.askForOverride[i].uploaded.name+" ("+DragUploader.fileSizeAsString(this.askForOverride[i].uploaded.size)+")<br>"+moment(this.askForOverride[i].uploaded.lastModified?this.askForOverride[i].uploaded.lastModified:this.askForOverride[i].uploaded.lastModifiedDate).format("YYYY-MM-DD HH:mm")),$("<td />").append($("<select />",{class:"form-select t3js-actions","data-override":i}).append(this.irreObjectUid?$("<option/>").val(Action.USE_EXISTING).text(TYPO3.lang["file_upload.actions.use_existing"]):"",$("<option />",{selected:this.defaultAction===Action.SKIP}).val(Action.SKIP).text(TYPO3.lang["file_upload.actions.skip"]),$("<option />",{selected:this.defaultAction===Action.RENAME}).val(Action.RENAME).text(TYPO3.lang["file_upload.actions.rename"]),$("<option />",{selected:this.defaultAction===Action.OVERRIDE}).val(Action.OVERRIDE).text(TYPO3.lang["file_upload.actions.override"]))));t.find("table").append("<tbody />").append(e)}const i=Modal.confirm(TYPO3.lang["file_upload.existingfiles.title"],t,SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["file_upload.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["file_upload.button.continue"]||"Continue with selected actions",btnClass:"btn-warning",name:"continue"}],["modal-inner-scroll"]);i.find(".modal-dialog").addClass("modal-lg"),i.find(".modal-footer").prepend($("<span/>").addClass("form-inline").append($("<label/>").text(TYPO3.lang["file_upload.actions.all.label"]),$("<select/>",{class:"form-select t3js-actions-all"}).append($("<option/>").val("").text(TYPO3.lang["file_upload.actions.all.empty"]),this.irreObjectUid?$("<option/>").val(Action.USE_EXISTING).text(TYPO3.lang["file_upload.actions.all.use_existing"]):"",$("<option/>",{selected:this.defaultAction===Action.SKIP}).val(Action.SKIP).text(TYPO3.lang["file_upload.actions.all.skip"]),$("<option/>",{selected:this.defaultAction===Action.RENAME}).val(Action.RENAME).text(TYPO3.lang["file_upload.actions.all.rename"]),$("<option/>",{selected:this.defaultAction===Action.OVERRIDE}).val(Action.OVERRIDE).text(TYPO3.lang["file_upload.actions.all.override"]))));const s=this;i.on("change",".t3js-actions-all",(function(){const e=$(this).val();""!==e?i.find(".t3js-actions").each((t,i)=>{const o=$(i),a=parseInt(o.data("override"),10);o.val(e).prop("disabled","disabled"),s.askForOverride[a].action=o.val()}):i.find(".t3js-actions").removeProp("disabled")})).on("change",".t3js-actions",(function(){const e=$(this),t=parseInt(e.data("override"),10);s.askForOverride[t].action=e.val()})).on("button.clicked",(function(e){"cancel"===e.target.name?(s.askForOverride=[],Modal.dismiss()):"continue"===e.target.name&&($.each(s.askForOverride,(e,t)=>{t.action===Action.USE_EXISTING?DragUploader.addFileToIrre(s.irreObjectUid,t.original):t.action!==Action.SKIP&&new FileQueueItem(s,t.uploaded,t.action)}),s.askForOverride=[],Modal.dismiss())})).on("hidden.bs.modal",()=>{this.askForOverride=[]})}}class FileQueueItem{constructor(e,t,i){if(this.dragUploader=e,this.file=t,this.override=i,this.$row=$("<tr />").addClass("upload-queue-item uploading"),this.dragUploader.manualTable||(this.$selector=$("<td />").addClass("col-selector").appendTo(this.$row)),this.$iconCol=$("<td />").addClass("col-icon").appendTo(this.$row),this.$fileName=$("<td />").text(t.name).appendTo(this.$row),this.$progress=$("<td />").attr("colspan",this.dragUploader.fileListColumnCount-this.$row.find("td").length).appendTo(this.$row),this.$progressContainer=$("<div />").addClass("upload-queue-progress").appendTo(this.$progress),this.$progressBar=$("<div />").addClass("upload-queue-progress-bar").appendTo(this.$progressContainer),this.$progressPercentage=$("<span />").addClass("upload-queue-progress-percentage").appendTo(this.$progressContainer),this.$progressMessage=$("<span />").addClass("upload-queue-progress-message").appendTo(this.$progressContainer),0===$("tbody tr.upload-queue-item",this.dragUploader.$fileList).length?(this.$row.prependTo($("tbody",this.dragUploader.$fileList)),this.$row.addClass("last")):this.$row.insertBefore($("tbody tr.upload-queue-item:first",this.dragUploader.$fileList)),this.$selector&&this.$selector.html('<span class="form-check form-toggle"><input type="checkbox" class="form-check-input t3js-multi-record-selection-check" disabled/></span>'),this.$iconCol.html('<span class="t3-icon t3-icon-mimetypes t3-icon-other-other"> </span>'),this.dragUploader.maxFileSize>0&&this.file.size>this.dragUploader.maxFileSize)this.updateMessage(TYPO3.lang["file_upload.maxFileSizeExceeded"].replace(/\{0\}/g,this.file.name).replace(/\{1\}/g,DragUploader.fileSizeAsString(this.dragUploader.maxFileSize))),this.$row.addClass("error");else if(this.dragUploader.fileDenyPattern&&this.file.name.match(this.dragUploader.fileDenyPattern))this.updateMessage(TYPO3.lang["file_upload.fileNotAllowed"].replace(/\{0\}/g,this.file.name)),this.$row.addClass("error");else if(this.checkAllowedExtensions()){this.updateMessage("- "+DragUploader.fileSizeAsString(this.file.size));const e=new FormData;e.append("data[upload][1][target]",this.dragUploader.target),e.append("data[upload][1][data]","1"),e.append("overwriteExistingFiles",this.override),e.append("redirect",""),e.append("upload_1",this.file);const t=new XMLHttpRequest;t.onreadystatechange=()=>{if(t.readyState===XMLHttpRequest.DONE)if(200===t.status)try{this.uploadSuccess(JSON.parse(t.responseText))}catch(e){this.uploadError(t)}else this.uploadError(t)},t.upload.addEventListener("progress",e=>this.updateProgress(e)),t.open("POST",TYPO3.settings.ajaxUrls.file_process),t.send(e)}else this.updateMessage(TYPO3.lang["file_upload.fileExtensionExpected"].replace(/\{0\}/g,this.dragUploader.filesExtensionsAllowed)),this.$row.addClass("error")}updateMessage(e){this.$progressMessage.text(e)}removeProgress(){this.$progress&&this.$progress.remove()}uploadStart(){this.$progressPercentage.text("(0%)"),this.$progressBar.width("1%"),this.dragUploader.$trigger.trigger("uploadStart",[this])}uploadError(e){this.updateMessage(TYPO3.lang["file_upload.uploadFailed"].replace(/\{0\}/g,this.file.name));const t=$(e.responseText);t.is("t3err")?this.$progressPercentage.text(t.text()):e.statusText?this.$progressPercentage.text("("+e.statusText+") "):this.$progressPercentage.text(""),this.$row.addClass("error"),this.dragUploader.decrementQueueLength(),this.dragUploader.$trigger.trigger("uploadError",[this,e])}updateProgress(e){const t=Math.round(e.loaded/e.total*100)+"%";this.$progressBar.outerWidth(t),this.$progressPercentage.text(t),this.dragUploader.$trigger.trigger("updateProgress",[this,t,e])}uploadSuccess(e){if(e.upload){this.dragUploader.decrementQueueLength(),this.$row.removeClass("uploading"),this.$row.prop("data-type","file"),this.$row.prop("data-file-uid",e.upload[0].uid),this.$fileName.text(e.upload[0].name),this.$progressPercentage.text(""),this.$progressMessage.text("100%"),this.$progressBar.outerWidth("100%");const t=String(e.upload[0].id);if(this.$selector){const e=this.$selector.find("input")?.get(0);e&&(e.removeAttribute("disabled"),e.setAttribute("name","CBC[_FILE|"+Md5.hash(t)+"]"),e.setAttribute("value",t))}e.upload[0].icon&&this.$iconCol.html('<a href="#" class="t3js-contextmenutrigger" data-uid="'+t+'" data-table="sys_file">'+e.upload[0].icon+" </span></a>"),this.dragUploader.irreObjectUid?(DragUploader.addFileToIrre(this.dragUploader.irreObjectUid,e.upload[0]),setTimeout(()=>{this.$row.remove(),0===$("tr",this.dragUploader.$fileList).length&&(this.dragUploader.$fileList.hide(),this.dragUploader.$fileList.closest(".t3-filelist-table-container")?.addClass("hidden"),this.dragUploader.$trigger.trigger("uploadSuccess",[this,e]))},3e3)):setTimeout(()=>{this.showFileInfo(e.upload[0]),this.dragUploader.$trigger.trigger("uploadSuccess",[this,e])},3e3)}}showFileInfo(e){this.removeProgress(),document.querySelector("#search_field")?.value&&$("<td />").text(e.path).appendTo(this.$row),$("<td />").text("").appendTo(this.$row),$("<td />").text(TYPO3.lang["type.file"]+" ("+e.extension.toUpperCase()+")").appendTo(this.$row),$("<td />").text(DragUploader.fileSizeAsString(e.size)).appendTo(this.$row);let t="";e.permissions.read&&(t+='<strong class="text-danger">'+TYPO3.lang["permissions.read"]+"</strong>"),e.permissions.write&&(t+='<strong class="text-danger">'+TYPO3.lang["permissions.write"]+"</strong>"),$("<td />").html(t).appendTo(this.$row),$("<td />").text("-").appendTo(this.$row);for(let e=this.$row.find("td").length;e<this.dragUploader.fileListColumnCount;e++)$("<td />").text("").appendTo(this.$row)}checkAllowedExtensions(){if(!this.dragUploader.filesExtensionsAllowed)return!0;const e=this.file.name.split(".").pop(),t=this.dragUploader.filesExtensionsAllowed.split(",");return-1!==$.inArray(e.toLowerCase(),t)}}class DragUploader{static fileSizeAsString(e){const t=e/1024;let i="";return i=t>1024?(t/1024).toFixed(1)+" MB":t.toFixed(1)+" KB",i}static addFileToIrre(e,t){const i={actionName:"typo3:foreignRelation:insert",objectGroup:e,table:"sys_file",uid:t.uid};MessageUtility.send(i)}static init(){const e=this.options;$.fn.extend({dragUploader:function(e){return this.each((t,i)=>{const s=$(i);let o=s.data("DragUploaderPlugin");o||s.data("DragUploaderPlugin",o=new DragUploaderPlugin(i)),"string"==typeof e&&o[e]()})}}),$(()=>{$(".t3js-drag-uploader").dragUploader(e)})}}export const initialize=function(){DragUploader.init(),void 0!==TYPO3.settings&&void 0!==TYPO3.settings.RequireJS&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"]&&$.each(TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"],(e,t)=>{window.require([t])})};DragUploader.init(),void 0!==TYPO3.settings&&void 0!==TYPO3.settings.RequireJS&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"]&&$.each(TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"],(e,t)=>{window.require([t])}); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Element/ImmediateActionElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/Element/ImmediateActionElement.js deleted file mode 100644 index 4f501b95e10c419d4d0ee6d0e66748ad467d4de9..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Element/ImmediateActionElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Utility from"TYPO3/CMS/Backend/Utility.js";import{EventDispatcher}from"TYPO3/CMS/Backend/Event/EventDispatcher.js";export class ImmediateActionElement extends HTMLElement{constructor(){super(...arguments),this.args=[]}static async getDelegate(t){switch(t){case"TYPO3.ModuleMenu.App.refreshMenu":const{default:e}=await import("TYPO3/CMS/Backend/ModuleMenu.js");return e.App.refreshMenu.bind(e.App);case"TYPO3.Backend.Topbar.refresh":const{default:a}=await import("TYPO3/CMS/Backend/Viewport.js");return a.Topbar.refresh.bind(a.Topbar);case"TYPO3.WindowManager.localOpen":const{default:r}=await import("TYPO3/CMS/Backend/WindowManager.js");return r.localOpen.bind(r);case"TYPO3.Backend.Storage.ModuleStateStorage.update":return(await import("TYPO3/CMS/Backend/Storage/ModuleStateStorage.js")).ModuleStateStorage.update;case"TYPO3.Backend.Storage.ModuleStateStorage.updateWithCurrentMount":return(await import("TYPO3/CMS/Backend/Storage/ModuleStateStorage.js")).ModuleStateStorage.updateWithCurrentMount;case"TYPO3.Backend.Event.EventDispatcher.dispatchCustomEvent":return EventDispatcher.dispatchCustomEvent;default:throw Error('Unknown action "'+t+'"')}}static get observedAttributes(){return["action","args","args-list"]}attributeChangedCallback(t,e,a){if("action"===t)this.action=a;else if("args"===t){const t=a.replace(/"/g,'"'),e=JSON.parse(t);this.args=e instanceof Array?Utility.trimItems(e):[]}else if("args-list"===t){const t=a.split(",");this.args=Utility.trimItems(t)}}connectedCallback(){if(!this.action)throw new Error("Missing mandatory action attribute");ImmediateActionElement.getDelegate(this.action).then(t=>t.apply(null,this.args))}}window.customElements.define("typo3-immediate-action",ImmediateActionElement); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Event/TriggerRequest.js b/typo3/sysext/backend/Resources/Public/JavaScript/Event/TriggerRequest.js deleted file mode 100644 index 0d8dbb5e9d143e64320ee54ee70af5043643662f..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Event/TriggerRequest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import InteractionRequest from"TYPO3/CMS/Backend/Event/InteractionRequest.js";class TriggerRequest extends InteractionRequest{constructor(e,t=null){super(e,t)}concerns(e){if(this===e)return!0;let t=this;for(;t.parentRequest instanceof InteractionRequest;)if(t=t.parentRequest,t===e)return!0;return!1}concernsTypes(e){if(e.includes(this.type))return!0;let t=this;for(;t.parentRequest instanceof InteractionRequest;)if(t=t.parentRequest,e.includes(t.type))return!0;return!1}}export default TriggerRequest; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js deleted file mode 100644 index e81405c053d3299af476070225564d22f684f313..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import FormEngineValidation from"TYPO3/CMS/Backend/FormEngineValidation.js";import DocumentSaveActions from"TYPO3/CMS/Backend/DocumentSaveActions.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import*as MessageUtility from"TYPO3/CMS/Backend/Utility/MessageUtility.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import*as BackendExceptionModule from"TYPO3/CMS/Backend/BackendException.js";import InteractionRequestMap from"TYPO3/CMS/Backend/Event/InteractionRequestMap.js";export default(function(){function e(e,t){t?n.interactionRequestMap.resolveFor(e):n.interactionRequestMap.rejectFor(e)}const t=new Map;t.set("typo3-backend-form-update-value",(e,t)=>{const n=document.querySelector('[name="'+CSS.escape(e.elementName)+'"]'),a=document.querySelector('[data-formengine-input-name="'+CSS.escape(e.elementName)+'"]');FormEngineValidation.updateInputField(e.elementName),null!==n&&(FormEngineValidation.markFieldAsChanged(n),FormEngineValidation.validateField(n)),null!==a&&a!==n&&FormEngineValidation.validateField(a)}),t.set("typo3-backend-form-reload",(e,t)=>{e.confirm?Modal.confirm(TYPO3.lang["FormEngine.refreshRequiredTitle"],TYPO3.lang["FormEngine.refreshRequiredContent"]).on("button.clicked",e=>{"ok"==e.target.name&&n.saveDocument(),Modal.dismiss()}):n.saveDocument()}),t.set("typo3-backend-form-update-bitmask",(e,t)=>{const n=t.target,a=document.editform[e.elementName],o=n.checked!==e.invert,i=Math.pow(2,e.position),r=Math.pow(2,e.total)-i-1;a.value=o?a.value|i:a.value&r,a.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))});const n={consumeTypes:["typo3.setUrl","typo3.beforeSetUrl","typo3.refresh"],Validation:FormEngineValidation,interactionRequestMap:InteractionRequestMap,formName:TYPO3.settings.FormEngine.formName,openedPopupWindow:null,legacyFieldChangedCb:function(){!$.isFunction(TYPO3.settings.FormEngine.legacyFieldChangedCb)||TYPO3.settings.FormEngine.legacyFieldChangedCb()},browserUrl:"",openPopupWindow:function(e,t,a){return Modal.advanced({type:Modal.types.iframe,content:n.browserUrl+"&mode="+e+"&bparams="+t+(a?"&"+("db"===e?"expandPage":"expandFolder")+"="+a:""),size:Modal.sizes.large})},setSelectOptionFromExternalSource:function(e,t,a,o,i,r){i=String(i);let l,c,s=!1,d=!1;if(l=n.getFieldElement(e),c=l.get(0),null===c||"--div--"===t||c instanceof HTMLOptGroupElement)return;const u=n.getFieldElement(e,"_list",!0);if(u.length>0&&(l=u,s=l.prop("multiple")&&"1"!=l.prop("size"),d=!0),s||d){const d=n.getFieldElement(e,"_avail");if(s||(l.find("option").each((e,t)=>{const a=d.find('option[value="'+$.escapeSelector($(t).attr("value"))+'"]');a&&(a.removeClass("hidden").prop("disabled",!1),n.enableOptGroup(a.get(0)))}),l.empty()),i){let e=!1,a=new RegExp("(^|,)"+t+"($|,)");i.match(a)?(l.empty(),e=!0):1==l.find("option").length&&(a=new RegExp("(^|,)"+l.find("option").prop("value")+"($|,)"),i.match(a)&&(l.empty(),e=!0)),e&&void 0!==r&&r.closest("select").querySelectorAll("[disabled]").forEach((function(e){e.classList.remove("hidden"),e.disabled=!1,n.enableOptGroup(e)}))}let u=!0;const m=n.getFieldElement(e,"_mul",!0);if((0==m.length||0==m.val())&&(l.find("option").each((function(e,n){if($(n).prop("value")==t)return u=!1,!1})),u&&void 0!==r)){r.classList.add("hidden"),r.disabled=!0;const e=r.parentElement;e instanceof HTMLOptGroupElement&&0===e.querySelectorAll("option:not([disabled]):not([hidden]):not(.hidden)").length&&(e.disabled=!0,e.classList.add("hidden"))}if(u){const e=$("<option></option>");e.attr({value:t,title:o}).text(a),e.appendTo(l),n.updateHiddenFieldValueFromSelect(l,c),n.legacyFieldChangedCb(),FormEngineValidation.markFieldAsChanged(c),n.Validation.validateField(l),n.Validation.validateField(d)}}else{const e=/_(\d+)$/,a=t.toString().match(e);null!=a&&(t=a[1]),l.val(t),n.Validation.validateField(l)}},updateHiddenFieldValueFromSelect:function(e,t){const n=[];$(e).find("option").each((e,t)=>{n.push($(t).prop("value"))}),t.value=n.join(","),t.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},getFormElement:function(e){const t=$('form[name="'+n.formName+'"]:first');if(!e)return t;{const a=n.getFieldElement(e),o=n.getFieldElement(e,"_list");if(a.length>0&&("select-one"===a.prop("type")||o.length>0&&o.prop("type").match(/select-(one|multiple)/)))return t;console.error("Form fields missing: form: "+n.formName+", field name: "+e),alert("Form field is invalid")}},getFieldElement:function(e,t,a){const o=$('form[name="'+n.formName+'"]:first');if(t){let n;switch(t){case"_list":n=$(':input[data-formengine-input-name="'+e+'"]:not([type=hidden])',o);break;case"_avail":n=$(':input[data-relatedfieldname="'+e+'"]',o);break;case"_mul":case"_hr":n=$(':input[type=hidden][data-formengine-input-name="'+e+'"]',o);break;default:n=null}if(n&&n.length>0||!0===a)return n}return $(':input[name="'+e+'"]',o)},initializeEvents:function(){top.TYPO3&&void 0!==top.TYPO3.Backend&&(top.TYPO3.Backend.consumerScope.attach(n),$(window).on("unload",(function(){top.TYPO3.Backend.consumerScope.detach(n)}))),$(document).on("click",".t3js-editform-close",e=>{e.preventDefault(),n.preventExitIfNotSaved(n.preventExitIfNotSavedCallback)}).on("click",".t3js-editform-view",e=>{e.preventDefault(),n.previewAction(e,n.previewActionCallback)}).on("click",".t3js-editform-new",e=>{e.preventDefault(),n.newAction(e,n.newActionCallback)}).on("click",".t3js-editform-duplicate",e=>{e.preventDefault(),n.duplicateAction(e,n.duplicateActionCallback)}).on("click",".t3js-editform-delete-record",e=>{e.preventDefault(),n.deleteAction(e,n.deleteActionCallback)}).on("click",".t3js-editform-submitButton",e=>{const t=$(e.currentTarget),n=t.data("name")||e.currentTarget.name,a=$("<input />").attr("type","hidden").attr("name",n).attr("value","1");t.parents("form").append(a)}).on("change",'.t3-form-field-eval-null-checkbox input[type="checkbox"]',e=>{$(e.currentTarget).closest(".t3js-formengine-field-item").toggleClass("disabled")}).on("change",'.t3js-form-field-eval-null-placeholder-checkbox input[type="checkbox"]',e=>{n.toggleCheckboxField($(e.currentTarget)),FormEngineValidation.markFieldAsChanged($(e.currentTarget))}).on("change",(function(e){$(".module-docheader-bar .btn").removeClass("disabled").prop("disabled",!1)})).on("click",".t3js-element-browser",(function(e){e.preventDefault(),e.stopPropagation();const t=$(e.currentTarget),a=t.data("mode"),o=t.data("params"),i=t.data("entryPoint");n.openPopupWindow(a,o,i)})).on("click",'[data-formengine-field-change-event="click"]',e=>{const t=JSON.parse(e.currentTarget.dataset.formengineFieldChangeItems);n.processOnFieldChange(t,e)}).on("change",'[data-formengine-field-change-event="change"]',e=>{const t=JSON.parse(e.currentTarget.dataset.formengineFieldChangeItems);n.processOnFieldChange(t,e)}),document.editform.addEventListener("submit",(function(){if(document.editform.closeDoc.value)return;const e=["button[form]",'button[name^="_save"]','a[data-name^="_save"]','button[name="CMD"][value^="save"]','a[data-name="CMD"][data-value^="save"]'].join(","),t=document.querySelector(e);null!==t&&(t.disabled=!0,Icons.getIcon("spinner-circle-dark",Icons.sizes.small).then((function(e){t.querySelector(".t3js-icon").outerHTML=e})))})),window.addEventListener("message",n.handlePostMessage)},consume:function(t){if(!t)throw new BackendExceptionModule.BackendException("No interaction request given",1496589980);const a=$.Deferred();if(t.concernsTypes(n.consumeTypes)){const o=t.outerMostRequest;n.interactionRequestMap.attachFor(o,a),o.isProcessed()?e(o,o.getProcessedData().response):n.hasChange()?n.preventExitIfNotSaved((function(t){o.setProcessedData({response:t}),e(o,t)})):n.interactionRequestMap.resolveFor(o)}return a},handlePostMessage:function(e){if(!MessageUtility.MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:elementBrowser:elementAdded"===e.data.actionName){if(void 0===e.data.fieldName)throw"fieldName not defined in message";if(void 0===e.data.value)throw"value not defined in message";const t=e.data.label||e.data.value,a=e.data.title||t,o=e.data.exclusiveValues||"";n.setSelectOptionFromExternalSource(e.data.fieldName,e.data.value,t,a,o)}},initializeRemainingCharacterViews:function(){const e=$("[maxlength]").not(".t3js-datetimepicker").not(".t3js-charcounter-initialized");e.on("focus",e=>{const t=$(e.currentTarget),a=t.parents(".t3js-formengine-field-item:first"),o=n.getCharacterCounterProperties(t);a.append($("<div />",{class:"t3js-charcounter"}).append($("<span />",{class:o.labelClass}).text(TYPO3.lang["FormEngine.remainingCharacters"].replace("{0}",o.remainingCharacters))))}).on("blur",e=>{$(e.currentTarget).parents(".t3js-formengine-field-item:first").find(".t3js-charcounter").remove()}).on("keyup",e=>{const t=$(e.currentTarget),a=t.parents(".t3js-formengine-field-item:first"),o=n.getCharacterCounterProperties(t);a.find(".t3js-charcounter span").removeClass().addClass(o.labelClass).text(TYPO3.lang["FormEngine.remainingCharacters"].replace("{0}",o.remainingCharacters))}),e.addClass("t3js-charcounter-initialized"),$(":password").on("focus",(function(e){$(e.currentTarget).attr({type:"text","data-active-password":"true"}).trigger("select")})).on("blur",(function(e){$(e.currentTarget).attr("type","password").removeAttr("data-active-password")}))},getCharacterCounterProperties:function(e){const t=e.val(),n=e.attr("maxlength")-t.length-(t.match(/\n/g)||[]).length;let a="";return a=n<15?"label-danger":n<30?"label-warning":"label-info",{remainingCharacters:n,labelClass:"label "+a}},initializeNullNoPlaceholderCheckboxes:function(){$(".t3-form-field-eval-null-checkbox").each((function(e,t){const n=$(t),a=n.find('input[type="checkbox"]'),o=n.closest(".t3js-formengine-field-item");a.attr("checked")||o.addClass("disabled")}))},initializeNullWithPlaceholderCheckboxes:function(){$(".t3js-form-field-eval-null-placeholder-checkbox").each((e,t)=>{n.toggleCheckboxField($(t).find('input[type="checkbox"]'))})},toggleCheckboxField:function(e){const t=e.closest(".t3js-formengine-field-item");e.prop("checked")?(t.find(".t3js-formengine-placeholder-placeholder").hide(),t.find(".t3js-formengine-placeholder-formfield").show(),t.find(".t3js-formengine-placeholder-formfield").find(":input").trigger("focus")):(t.find(".t3js-formengine-placeholder-placeholder").show(),t.find(".t3js-formengine-placeholder-formfield").hide())},reinitialize:function(){const e=Array.from(document.querySelectorAll(".t3js-clearable")).filter(e=>!e.classList.contains("t3js-color-picker"));e.length>0&&import("TYPO3/CMS/Backend/Input/Clearable.js").then((function(){e.forEach(e=>e.clearable())})),n.initializeNullNoPlaceholderCheckboxes(),n.initializeNullWithPlaceholderCheckboxes(),n.initializeLocalizationStateSelector(),n.initializeRemainingCharacterViews()},initializeLocalizationStateSelector:function(){$(".t3js-l10n-state-container").each((e,t)=>{const n=$(t),a=n.closest(".t3js-formengine-field-item").find("[data-formengine-input-name]"),o=n.find('input[type="radio"]:checked').val();"parent"!==o&&"source"!==o||a.attr("disabled","disabled")})},hasChange:function(){const e=$('form[name="'+n.formName+'"] .has-change').length>0,t=$('[name^="data["].has-change').length>0;return e||t},preventExitIfNotSavedCallback:function(e){n.closeDocument()},preventFollowLinkIfNotSaved:function(e){return n.preventExitIfNotSaved((function(){window.location.href=e})),!1},preventExitIfNotSaved:function(e){if(e=e||n.preventExitIfNotSavedCallback,n.hasChange()){const t=TYPO3.lang["label.confirm.close_without_save.title"]||"Do you want to close without saving?",a=TYPO3.lang["label.confirm.close_without_save.content"]||"You currently have unsaved changes. Are you sure you want to discard these changes?",o=$("<input />").attr("type","hidden").attr("name","_saveandclosedok").attr("value","1"),i=[{text:TYPO3.lang["buttons.confirm.close_without_save.no"]||"No, I will continue editing",btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.close_without_save.yes"]||"Yes, discard my changes",btnClass:"btn-default",name:"yes"}];0===$(".has-error").length&&i.push({text:TYPO3.lang["buttons.confirm.save_and_close"]||"Save and close",btnClass:"btn-warning",name:"save",active:!0});Modal.confirm(t,a,Severity.warning,i).on("button.clicked",(function(t){"no"===t.target.name?Modal.dismiss():"yes"===t.target.name?(Modal.dismiss(),e.call(null,!0)):"save"===t.target.name&&($("form[name="+n.formName+"]").append(o),Modal.dismiss(),n.saveDocument())}))}else e.call(null,!0)},preventSaveIfHasErrors:function(){if($(".has-error").length>0){const e=TYPO3.lang["label.alert.save_with_error.title"]||"You have errors in your form!",t=TYPO3.lang["label.alert.save_with_error.content"]||"Please check the form, there is at least one error in your form.";return Modal.confirm(e,t,Severity.error,[{text:TYPO3.lang["buttons.alert.save_with_error.ok"]||"OK",btnClass:"btn-danger",name:"ok"}]).on("button.clicked",(function(e){"ok"===e.target.name&&Modal.dismiss()})),!1}return!0},requestFormEngineUpdate:function(e){if(e){Modal.confirm(TYPO3.lang["FormEngine.refreshRequiredTitle"],TYPO3.lang["FormEngine.refreshRequiredContent"]).on("button.clicked",(function(e){"ok"===e.target.name?(n.closeModalsRecursive(),n.saveDocument()):Modal.dismiss()}))}else n.saveDocument()},processOnFieldChange:function(e,n){e.forEach(e=>{const a=t.get(e.name);a instanceof Function&&a.call(null,e.data||null,n)})},registerOnFieldChangeHandler:function(e,n){t.has(e)&&console.warn("Handler for onFieldChange name `"+e+"` has been overridden."),t.set(e,n)},closeModalsRecursive:function(){void 0!==Modal.currentModal&&null!==Modal.currentModal&&(Modal.currentModal.on("hidden.bs.modal",(function(){n.closeModalsRecursive(Modal.currentModal)})),Modal.currentModal.trigger("modal-dismiss"))},previewAction:function(e,t){t=t||n.previewActionCallback;const a=e.target.href,o=e.target.dataset.hasOwnProperty("isNew"),i=$("<input />").attr("type","hidden").attr("name","_savedokview").attr("value","1");n.hasChange()?n.showPreviewModal(a,o,i,t):($("form[name="+n.formName+"]").append(i),window.open("","newTYPO3frontendWindow"),document.editform.submit())},previewActionCallback:function(e,t,a){switch(Modal.dismiss(),e){case"discard":const e=window.open(t,"newTYPO3frontendWindow");e.focus(),e.location.href===t&&e.location.reload();break;case"save":$("form[name="+n.formName+"]").append(a),window.open("","newTYPO3frontendWindow"),n.saveDocument()}},showPreviewModal:function(e,t,n,a){const o=TYPO3.lang["label.confirm.view_record_changed.title"]||"Do you want to save before viewing?",i={text:TYPO3.lang["buttons.confirm.view_record_changed.cancel"]||"Cancel",btnClass:"btn-default",name:"cancel"},r={text:TYPO3.lang["buttons.confirm.view_record_changed.no-save"]||"View without changes",btnClass:"btn-info",name:"discard"},l={text:TYPO3.lang["buttons.confirm.view_record_changed.save"]||"Save changes and view",btnClass:"btn-info",name:"save",active:!0};let c=[],s="";t?(c=[i,l],s=TYPO3.lang["label.confirm.view_record_changed.content.is-new-page"]||"You need to save your changes before viewing the page. Do you want to save and view them now?"):(c=[i,r,l],s=TYPO3.lang["label.confirm.view_record_changed.content"]||"You currently have unsaved changes. You can either discard these changes or save and view them.");const d=Modal.confirm(o,s,Severity.info,c);d.on("button.clicked",(function(t){a(t.target.name,e,n,d)}))},newAction:function(e,t){t=t||n.newActionCallback;const a=$("<input />").attr("type","hidden").attr("name","_savedoknew").attr("value","1"),o=e.target.dataset.hasOwnProperty("isNew");n.hasChange()?n.showNewModal(o,a,t):($("form[name="+n.formName+"]").append(a),document.editform.submit())},newActionCallback:function(e,t){const a=$("form[name="+n.formName+"]");switch(Modal.dismiss(),e){case"no":a.append(t),document.editform.submit();break;case"yes":a.append(t),n.saveDocument()}},showNewModal:function(e,t,n){const a=TYPO3.lang["label.confirm.new_record_changed.title"]||"Do you want to save before adding?",o=TYPO3.lang["label.confirm.new_record_changed.content"]||"You need to save your changes before creating a new record. Do you want to save and create now?";let i=[];const r={text:TYPO3.lang["buttons.confirm.new_record_changed.cancel"]||"Cancel",btnClass:"btn-default",name:"cancel"},l={text:TYPO3.lang["buttons.confirm.new_record_changed.no"]||"No, just add",btnClass:"btn-default",name:"no"},c={text:TYPO3.lang["buttons.confirm.new_record_changed.yes"]||"Yes, save and create now",btnClass:"btn-info",name:"yes",active:!0};i=e?[r,c]:[r,l,c];Modal.confirm(a,o,Severity.info,i).on("button.clicked",(function(e){n(e.target.name,t)}))},duplicateAction:function(e,t){t=t||n.duplicateActionCallback;const a=$("<input />").attr("type","hidden").attr("name","_duplicatedoc").attr("value","1"),o=e.target.dataset.hasOwnProperty("isNew");n.hasChange()?n.showDuplicateModal(o,a,t):($("form[name="+n.formName+"]").append(a),document.editform.submit())},duplicateActionCallback:function(e,t){const a=$("form[name="+n.formName+"]");switch(Modal.dismiss(),e){case"no":a.append(t),document.editform.submit();break;case"yes":a.append(t),n.saveDocument()}},showDuplicateModal:function(e,t,n){const a=TYPO3.lang["label.confirm.duplicate_record_changed.title"]||"Do you want to save before duplicating this record?",o=TYPO3.lang["label.confirm.duplicate_record_changed.content"]||"You currently have unsaved changes. Do you want to save your changes before duplicating this record?";let i=[];const r={text:TYPO3.lang["buttons.confirm.duplicate_record_changed.cancel"]||"Cancel",btnClass:"btn-default",name:"cancel"},l={text:TYPO3.lang["buttons.confirm.duplicate_record_changed.no"]||"No, just duplicate the original",btnClass:"btn-default",name:"no"},c={text:TYPO3.lang["buttons.confirm.duplicate_record_changed.yes"]||"Yes, save and duplicate this record",btnClass:"btn-info",name:"yes",active:!0};i=e?[r,c]:[r,l,c];Modal.confirm(a,o,Severity.info,i).on("button.clicked",(function(e){n(e.target.name,t)}))},deleteAction:function(e,t){t=t||n.deleteActionCallback;const a=$(e.target);n.showDeleteModal(a,t)},deleteActionCallback:function(e,t){Modal.dismiss(),"yes"===e&&n.invokeRecordDeletion(t)},showDeleteModal:function(e,t){const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?";let a=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";e.data("reference-count-message")&&(a+=" "+e.data("reference-count-message")),e.data("translation-count-message")&&(a+=" "+e.data("translation-count-message"));Modal.confirm(n,a,Severity.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes",active:!0}]).on("button.clicked",(function(n){t(n.target.name,e)}))},enableOptGroup:function(e){const t=e.parentElement;t instanceof HTMLOptGroupElement&&t.querySelectorAll("option:not([hidden]):not([disabled]):not(.hidden)").length&&(t.hidden=!1,t.disabled=!1,t.classList.remove("hidden"))},closeDocument:function(){document.editform.closeDoc.value=1,n.dispatchSubmitEvent(),document.editform.submit()},saveDocument:function(){document.editform.doSave.value=1,n.dispatchSubmitEvent(),document.editform.submit()},dispatchSubmitEvent:function(){const e=document.createEvent("Event");e.initEvent("submit",!1,!0),document.editform.dispatchEvent(e)},initialize:function(e){DocumentSaveActions.getInstance().addPreSubmitCallback((function(){$('[data-active-password]:not([type="password"])').each((function(e,t){t.setAttribute("type","password"),t.blur()}))})),n.browserUrl=e,$((function(){n.initializeEvents(),n.Validation.initialize(),n.reinitialize(),$("#t3js-ui-block").remove()}))},invokeRecordDeletion:function(e){window.location.href=e.attr("href")}};return void 0!==TYPO3.settings.RequireJS&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/FormEngine"]&&$.each(TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/FormEngine"],(function(e,t){window.require([t])})),TYPO3.FormEngine=n,n}()); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/FlexFormContainerContainer.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/FlexFormContainerContainer.js deleted file mode 100644 index a4b24f9e851a2f4175f5c0cbb5b89e6c06ec4f0b..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/FlexFormContainerContainer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{Collapse}from"bootstrap";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import Severity from"TYPO3/CMS/Backend/Severity.js";var Selectors;!function(e){e.toggleSelector='[data-bs-toggle="flexform-inline"]',e.actionFieldSelector=".t3js-flex-control-action",e.toggleFieldSelector=".t3js-flex-control-toggle",e.controlSectionSelector=".t3js-formengine-irre-control",e.sectionContentContainerSelector=".t3js-flex-section-content",e.deleteContainerButtonSelector=".t3js-delete",e.contentPreviewSelector=".content-preview"}(Selectors||(Selectors={}));class FlexFormContainerContainer{constructor(e,t){this.securityUtility=new SecurityUtility,this.parentContainer=e,this.container=t,this.containerContent=t.querySelector(Selectors.sectionContentContainerSelector),this.containerId=t.dataset.flexformContainerId,this.panelHeading=t.querySelector('[data-bs-target="#flexform-container-'+this.containerId+'"]'),this.panelButton=this.panelHeading.querySelector('[aria-controls="flexform-container-'+this.containerId+'"]'),this.toggleField=t.querySelector(Selectors.toggleFieldSelector),this.registerEvents(),this.generatePreview()}static getCollapseInstance(e){return Collapse.getInstance(e)??new Collapse(e,{toggle:!1})}getStatus(){return{id:this.containerId,collapsed:"false"===this.panelButton.getAttribute("aria-expanded")}}registerEvents(){this.parentContainer.isRestructuringAllowed()&&this.registerDelete(),this.registerToggle(),this.registerPanelToggle()}registerDelete(){new RegularEvent("click",()=>{const e=TYPO3.lang["flexform.section.delete.title"]||"Delete this container?",t=TYPO3.lang["flexform.section.delete.message"]||"Are you sure you want to delete this container?";Modal.confirm(e,t,Severity.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this container",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",e=>{if("yes"===e.target.name){const e=this.container.querySelector(Selectors.actionFieldSelector);e.value="DELETE",this.container.appendChild(e),this.container.classList.add("t3-flex-section--deleted"),new RegularEvent("transitionend",()=>{this.container.classList.add("hidden");const e=new CustomEvent("formengine:flexform:container-deleted",{detail:{containerId:this.containerId}});this.parentContainer.getContainer().dispatchEvent(e)}).bindTo(this.container)}Modal.dismiss()})}).bindTo(this.container.querySelector(Selectors.deleteContainerButtonSelector))}registerToggle(){new RegularEvent("click",()=>{FlexFormContainerContainer.getCollapseInstance(this.containerContent).toggle(),this.generatePreview()}).delegateTo(this.container,`${Selectors.toggleSelector} .form-irre-header-cell:not(${Selectors.controlSectionSelector}`)}registerPanelToggle(){["hide.bs.collapse","show.bs.collapse"].forEach(e=>{new RegularEvent(e,e=>{const t="hide.bs.collapse"===e.type;this.toggleField.value=t?"1":"0",this.panelButton.setAttribute("aria-expanded",t?"false":"true"),this.panelButton.parentElement.classList.toggle("collapsed",t)}).bindTo(this.containerContent)})}generatePreview(){let e="";if(this.getStatus().collapsed){const t=this.containerContent.querySelectorAll('input[type="text"], textarea');for(let n of t){let t=this.securityUtility.stripHtml(n.value);t.length>50&&(t=t.substring(0,50)+"..."),e+=(e?" / ":"")+t}}this.panelHeading.querySelector(Selectors.contentPreviewSelector).textContent=e}}export default FlexFormContainerContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/FlexFormSectionContainer.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/FlexFormSectionContainer.js deleted file mode 100644 index 314db620a3c0683c7905d922a4ed6545636a70a2..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/FlexFormSectionContainer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{Collapse}from"bootstrap";import $ from"jquery";import Sortable from"sortablejs";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FlexFormContainerContainer from"TYPO3/CMS/Backend/FormEngine/Container/FlexFormContainerContainer.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import{JavaScriptItemProcessor}from"TYPO3/CMS/Core/JavaScriptItemProcessor.js";var Selectors;!function(e){e.toggleAllSelector=".t3-form-flexsection-toggle",e.addContainerSelector=".t3js-flex-container-add",e.actionFieldSelector=".t3js-flex-control-action",e.sectionContainerSelector=".t3js-flex-section",e.sectionContentContainerSelector=".t3js-flex-section-content",e.sortContainerButtonSelector=".t3js-sortable-handle"}(Selectors||(Selectors={}));class FlexFormSectionContainer{constructor(e){this.allowRestructure=!1,this.flexformContainerContainers=[],this.updateSorting=e=>{this.container.querySelectorAll(Selectors.actionFieldSelector).forEach((e,t)=>{e.value=t.toString()}),this.updateToggleAllState(),this.flexformContainerContainers.splice(e.newIndex,0,this.flexformContainerContainers.splice(e.oldIndex,1)[0]),document.dispatchEvent(new Event("formengine:flexform:sorting-changed"))},this.sectionContainerId=e,DocumentService.ready().then(t=>{this.container=t.getElementById(e),this.sectionContainer=this.container.querySelector(this.container.dataset.section),this.allowRestructure="1"===this.sectionContainer.dataset.t3FlexAllowRestructure,this.registerEvents(),this.registerContainers()})}static getCollapseInstance(e){return Collapse.getInstance(e)??new Collapse(e,{toggle:!1})}getContainer(){return this.container}isRestructuringAllowed(){return this.allowRestructure}registerEvents(){this.allowRestructure&&(this.registerSortable(),this.registerContainerDeleted()),this.registerToggleAll(),this.registerCreateNewContainer(),this.registerPanelToggle()}registerContainers(){const e=this.container.querySelectorAll(Selectors.sectionContainerSelector);for(let t of e)this.flexformContainerContainers.push(new FlexFormContainerContainer(this,t));this.updateToggleAllState()}getToggleAllButton(){return this.container.querySelector(Selectors.toggleAllSelector)}registerSortable(){new Sortable(this.sectionContainer,{group:this.sectionContainer.id,handle:Selectors.sortContainerButtonSelector,onSort:this.updateSorting})}registerToggleAll(){new RegularEvent("click",e=>{const t="true"===e.target.dataset.expandAll,n=this.container.querySelectorAll(Selectors.sectionContentContainerSelector);for(let e of n)t?FlexFormSectionContainer.getCollapseInstance(e).show():FlexFormSectionContainer.getCollapseInstance(e).hide()}).bindTo(this.getToggleAllButton())}registerCreateNewContainer(){new RegularEvent("click",(e,t)=>{e.preventDefault(),this.createNewContainer(t.dataset)}).delegateTo(this.container,Selectors.addContainerSelector)}createNewContainer(dataset){new AjaxRequest(TYPO3.settings.ajaxUrls.record_flex_container_add).post({vanillaUid:dataset.vanillauid,databaseRowUid:dataset.databaserowuid,command:dataset.command,tableName:dataset.tablename,fieldName:dataset.fieldname,recordTypeValue:dataset.recordtypevalue,dataStructureIdentifier:JSON.parse(dataset.datastructureidentifier),flexFormSheetName:dataset.flexformsheetname,flexFormFieldName:dataset.flexformfieldname,flexFormContainerName:dataset.flexformcontainername}).then(async response=>{const data=await response.resolve(),createdContainer=(new DOMParser).parseFromString(data.html,"text/html").body.firstElementChild;this.flexformContainerContainers.push(new FlexFormContainerContainer(this,createdContainer));const sectionContainer=document.querySelector(dataset.target);if(sectionContainer.insertAdjacentElement("beforeend",createdContainer),data.scriptItems instanceof Array&&data.scriptItems.length>0){const e=new JavaScriptItemProcessor;e.processItems(data.scriptItems)}data.scriptCall&&data.scriptCall.length>0&&$.each(data.scriptCall,(function(index,value){eval(value)})),data.stylesheetFiles&&data.stylesheetFiles.length>0&&$.each(data.stylesheetFiles,(function(e,t){let n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=t,document.head.appendChild(n)})),this.updateToggleAllState(),FormEngine.reinitialize(),FormEngine.Validation.initializeInputFields(),FormEngine.Validation.validate(sectionContainer)})}registerContainerDeleted(){new RegularEvent("formengine:flexform:container-deleted",e=>{const t=e.detail.containerId;this.flexformContainerContainers=this.flexformContainerContainers.filter(e=>e.getStatus().id!==t),FormEngine.Validation.validate(this.container),this.updateToggleAllState()}).bindTo(this.container)}registerPanelToggle(){["hide.bs.collapse","show.bs.collapse"].forEach(e=>{new RegularEvent(e,()=>{this.updateToggleAllState()}).delegateTo(this.container,Selectors.sectionContentContainerSelector)})}updateToggleAllState(){if(this.flexformContainerContainers.length>0){const e=this.flexformContainerContainers.find(Boolean);this.getToggleAllButton().dataset.expandAll=!0===e.getStatus().collapsed?"true":"false"}}}export default FlexFormSectionContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/InlineControlContainer.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/InlineControlContainer.js deleted file mode 100644 index ae5d25c6c8569336a1f58670af3e2dda6807f5f9..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/InlineControlContainer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{MessageUtility}from"TYPO3/CMS/Backend/Utility/MessageUtility.js";import{AjaxDispatcher}from"TYPO3/CMS/Backend/FormEngine/InlineRelation/AjaxDispatcher.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import NProgress from"nprogress";import Sortable from"sortablejs";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";import FormEngineValidation from"TYPO3/CMS/Backend/FormEngineValidation.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import InfoWindow from"TYPO3/CMS/Backend/InfoWindow.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import Utility from"TYPO3/CMS/Backend/Utility.js";var Selectors,States,Separators,SortDirections;!function(e){e.toggleSelector='[data-bs-toggle="formengine-inline"]',e.controlSectionSelector=".t3js-formengine-irre-control",e.createNewRecordButtonSelector=".t3js-create-new-button",e.createNewRecordBySelectorSelector=".t3js-create-new-selector",e.deleteRecordButtonSelector=".t3js-editform-delete-inline-record",e.enableDisableRecordButtonSelector=".t3js-toggle-visibility-button",e.infoWindowButton='[data-action="infowindow"]',e.synchronizeLocalizeRecordButtonSelector=".t3js-synchronizelocalize-button",e.uniqueValueSelectors="select.t3js-inline-unique",e.revertUniqueness=".t3js-revert-unique",e.controlContainer=".t3js-inline-controls"}(Selectors||(Selectors={})),function(e){e.new="inlineIsNewRecord",e.visible="panel-visible",e.collapsed="panel-collapsed",e.notLoaded="t3js-not-loaded"}(States||(States={})),function(e){e.structureSeparator="-"}(Separators||(Separators={})),function(e){e.DOWN="down",e.UP="up"}(SortDirections||(SortDirections={}));class InlineControlContainer{constructor(e){this.container=null,this.ajaxDispatcher=null,this.appearance=null,this.requestQueue={},this.progessQueue={},this.noTitleString=TYPO3.lang?TYPO3.lang["FormEngine.noRecordTitle"]:"[No title]",this.handlePostMessage=e=>{if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:foreignRelation:insert"===e.data.actionName){if(void 0===e.data.objectGroup)throw"No object group defined for message";if(e.data.objectGroup!==this.container.dataset.objectGroup)return;if(this.isUniqueElementUsed(parseInt(e.data.uid,10),e.data.table))return void Notification.error("There is already a relation to the selected element");this.importRecord([e.data.objectGroup,e.data.uid]).then(()=>{if(e.source){const t={actionName:"typo3:foreignRelation:inserted",objectGroup:e.data.objectId,table:e.data.table,uid:e.data.uid};MessageUtility.send(t,e.source)}})}},DocumentService.ready().then(t=>{this.container=t.getElementById(e),this.ajaxDispatcher=new AjaxDispatcher(this.container.dataset.objectGroup),this.registerEvents()})}static getInlineRecordContainer(e){return document.querySelector('[data-object-id="'+e+'"]')}static getCollapseButton(e){return document.querySelector('[aria-controls="'+e+'_fields"]')}static toggleElement(e){const t=InlineControlContainer.getInlineRecordContainer(e);t.classList.contains(States.collapsed)?InlineControlContainer.expandElement(t,e):InlineControlContainer.collapseElement(t,e)}static collapseElement(e,t){const n=InlineControlContainer.getCollapseButton(t);e.classList.remove(States.visible),e.classList.add(States.collapsed),n.setAttribute("aria-expanded","false")}static expandElement(e,t){const n=InlineControlContainer.getCollapseButton(t);e.classList.remove(States.collapsed),e.classList.add(States.visible),n.setAttribute("aria-expanded","true")}static isNewRecord(e){return InlineControlContainer.getInlineRecordContainer(e).classList.contains(States.new)}static updateExpandedCollapsedStateLocally(e,t){const n=InlineControlContainer.getInlineRecordContainer(e),o="uc[inlineView]["+n.dataset.topmostParentTable+"]["+n.dataset.topmostParentUid+"]"+n.dataset.fieldName,i=document.getElementsByName(o);i.length&&(i[0].value=t?"1":"0")}static getValuesFromHashMap(e){return Object.keys(e).map(t=>e[t])}static selectOptionValueExists(e,t){return null!==e.querySelector('option[value="'+t+'"]')}static removeSelectOptionByValue(e,t){const n=e.querySelector('option[value="'+t+'"]');null!==n&&n.remove()}static reAddSelectOption(e,t,n){if(InlineControlContainer.selectOptionValueExists(e,t))return;const o=e.querySelectorAll("option");let i=-1;for(let e of Object.keys(n.possible)){if(e===t)break;for(let t=0;t<o.length;++t){if(o[t].value===e){i=t;break}}}-1===i?i=0:i<o.length&&i++;const r=document.createElement("option");r.text=n.possible[t],r.value=t,e.insertBefore(r,e.options[i])}registerEvents(){if(this.registerInfoButton(),this.registerSort(),this.registerCreateRecordButton(),this.registerEnableDisableButton(),this.registerDeleteButton(),this.registerSynchronizeLocalize(),this.registerRevertUniquenessAction(),this.registerToggle(),this.registerCreateRecordBySelector(),this.registerUniqueSelectFieldChanged(),new RegularEvent("message",this.handlePostMessage).bindTo(window),this.getAppearance().useSortable){const e=document.getElementById(this.container.getAttribute("id")+"_records");new Sortable(e,{group:e.getAttribute("id"),handle:".sortableHandle",onSort:()=>{this.updateSorting()}})}}registerToggle(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.loadRecordDetails(this.closest(Selectors.toggleSelector).parentElement.dataset.objectId)})).delegateTo(this.container,`${Selectors.toggleSelector} .form-irre-header-cell:not(${Selectors.controlSectionSelector}`)}registerSort(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.changeSortingByButton(this.closest("[data-object-id]").dataset.objectId,this.dataset.direction)})).delegateTo(this.container,Selectors.controlSectionSelector+' [data-action="sort"]')}registerCreateRecordButton(){const e=this;new RegularEvent("click",(function(t){if(t.preventDefault(),t.stopImmediatePropagation(),e.isBelowMax()){let t=e.container.dataset.objectGroup;void 0!==this.dataset.recordUid&&(t+=Separators.structureSeparator+this.dataset.recordUid),e.importRecord([t,e.container.querySelector(Selectors.createNewRecordBySelectorSelector)?.value],this.dataset.recordUid??null)}})).delegateTo(this.container,Selectors.createNewRecordButtonSelector)}registerCreateRecordBySelector(){const e=this;new RegularEvent("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.options[this.selectedIndex].getAttribute("value");e.importRecord([e.container.dataset.objectGroup,n])})).delegateTo(this.container,Selectors.createNewRecordBySelectorSelector)}createRecord(e,t,n=null,o=null){let i=this.container.dataset.objectGroup;null!==n&&(i+=Separators.structureSeparator+n),null!==n?(InlineControlContainer.getInlineRecordContainer(i).insertAdjacentHTML("afterend",t),this.memorizeAddRecord(e,n,o)):(document.getElementById(this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t),this.memorizeAddRecord(e,null,o))}async importRecord(e,t){return this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_create")),e).then(async e=>{this.isBelowMax()&&this.createRecord(e.compilerInput.uid,e.data,void 0!==t?t:null,void 0!==e.compilerInput.childChildUid?e.compilerInput.childChildUid:null)})}registerEnableDisableButton(){new RegularEvent("click",(e,t)=>{e.preventDefault(),e.stopImmediatePropagation();const n=t.closest("[data-object-id]").dataset.objectId,o=InlineControlContainer.getInlineRecordContainer(n),i="data"+o.dataset.fieldName+"["+t.dataset.hiddenField+"]",r=document.querySelector('[data-formengine-input-name="'+i+'"'),a=document.querySelector('[name="'+i+'"');null!==r&&null!==a&&(r.checked=!r.checked,a.value=r.checked?"1":"0",FormEngineValidation.markFieldAsChanged(r));const s="t3-form-field-container-inline-hidden";let l;o.classList.contains(s)?(l="actions-edit-hide",o.classList.remove(s)):(l="actions-edit-unhide",o.classList.add(s)),Icons.getIcon(l,Icons.sizes.small).then(e=>{t.replaceChild(document.createRange().createContextualFragment(e),t.querySelector(".t3js-icon"))})}).delegateTo(this.container,Selectors.enableDisableRecordButtonSelector)}registerInfoButton(){new RegularEvent("click",(function(e){e.preventDefault(),e.stopImmediatePropagation(),InfoWindow.showItem(this.dataset.infoTable,this.dataset.infoUid)})).delegateTo(this.container,Selectors.infoWindowButton)}registerDeleteButton(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?",o=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";Modal.confirm(n,o,Severity.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",t=>{if("yes"===t.target.name){const t=this.closest("[data-object-id]").dataset.objectId;e.deleteRecord(t)}Modal.dismiss()})})).delegateTo(this.container,Selectors.deleteRecordButtonSelector)}registerSynchronizeLocalize(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.ajaxDispatcher.send(e.ajaxDispatcher.newRequest(e.ajaxDispatcher.getEndpoint("record_inline_synchronizelocalize")),[e.container.dataset.objectGroup,this.dataset.type]).then(async t=>{document.getElementById(e.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t.data);const n=e.container.dataset.objectGroup+Separators.structureSeparator;for(let o of t.compilerInput.delete)e.deleteRecord(n+o,!0);for(let o of Object.values(t.compilerInput.localize)){if(void 0!==o.remove){const e=InlineControlContainer.getInlineRecordContainer(n+o.remove);e.parentElement.removeChild(e)}e.memorizeAddRecord(o.uid,null,o.selectedValue)}})})).delegateTo(this.container,Selectors.synchronizeLocalizeRecordButtonSelector)}registerUniqueSelectFieldChanged(){const e=this;new RegularEvent("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.closest("[data-object-id]");if(null!==n){const t=n.dataset.objectId,o=n.dataset.objectUid;e.handleChangedField(this,t);const i=e.getFormFieldForElements();if(null===i)return;e.updateUnique(this,i,o)}})).delegateTo(this.container,Selectors.uniqueValueSelectors)}registerRevertUniquenessAction(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.revertUnique(this.dataset.uid)})).delegateTo(this.container,Selectors.revertUniqueness)}loadRecordDetails(e){const t=document.getElementById(e+"_fields"),n=InlineControlContainer.getInlineRecordContainer(e),o=void 0!==this.requestQueue[e];if(null!==t&&!n.classList.contains(States.notLoaded))this.collapseExpandRecord(e);else{const i=this.getProgress(e,n.dataset.objectIdHash);if(o)this.requestQueue[e].abort(),delete this.requestQueue[e],delete this.progessQueue[e],i.done();else{const o=this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_details"));this.ajaxDispatcher.send(o,[e]).then(async o=>{if(delete this.requestQueue[e],delete this.progessQueue[e],n.classList.remove(States.notLoaded),t.innerHTML=o.data,this.collapseExpandRecord(e),i.done(),FormEngine.reinitialize(),FormEngineValidation.initializeInputFields(),FormEngineValidation.validate(this.container),this.hasObjectGroupDefinedUniqueConstraints()){const t=InlineControlContainer.getInlineRecordContainer(e);this.removeUsed(t)}}),this.requestQueue[e]=o,i.start()}}}collapseExpandRecord(e){const t=InlineControlContainer.getInlineRecordContainer(e),n=!0===this.getAppearance().expandSingle,o=t.classList.contains(States.collapsed);let i=[];const r=[];n&&o&&(i=this.collapseAllRecords(t.dataset.objectUid)),InlineControlContainer.toggleElement(e),InlineControlContainer.isNewRecord(e)?InlineControlContainer.updateExpandedCollapsedStateLocally(e,o):o?r.push(t.dataset.objectUid):o||i.push(t.dataset.objectUid),this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_expandcollapse")),[e,r.join(","),i.join(",")])}memorizeAddRecord(e,t=null,n=null){const o=this.getFormFieldForElements();if(null===o)return;let i=Utility.trimExplode(",",o.value);if(t){const n=[];for(let o=0;o<i.length;o++)i[o].length&&n.push(i[o]),t===i[o]&&n.push(e);i=n}else i.push(e);o.value=i.join(","),o.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,i),this.setUnique(e,n),this.isBelowMax()||this.toggleContainerControls(!1),FormEngine.reinitialize(),FormEngineValidation.initializeInputFields(),FormEngineValidation.validate(this.container)}memorizeRemoveRecord(e){const t=this.getFormFieldForElements();if(null===t)return[];let n=Utility.trimExplode(",",t.value);const o=n.indexOf(e);return o>-1&&(delete n[o],t.value=n.join(","),t.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,n)),n}changeSortingByButton(e,t){const n=InlineControlContainer.getInlineRecordContainer(e),o=n.dataset.objectUid,i=document.getElementById(this.container.getAttribute("id")+"_records"),r=Array.from(i.children).map(e=>e.dataset.objectUid);let a=r.indexOf(o),s=!1;if(t===SortDirections.UP&&a>0?(r[a]=r[a-1],r[a-1]=o,s=!0):t===SortDirections.DOWN&&a<r.length-1&&(r[a]=r[a+1],r[a+1]=o,s=!0),s){const e=this.container.dataset.objectGroup+Separators.structureSeparator,o=t===SortDirections.UP?1:0;n.parentElement.insertBefore(InlineControlContainer.getInlineRecordContainer(e+r[a-o]),InlineControlContainer.getInlineRecordContainer(e+r[a+1-o])),this.updateSorting()}}updateSorting(){const e=this.getFormFieldForElements();if(null===e)return;const t=document.getElementById(this.container.getAttribute("id")+"_records"),n=Array.from(t.querySelectorAll('[data-object-parent-group="'+this.container.dataset.objectGroup+'"][data-placeholder-record="0"]')).map(e=>e.dataset.objectUid);e.value=n.join(","),e.classList.add("has-change"),document.dispatchEvent(new Event("inline:sorting-changed")),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,n)}deleteRecord(e,t=!1){const n=InlineControlContainer.getInlineRecordContainer(e),o=n.dataset.objectUid;if(n.classList.add("t3js-inline-record-deleted"),!InlineControlContainer.isNewRecord(e)&&!t){const e=this.container.querySelector('[name="cmd'+n.dataset.fieldName+'[delete]"]');e.removeAttribute("disabled"),n.parentElement.insertAdjacentElement("afterbegin",e)}new RegularEvent("transitionend",()=>{n.parentElement.removeChild(n),FormEngineValidation.validate(this.container)}).bindTo(n),this.revertUnique(o),this.memorizeRemoveRecord(o),n.classList.add("form-irre-object--deleted"),this.isBelowMax()&&this.toggleContainerControls(!0)}toggleContainerControls(e){const t=this.container.querySelector(Selectors.controlContainer);if(null===t)return;t.querySelectorAll("button, a").forEach(t=>{t.style.display=e?null:"none"})}getProgress(e,t){const n="#"+t+"_header";let o;return void 0!==this.progessQueue[e]?o=this.progessQueue[e]:(o=NProgress,o.configure({parent:n,showSpinner:!1}),this.progessQueue[e]=o),o}collapseAllRecords(e){const t=this.getFormFieldForElements(),n=[];if(null!==t){const o=Utility.trimExplode(",",t.value);for(let t of o){if(t===e)continue;const o=this.container.dataset.objectGroup+Separators.structureSeparator+t,i=InlineControlContainer.getInlineRecordContainer(o);i.classList.contains(States.visible)&&(InlineControlContainer.collapseElement(i,o),InlineControlContainer.isNewRecord(o)?InlineControlContainer.updateExpandedCollapsedStateLocally(o,!1):n.push(t))}}return n}getFormFieldForElements(){const e=document.getElementsByName(this.container.dataset.formField);return e.length>0?e[0]:null}redrawSortingButtons(e,t=[]){if(0===t.length){const e=this.getFormFieldForElements();null!==e&&(t=Utility.trimExplode(",",e.value))}0!==t.length&&t.forEach((n,o)=>{const i=InlineControlContainer.getInlineRecordContainer(e+Separators.structureSeparator+n).dataset.objectIdHash+"_header",r=document.getElementById(i),a=r.querySelector('[data-action="sort"][data-direction="'+SortDirections.UP+'"]');if(null!==a){let e="actions-move-up";0===o?(a.classList.add("disabled"),e="empty-empty"):a.classList.remove("disabled"),Icons.getIcon(e,Icons.sizes.small).then(e=>{a.replaceChild(document.createRange().createContextualFragment(e),a.querySelector(".t3js-icon"))})}const s=r.querySelector('[data-action="sort"][data-direction="'+SortDirections.DOWN+'"]');if(null!==s){let e="actions-move-down";o===t.length-1?(s.classList.add("disabled"),e="empty-empty"):s.classList.remove("disabled"),Icons.getIcon(e,Icons.sizes.small).then(e=>{s.replaceChild(document.createRange().createContextualFragment(e),s.querySelector(".t3js-icon"))})}})}isBelowMax(){const e=this.getFormFieldForElements();if(null===e)return!0;if(void 0!==TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup]){if(Utility.trimExplode(",",e.value).length>=TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup].max)return!1;if(this.hasObjectGroupDefinedUniqueConstraints()){const e=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if(e.used.length>=e.max&&e.max>=0)return!1}}return!0}isUniqueElementUsed(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return!1;const n=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],o=InlineControlContainer.getValuesFromHashMap(n.used);if("select"===n.type&&-1!==o.indexOf(e))return!0;if("groupdb"===n.type)for(let n=o.length-1;n>=0;n--)if(o[n].table===t&&o[n].uid===e)return!0;return!1}removeUsed(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"!==t.type)return;let n=e.querySelector('[name="data['+t.table+"]["+e.dataset.objectUid+"]["+t.field+']"]');const o=InlineControlContainer.getValuesFromHashMap(t.used);if(null!==n){const e=n.options[n.selectedIndex].value;for(let t of o)t!==e&&InlineControlContainer.removeSelectOptionByValue(n,t)}}setUnique(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const n=document.getElementById(this.container.dataset.objectGroup+"_selector"),o=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"===o.type){if(!o.selector||-1!==o.max){const i=this.getFormFieldForElements(),r=this.container.dataset.objectGroup+Separators.structureSeparator+e;let a=InlineControlContainer.getInlineRecordContainer(r).querySelector('[name="data['+o.table+"]["+e+"]["+o.field+']"]');const s=InlineControlContainer.getValuesFromHashMap(o.used);if(null!==n){if(null!==a){for(let e of s)InlineControlContainer.removeSelectOptionByValue(a,e);o.selector||(t=a.options[0].value,a.options[0].selected=!0,this.updateUnique(a,i,e),this.handleChangedField(a,this.container.dataset.objectGroup+"["+e+"]"))}for(let e of s)InlineControlContainer.removeSelectOptionByValue(a,e);void 0!==o.used.length&&(o.used={}),o.used[e]={table:o.elTable,uid:t}}if(null!==i&&InlineControlContainer.selectOptionValueExists(n,t)){const n=Utility.trimExplode(",",i.value);for(let i of n)a=document.querySelector('[name="data['+o.table+"]["+i+"]["+o.field+']"]'),null!==a&&i!==e&&InlineControlContainer.removeSelectOptionByValue(a,t)}}}else"groupdb"===o.type&&(o.used[e]={table:o.elTable,uid:t});"select"===o.selector&&InlineControlContainer.selectOptionValueExists(n,t)&&(InlineControlContainer.removeSelectOptionByValue(n,t),o.used[e]={table:o.elTable,uid:t})}updateUnique(e,t,n){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const o=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],i=o.used[n];if("select"===o.selector){const t=document.getElementById(this.container.dataset.objectGroup+"_selector");InlineControlContainer.removeSelectOptionByValue(t,e.value),void 0!==i&&InlineControlContainer.reAddSelectOption(t,i,o)}if(o.selector&&-1===o.max)return;if(!o||null===t)return;const r=Utility.trimExplode(",",t.value);let a;for(let t of r)a=document.querySelector('[name="data['+o.table+"]["+t+"]["+o.field+']"]'),null!==a&&a!==e&&(InlineControlContainer.removeSelectOptionByValue(a,e.value),void 0!==i&&InlineControlContainer.reAddSelectOption(a,i,o));o.used[n]=e.value}revertUnique(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],n=this.container.dataset.objectGroup+Separators.structureSeparator+e,o=InlineControlContainer.getInlineRecordContainer(n);let i=o.querySelector('[name="data['+t.table+"]["+o.dataset.objectUid+"]["+t.field+']"]');if("select"===t.type){let n;if(null!==i)n=i.value;else{if(""===o.dataset.tableUniqueOriginalValue)return;n=o.dataset.tableUniqueOriginalValue}if("select"===t.selector&&!isNaN(parseInt(n,10))){const e=document.getElementById(this.container.dataset.objectGroup+"_selector");InlineControlContainer.reAddSelectOption(e,n,t)}if(t.selector&&-1===t.max)return;const r=this.getFormFieldForElements();if(null===r)return;const a=Utility.trimExplode(",",r.value);let s;for(let e=0;e<a.length;e++)s=document.querySelector('[name="data['+t.table+"]["+a[e]+"]["+t.field+']"]'),null!==s&&InlineControlContainer.reAddSelectOption(s,n,t);delete t.used[e]}else"groupdb"===t.type&&delete t.used[e]}hasObjectGroupDefinedUniqueConstraints(){return void 0!==TYPO3.settings.FormEngineInline.unique&&void 0!==TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup]}handleChangedField(e,t){let n;n=e instanceof HTMLSelectElement?e.options[e.selectedIndex].text:e.value,document.getElementById(t+"_label").textContent=n.length?n:this.noTitleString}getAppearance(){if(null===this.appearance&&(this.appearance={},"string"==typeof this.container.dataset.appearance))try{this.appearance=JSON.parse(this.container.dataset.appearance)}catch(e){console.error(e)}return this.appearance}}export default InlineControlContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/SiteLanguageContainer.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/SiteLanguageContainer.js deleted file mode 100644 index f4e5bae68cdfb17cf7dd1310b35b5f3a10b1417a..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Container/SiteLanguageContainer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{MessageUtility}from"TYPO3/CMS/Backend/Utility/MessageUtility.js";import{AjaxDispatcher}from"TYPO3/CMS/Backend/FormEngine/InlineRelation/AjaxDispatcher.js";import NProgress from"nprogress";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";import FormEngineValidation from"TYPO3/CMS/Backend/FormEngineValidation.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import Utility from"TYPO3/CMS/Backend/Utility.js";var Selectors,States,Separators;!function(e){e.toggleSelector='[data-bs-toggle="formengine-inline"]',e.controlSectionSelector=".t3js-formengine-irre-control",e.createNewRecordButtonSelector=".t3js-create-new-button",e.createNewRecordBySelectorSelector=".t3js-create-new-selector",e.deleteRecordButtonSelector=".t3js-editform-delete-inline-record"}(Selectors||(Selectors={})),function(e){e.new="inlineIsNewRecord",e.visible="panel-visible",e.collapsed="panel-collapsed",e.notLoaded="t3js-not-loaded"}(States||(States={})),function(e){e.structureSeparator="-"}(Separators||(Separators={}));class SiteLanguageContainer extends HTMLElement{constructor(){super(...arguments),this.container=null,this.ajaxDispatcher=null,this.requestQueue={},this.progessQueue={},this.handlePostMessage=e=>{if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:foreignRelation:insert"===e.data.actionName){if(void 0===e.data.objectGroup)throw"No object group defined for message";if(e.data.objectGroup!==this.container.dataset.objectGroup)return;if(this.isUniqueElementUsed(parseInt(e.data.uid,10)))return void Notification.error("There is already a relation to the selected element");this.importRecord([e.data.objectGroup,e.data.uid]).then(()=>{if(e.source){const t={actionName:"typo3:foreignRelation:inserted",objectGroup:e.data.objectId,table:e.data.table,uid:e.data.uid};MessageUtility.send(t,e.source)}})}}}static getInlineRecordContainer(e){return document.querySelector('[data-object-id="'+e+'"]')}static getValuesFromHashMap(e){return Object.keys(e).map(t=>e[t])}static selectOptionValueExists(e,t){return null!==e.querySelector('option[value="'+t+'"]')}static removeSelectOptionByValue(e,t){const n=e.querySelector('option[value="'+t+'"]');null!==n&&n.remove()}static reAddSelectOption(e,t,n){if(SiteLanguageContainer.selectOptionValueExists(e,t))return;const i=e.querySelectorAll("option");let o=-1;for(let e of Object.keys(n.possible)){if(e===t)break;for(let t=0;t<i.length;++t){if(i[t].value===e){o=t;break}}}-1===o?o=0:o<i.length&&o++;const r=document.createElement("option");r.text=n.possible[t],r.value=t,e.insertBefore(r,e.options[o])}static collapseExpandRecord(e){const t=SiteLanguageContainer.getInlineRecordContainer(e),n=document.querySelector('[aria-controls="'+e+'_fields"]');t.classList.contains(States.collapsed)?(t.classList.remove(States.collapsed),t.classList.add(States.visible),n.setAttribute("aria-expanded","true")):(t.classList.remove(States.visible),t.classList.add(States.collapsed),n.setAttribute("aria-expanded","false"))}connectedCallback(){const e=this.getAttribute("identifier")||"";this.container=this.querySelector("#"+e),null!==this.container&&(this.ajaxDispatcher=new AjaxDispatcher(this.container.dataset.objectGroup),this.registerEvents())}registerEvents(){this.registerCreateRecordButton(),this.registerCreateRecordBySelector(),this.registerRecordToggle(),this.registerDeleteButton(),new RegularEvent("message",this.handlePostMessage).bindTo(window)}registerCreateRecordButton(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation();let n=e.container.dataset.objectGroup;void 0!==this.dataset.recordUid&&(n+=Separators.structureSeparator+this.dataset.recordUid),e.importRecord([n,e.container.querySelector(Selectors.createNewRecordBySelectorSelector)?.value],this.dataset.recordUid??null)})).delegateTo(this.container,Selectors.createNewRecordButtonSelector)}registerCreateRecordBySelector(){const e=this;new RegularEvent("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.options[this.selectedIndex].getAttribute("value");e.importRecord([e.container.dataset.objectGroup,n])})).delegateTo(this.container,Selectors.createNewRecordBySelectorSelector)}registerRecordToggle(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.loadRecordDetails(this.closest(Selectors.toggleSelector).parentElement.dataset.objectId)})).delegateTo(this.container,`${Selectors.toggleSelector} .form-irre-header-cell:not(${Selectors.controlSectionSelector}`)}registerDeleteButton(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?",i=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";Modal.confirm(n,i,Severity.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes",trigger:()=>{e.deleteRecord(this.closest("[data-object-id]").dataset.objectId),Modal.currentModal.trigger("modal-dismiss")}}])})).delegateTo(this.container,Selectors.deleteRecordButtonSelector)}createRecord(e,t,n=null,i=null){let o=this.container.dataset.objectGroup;null!==n?(o+=Separators.structureSeparator+n,SiteLanguageContainer.getInlineRecordContainer(o).insertAdjacentHTML("afterend",t),this.memorizeAddRecord(e,n,i)):(document.getElementById(this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t),this.memorizeAddRecord(e,null,i))}async importRecord(e,t){return this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("site_configuration_inline_create")),e).then(async e=>{this.createRecord(e.compilerInput.uid,e.data,void 0!==t?t:null,void 0!==e.compilerInput.childChildUid?e.compilerInput.childChildUid:null)})}loadRecordDetails(e){const t=document.getElementById(e+"_fields"),n=SiteLanguageContainer.getInlineRecordContainer(e),i=void 0!==this.requestQueue[e];if(null!==t&&!n.classList.contains(States.notLoaded))SiteLanguageContainer.collapseExpandRecord(e);else{const o=this.getProgress(e,n.dataset.objectIdHash);if(i)this.requestQueue[e].abort(),delete this.requestQueue[e],delete this.progessQueue[e],o.done();else{const i=this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("site_configuration_inline_details"));this.ajaxDispatcher.send(i,[e]).then(async i=>{delete this.requestQueue[e],delete this.progessQueue[e],n.classList.remove(States.notLoaded),t.innerHTML=i.data,SiteLanguageContainer.collapseExpandRecord(e),o.done(),FormEngine.reinitialize(),FormEngineValidation.initializeInputFields(),FormEngineValidation.validate(this.container),this.removeUsed(SiteLanguageContainer.getInlineRecordContainer(e))}),this.requestQueue[e]=i,o.start()}}}memorizeAddRecord(e,t=null,n=null){const i=this.getFormFieldForElements();if(null===i)return;let o=Utility.trimExplode(",",i.value);if(t){const n=[];for(let i=0;i<o.length;i++)o[i].length&&n.push(o[i]),t===o[i]&&n.push(e);o=n}else o.push(e);i.value=o.join(","),i.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.setUnique(e,n),FormEngine.reinitialize(),FormEngineValidation.initializeInputFields(),FormEngineValidation.validate(this.container)}memorizeRemoveRecord(e){const t=this.getFormFieldForElements();if(null===t)return[];let n=Utility.trimExplode(",",t.value);const i=n.indexOf(e);return i>-1&&(delete n[i],t.value=n.join(","),t.classList.add("has-change"),document.dispatchEvent(new Event("change"))),n}deleteRecord(e,t=!1){const n=SiteLanguageContainer.getInlineRecordContainer(e),i=n.dataset.objectUid;if(n.classList.add("t3js-inline-record-deleted"),!n.classList.contains(States.new)&&!t){const e=this.container.querySelector('[name="cmd'+n.dataset.fieldName+'[delete]"]');e.removeAttribute("disabled"),n.parentElement.insertAdjacentElement("afterbegin",e)}new RegularEvent("transitionend",()=>{n.parentElement.removeChild(n),FormEngineValidation.validate(this.container)}).bindTo(n),this.revertUnique(i),this.memorizeRemoveRecord(i),n.classList.add("form-irre-object--deleted")}getProgress(e,t){const n="#"+t+"_header";let i;return void 0!==this.progessQueue[e]?i=this.progessQueue[e]:(i=NProgress,i.configure({parent:n,showSpinner:!1}),this.progessQueue[e]=i),i}getFormFieldForElements(){const e=document.getElementsByName(this.container.dataset.formField);return e.length>0?e[0]:null}isUniqueElementUsed(e){const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];return-1!==SiteLanguageContainer.getValuesFromHashMap(t.used).indexOf(e)}removeUsed(e){const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],n=SiteLanguageContainer.getValuesFromHashMap(t.used);let i=e.querySelector('[name="data['+t.table+"]["+e.dataset.objectUid+"]["+t.field+']"]');if(null!==i){const e=i.options[i.selectedIndex].value;for(let t of n)t!==e&&SiteLanguageContainer.removeSelectOptionByValue(i,t)}}setUnique(e,t){const n=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],i=document.getElementById(this.container.dataset.objectGroup+"_selector");if(-1!==n.max){const o=this.getFormFieldForElements(),r=this.container.dataset.objectGroup+Separators.structureSeparator+e;let a=SiteLanguageContainer.getInlineRecordContainer(r).querySelector('[name="data['+n.table+"]["+e+"]["+n.field+']"]');const s=SiteLanguageContainer.getValuesFromHashMap(n.used);if(null!==i){if(null!==a)for(let e of s)SiteLanguageContainer.removeSelectOptionByValue(a,e);for(let e of s)SiteLanguageContainer.removeSelectOptionByValue(a,e);void 0!==n.used.length&&(n.used={}),n.used[e]={table:n.elTable,uid:t}}if(null!==o&&SiteLanguageContainer.selectOptionValueExists(i,t)){const i=Utility.trimExplode(",",o.value);for(let o of i)a=document.querySelector('[name="data['+n.table+"]["+o+"]["+n.field+']"]'),null!==a&&o!==e&&SiteLanguageContainer.removeSelectOptionByValue(a,t)}}SiteLanguageContainer.selectOptionValueExists(i,t)&&(SiteLanguageContainer.removeSelectOptionByValue(i,t),n.used[e]={table:n.elTable,uid:t})}revertUnique(e){const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],n=this.container.dataset.objectGroup+Separators.structureSeparator+e,i=SiteLanguageContainer.getInlineRecordContainer(n);let o,r=i.querySelector('[name="data['+t.table+"]["+i.dataset.objectUid+"]["+t.field+']"]');if(null!==r)o=r.value;else{if(""===i.dataset.tableUniqueOriginalValue)return;o=i.dataset.tableUniqueOriginalValue.replace(t.table+"_","")}if(!isNaN(parseInt(o,10))&&0x8000000000000000!==parseInt(o,10)){const e=document.getElementById(this.container.dataset.objectGroup+"_selector");SiteLanguageContainer.reAddSelectOption(e,o,t)}if(-1===t.max)return;const a=this.getFormFieldForElements();if(null===a)return;const s=Utility.trimExplode(",",a.value);let l;for(let e=0;e<s.length;e++)l=document.querySelector('[name="data['+t.table+"]["+s[e]+"]["+t.field+']"]'),null!==l&&SiteLanguageContainer.reAddSelectOption(l,o,t);delete t.used[e]}}window.customElements.define("typo3-formengine-container-sitelanguage",SiteLanguageContainer); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/AbstractSortableSelectItems.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/AbstractSortableSelectItems.js deleted file mode 100644 index 13c1ff67a9dc3d02731a64f42ef6168827d7b6c4..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/AbstractSortableSelectItems.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";import FormEngineValidation from"TYPO3/CMS/Backend/FormEngineValidation.js";export class AbstractSortableSelectItems{constructor(){this.registerSortableEventHandler=e=>{const t=e.closest(".form-wizards-wrap").querySelector(".form-wizards-items-aside");null!==t&&t.addEventListener("click",t=>{let o;if(null===(o=t.target.closest(".t3js-btn-option")))return void(t.target.matches(".t3js-btn-option")&&(o=t.target));t.preventDefault();const n=o.dataset.fieldname,r=FormEngine.getFieldElement(n).get(0),i=FormEngine.getFieldElement(n,"_avail").get(0);o.classList.contains("t3js-btn-moveoption-top")?AbstractSortableSelectItems.moveOptionToTop(e):o.classList.contains("t3js-btn-moveoption-up")?AbstractSortableSelectItems.moveOptionUp(e):o.classList.contains("t3js-btn-moveoption-down")?AbstractSortableSelectItems.moveOptionDown(e):o.classList.contains("t3js-btn-moveoption-bottom")?AbstractSortableSelectItems.moveOptionToBottom(e):o.classList.contains("t3js-btn-removeoption")&&AbstractSortableSelectItems.removeOption(e,i),FormEngine.updateHiddenFieldValueFromSelect(e,r),FormEngine.legacyFieldChangedCb(),FormEngineValidation.markFieldAsChanged(i),FormEngineValidation.validateField(i)})}}static moveOptionToTop(e){Array.from(e.querySelectorAll(":checked")).reverse().forEach(t=>{e.insertBefore(t,e.firstElementChild)})}static moveOptionToBottom(e){e.querySelectorAll(":checked").forEach(t=>{e.insertBefore(t,null)})}static moveOptionUp(e){const t=Array.from(e.children),o=Array.from(e.querySelectorAll(":checked"));for(let n of o){if(0===t.indexOf(n)&&null===n.previousElementSibling)break;e.insertBefore(n,n.previousElementSibling)}}static moveOptionDown(e){const t=Array.from(e.children).reverse(),o=Array.from(e.querySelectorAll(":checked")).reverse();for(let n of o){if(0===t.indexOf(n)&&null===n.nextElementSibling)break;e.insertBefore(n,n.nextElementSibling.nextElementSibling)}}static removeOption(e,t){e.querySelectorAll(":checked").forEach(o=>{const n=t.querySelector('option[value="'+o.value+'"]');null!==n&&(n.classList.remove("hidden"),n.disabled=!1,FormEngine.enableOptGroup(n)),e.removeChild(o)})}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/CategoryElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/CategoryElement.js deleted file mode 100644 index 98c2e149fbd17cd5b5eac9c74ee675cd4e3e7cf8..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/CategoryElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"TYPO3/CMS/Backend/FormEngine/Element/SelectTree.js";import"TYPO3/CMS/Backend/FormEngine/Element/SelectTreeToolbar.js";import"TYPO3/CMS/Backend/Element/IconElement.js";class CategoryElement extends HTMLElement{constructor(){super(...arguments),this.recordField=null,this.treeWrapper=null,this.tree=null,this.selectNode=e=>{const t=e.detail.node;this.updateAncestorsIndeterminateState(t),this.calculateIndeterminate(this.tree.nodes),this.saveCheckboxes(),this.tree.setup.input.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},this.loadDataAfter=()=>{this.tree.nodes=this.tree.nodes.map(e=>(e.indeterminate=!1,e)),this.calculateIndeterminate(this.tree.nodes)},this.saveCheckboxes=()=>{this.recordField.value=this.tree.getSelectedNodes().map(e=>e.identifier).join(",")}}connectedCallback(){this.recordField=this.querySelector("#"+(this.getAttribute("recordFieldId")||"")),this.treeWrapper=this.querySelector("#"+(this.getAttribute("treeWrapperId")||"")),this.recordField&&this.treeWrapper&&(this.tree=document.createElement("typo3-backend-form-selecttree"),this.tree.classList.add("svg-tree-wrapper"),this.tree.setup={id:this.treeWrapper.id,dataUrl:this.generateDataUrl(),readOnlyMode:this.recordField.dataset.readOnly,input:this.recordField,exclusiveNodesIdentifiers:this.recordField.dataset.treeExclusiveKeys,validation:JSON.parse(this.recordField.dataset.formengineValidationRules)[0],expandUpToLevel:this.recordField.dataset.treeExpandUpToLevel,unselectableElements:[]},this.treeWrapper.append(this.tree),this.registerTreeEventListeners())}registerTreeEventListeners(){this.tree.addEventListener("typo3:svg-tree:nodes-prepared",this.loadDataAfter),this.tree.addEventListener("typo3:svg-tree:node-selected",this.selectNode),this.tree.addEventListener("svg-tree:initialized",()=>{if(this.recordField.dataset.treeShowToolbar){const e=document.createElement("typo3-backend-form-selecttree-toolbar");e.tree=this.tree,this.tree.prepend(e)}}),this.listenForVisibleTree()}listenForVisibleTree(){if(!this.tree.offsetParent){const e=this.tree.closest(".tab-pane").getAttribute("id");if(e){document.querySelector('[aria-controls="'+e+'"]').addEventListener("shown.bs.tab",()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))})}}}generateDataUrl(){return TYPO3.settings.ajaxUrls.record_tree_data+"&"+new URLSearchParams({uid:this.recordField.dataset.uid,command:this.recordField.dataset.command,tableName:this.recordField.dataset.tablename,fieldName:this.recordField.dataset.fieldname,defaultValues:this.recordField.dataset.defaultvalues,overrideValues:this.recordField.dataset.overridevalues,recordTypeValue:this.recordField.dataset.recordtypevalue,flexFormSheetName:this.recordField.dataset.flexformsheetname,flexFormFieldName:this.recordField.dataset.flexformfieldname,flexFormContainerName:this.recordField.dataset.flexformcontainername,dataStructureIdentifier:this.recordField.dataset.datastructureidentifier,flexFormContainerFieldName:this.recordField.dataset.flexformcontainerfieldname,flexFormContainerIdentifier:this.recordField.dataset.flexformcontaineridentifier,flexFormSectionContainerIsNew:this.recordField.dataset.flexformsectioncontainerisnew})}updateAncestorsIndeterminateState(e){let t=!1;e.parents.forEach(e=>{const r=this.tree.nodes[e];r.indeterminate=r.checked||r.indeterminate||t,t=r.checked||r.indeterminate||r.checked||r.indeterminate})}calculateIndeterminate(e){e.forEach(t=>{(t.checked||t.indeterminate)&&t.parents&&t.parents.length>0&&t.parents.forEach(t=>{e[t].indeterminate=!0})})}}window.customElements.define("typo3-formengine-element-category",CategoryElement); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/Extra/SelectBoxFilter.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/Extra/SelectBoxFilter.js deleted file mode 100644 index e32df849f7c73ca24111b026ab1ad63f2189dc61..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/Extra/SelectBoxFilter.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var Selectors;!function(e){e.fieldContainerSelector=".t3js-formengine-field-group",e.filterTextFieldSelector=".t3js-formengine-multiselect-filter-textfield",e.filterSelectFieldSelector=".t3js-formengine-multiselect-filter-dropdown"}(Selectors||(Selectors={}));class SelectBoxFilter{constructor(e){this.selectElement=null,this.filterText="",this.availableOptions=null,this.selectElement=e,this.initializeEvents()}static toggleOptGroup(e){const t=e.parentElement;t instanceof HTMLOptGroupElement&&(0===t.querySelectorAll("option:not([hidden]):not([disabled]):not(.hidden)").length?t.hidden=!0:(t.hidden=!1,t.disabled=!1,t.classList.remove("hidden")))}initializeEvents(){const e=this.selectElement.closest(".form-wizards-element");null!==e&&(new RegularEvent("input",e=>{this.filter(e.target.value)}).delegateTo(e,Selectors.filterTextFieldSelector),new RegularEvent("change",e=>{this.filter(e.target.value)}).delegateTo(e,Selectors.filterSelectFieldSelector))}filter(e){this.filterText=e,null===this.availableOptions&&(this.availableOptions=this.selectElement.querySelectorAll("option"));const t=new RegExp(e,"i");this.availableOptions.forEach(l=>{l.hidden=e.length>0&&null===l.textContent.match(t),SelectBoxFilter.toggleOptGroup(l)})}}export default SelectBoxFilter; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/GroupElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/GroupElement.js deleted file mode 100644 index daf38945f97eae34075832f745f4df92c8fd3a59..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/GroupElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{AbstractSortableSelectItems}from"TYPO3/CMS/Backend/FormEngine/Element/AbstractSortableSelectItems.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FormEngineSuggest from"TYPO3/CMS/Backend/FormEngineSuggest.js";class GroupElement extends AbstractSortableSelectItems{constructor(e){super(),this.element=null,DocumentService.ready().then(()=>{this.element=document.getElementById(e),this.registerEventHandler(),this.registerSuggest()})}registerEventHandler(){this.registerSortableEventHandler(this.element)}registerSuggest(){let e;null!==(e=this.element.closest(".t3js-formengine-field-item").querySelector(".t3-form-suggest"))&&new FormEngineSuggest(e)}}export default GroupElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/InputDateTimeElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/InputDateTimeElement.js deleted file mode 100644 index 91e183ab819ea80ecc8c4f4fef40ec33ce881c66..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/InputDateTimeElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FormEngineValidation from"TYPO3/CMS/Backend/FormEngineValidation.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class InputDateTimeElement{constructor(e){this.element=null,DocumentService.ready().then(()=>{this.element=document.getElementById(e),this.registerEventHandler(this.element),import("TYPO3/CMS/Backend/DateTimePicker.js").then(({default:e})=>{e.initialize(this.element)})})}registerEventHandler(e){new RegularEvent("formengine.dp.change",e=>{FormEngineValidation.validateField(e.target),FormEngineValidation.markFieldAsChanged(e.target),document.querySelectorAll(".module-docheader-bar .btn").forEach(e=>{e.classList.remove("disabled"),e.disabled=!1})}).bindTo(e)}}export default InputDateTimeElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/InputLinkElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/InputLinkElement.js deleted file mode 100644 index 3a2177da3eca0531255fccf9b61e74e4daf2ce25..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/InputLinkElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";var Selectors;!function(e){e.toggleSelector=".t3js-form-field-inputlink-explanation-toggle",e.inputFieldSelector=".t3js-form-field-inputlink-input",e.explanationSelector=".t3js-form-field-inputlink-explanation",e.iconSelector=".t3js-form-field-inputlink-icon"}(Selectors||(Selectors={}));class InputLinkElement{constructor(e){this.element=null,this.container=null,this.toggleSelector=null,this.explanationField=null,this.icon=null,DocumentService.ready().then(t=>{this.element=t.getElementById(e),this.container=this.element.closest(".t3js-form-field-inputlink"),this.toggleSelector=this.container.querySelector(Selectors.toggleSelector),this.explanationField=this.container.querySelector(Selectors.explanationSelector),this.icon=this.container.querySelector(Selectors.iconSelector),this.toggleVisibility(""===this.explanationField.value),this.registerEventHandler()})}toggleVisibility(e){this.explanationField.classList.toggle("hidden",e),this.element.classList.toggle("hidden",!e)}registerEventHandler(){this.toggleSelector.addEventListener("click",e=>{e.preventDefault();const t=!this.explanationField.classList.contains("hidden");this.toggleVisibility(t)}),this.container.querySelector(Selectors.inputFieldSelector).addEventListener("change",()=>{const e=!this.explanationField.classList.contains("hidden");e&&this.toggleVisibility(e),this.disableToggle(),this.clearIcon()})}disableToggle(){this.toggleSelector.classList.add("disabled"),this.toggleSelector.setAttribute("disabled","disabled")}clearIcon(){this.icon.innerHTML=""}}export default InputLinkElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/MfaInfoElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/MfaInfoElement.js deleted file mode 100644 index ad1a8782da6eb61eac26cf2150a57c1aa4e841a1..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/MfaInfoElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";var Selectors;!function(t){t.deactivteProviderButton=".t3js-deactivate-provider-button",t.deactivteMfaButton=".t3js-deactivate-mfa-button",t.providerslist=".t3js-mfa-active-providers-list",t.mfaStatusLabel=".t3js-mfa-status-label"}(Selectors||(Selectors={}));class MfaInfoElement{constructor(t,e){this.options=null,this.fullElement=null,this.deactivteProviderButtons=null,this.deactivteMfaButton=null,this.providersList=null,this.mfaStatusLabel=null,this.request=null,this.options=e,DocumentService.ready().then(e=>{this.fullElement=e.querySelector(t),this.deactivteProviderButtons=this.fullElement.querySelectorAll(Selectors.deactivteProviderButton),this.deactivteMfaButton=this.fullElement.querySelector(Selectors.deactivteMfaButton),this.providersList=this.fullElement.querySelector(Selectors.providerslist),this.mfaStatusLabel=this.fullElement.parentElement.querySelector(Selectors.mfaStatusLabel),this.registerEvents()})}registerEvents(){new RegularEvent("click",t=>{t.preventDefault(),this.prepareDeactivateRequest(this.deactivteMfaButton)}).bindTo(this.deactivteMfaButton),this.deactivteProviderButtons.forEach(t=>{new RegularEvent("click",e=>{e.preventDefault(),this.prepareDeactivateRequest(t)}).bindTo(t)})}prepareDeactivateRequest(t){const e=Modal.show(t.dataset.confirmationTitle||t.getAttribute("title")||"Deactivate provider(s)",t.dataset.confirmationContent||"Are you sure you want to continue? This action cannot be undone and will be applied immediately!",SeverityEnum.warning,[{text:t.dataset.confirmationCancelText||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:t.dataset.confirmationDeactivateText||"Deactivate",btnClass:"btn-warning",name:"deactivate",trigger:()=>{this.sendDeactivateRequest(t.dataset.provider)}}]);e.on("button.clicked",()=>{e.modal("hide")})}sendDeactivateRequest(t){this.request instanceof AjaxRequest&&this.request.abort(),this.request=new AjaxRequest(TYPO3.settings.ajaxUrls.mfa),this.request.post({action:"deactivate",provider:t,userId:this.options.userId,tableName:this.options.tableName}).then(async e=>{const i=await e.resolve();if(i.status.length>0&&i.status.forEach(t=>{i.success?Notification.success(t.title,t.message):Notification.error(t.title,t.message)}),!i.success)return;if(void 0===t||0===i.remaining)return void this.deactivateMfa();if(null===this.providersList)return;const a=this.providersList.querySelector("li#provider-"+t);if(null===a)return;a.remove();0===this.providersList.querySelectorAll("li").length&&this.deactivateMfa()}).finally(()=>{this.request=null})}deactivateMfa(){this.deactivteMfaButton.classList.add("disabled"),this.deactivteMfaButton.setAttribute("disabled","disabled"),null!==this.providersList&&this.providersList.remove(),null!==this.mfaStatusLabel&&(this.mfaStatusLabel.innerText=this.mfaStatusLabel.dataset.alternativeLabel,this.mfaStatusLabel.classList.remove("label-success"),this.mfaStatusLabel.classList.add("label-danger"))}}export default MfaInfoElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectCheckBoxElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectCheckBoxElement.js deleted file mode 100644 index 6dccf224166935d5d2835a57e91c733fcb813789..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectCheckBoxElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var Identifier;!function(e){e.toggleAll=".t3js-toggle-checkboxes",e.singleItem=".t3js-checkbox",e.revertSelection=".t3js-revert-selection"}(Identifier||(Identifier={}));class SelectCheckBoxElement{constructor(e){this.checkBoxId="",this.table=null,this.checkedBoxes=null,this.checkBoxId=e,DocumentService.ready().then(t=>{this.table=t.getElementById(e).closest("table"),this.checkedBoxes=this.table.querySelectorAll(Identifier.singleItem+":checked"),this.enableTriggerCheckBox(),this.registerEventHandler()})}static allCheckBoxesAreChecked(e){const t=Array.from(e);return e.length===t.filter(e=>e.checked).length}registerEventHandler(){new RegularEvent("change",(e,t)=>{const l=this.table.querySelectorAll(Identifier.singleItem),c=!SelectCheckBoxElement.allCheckBoxesAreChecked(l);l.forEach(e=>{e.checked=c}),t.checked=c}).delegateTo(this.table,Identifier.toggleAll),new RegularEvent("change",this.setToggleAllState.bind(this)).delegateTo(this.table,Identifier.singleItem),new RegularEvent("click",()=>{const e=this.table.querySelectorAll(Identifier.singleItem),t=Array.from(this.checkedBoxes);e.forEach(e=>{e.checked=t.includes(e)}),this.setToggleAllState()}).delegateTo(this.table,Identifier.revertSelection)}setToggleAllState(){const e=this.table.querySelectorAll(Identifier.singleItem);this.table.querySelector(Identifier.toggleAll).checked=SelectCheckBoxElement.allCheckBoxesAreChecked(e)}enableTriggerCheckBox(){const e=this.table.querySelectorAll(Identifier.singleItem);document.getElementById(this.checkBoxId).checked=SelectCheckBoxElement.allCheckBoxesAreChecked(e)}}export default SelectCheckBoxElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectMultipleSideBySideElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectMultipleSideBySideElement.js deleted file mode 100644 index cbc4b2618efe679b446b4f178e67c7a6c38401d4..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectMultipleSideBySideElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{AbstractSortableSelectItems}from"TYPO3/CMS/Backend/FormEngine/Element/AbstractSortableSelectItems.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";import SelectBoxFilter from"TYPO3/CMS/Backend/FormEngine/Element/Extra/SelectBoxFilter.js";class SelectMultipleSideBySideElement extends AbstractSortableSelectItems{constructor(e,t){super(),this.selectedOptionsElement=null,this.availableOptionsElement=null,DocumentService.ready().then(l=>{this.selectedOptionsElement=l.getElementById(e),this.availableOptionsElement=l.getElementById(t),this.registerEventHandler()})}registerEventHandler(){this.registerSortableEventHandler(this.selectedOptionsElement),this.availableOptionsElement.addEventListener("click",e=>{const t=e.currentTarget,l=t.dataset.relatedfieldname;if(l){const e=t.dataset.exclusivevalues,n=t.querySelectorAll("option:checked");n.length>0&&n.forEach(t=>{FormEngine.setSelectOptionFromExternalSource(l,t.value,t.textContent,t.getAttribute("title"),e,t)})}}),new SelectBoxFilter(this.availableOptionsElement)}}export default SelectMultipleSideBySideElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectSingleElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectSingleElement.js deleted file mode 100644 index e322d149ee885042bd600f9b90a7b8bd249d2451..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectSingleElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";class SelectSingleElement{constructor(){this.initialize=(e,t)=>{let n=document.querySelector(e);t=t||{},new RegularEvent("change",e=>{const t=e.target,n=t.parentElement.querySelector(".input-group-icon");null!==n&&(n.innerHTML=t.options[t.selectedIndex].dataset.icon);const i=t.closest(".t3js-formengine-field-item").querySelector(".t3js-forms-select-single-icons");if(null!==i){const e=i.querySelector(".item.active");null!==e&&e.classList.remove("active");const n=i.querySelector('[data-select-index="'+t.selectedIndex+'"]');null!==n&&n.closest(".item").classList.add("active")}}).bindTo(n),t.onChange instanceof Array&&new RegularEvent("change",()=>FormEngine.processOnFieldChange(t.onChange)).bindTo(n),new RegularEvent("click",(e,t)=>{const i=t.closest(".t3js-forms-select-single-icons").querySelector(".item.active");null!==i&&i.classList.remove("active"),n.selectedIndex=parseInt(t.dataset.selectIndex,10),n.dispatchEvent(new Event("change")),t.closest(".item").classList.add("active")}).delegateTo(n.closest(".form-control-wrap"),".t3js-forms-select-single-icons .item:not(.active) a")}}initializeOnReady(e,t){DocumentService.ready().then(()=>{this.initialize(e,t)})}}export default new SelectSingleElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTree.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTree.js deleted file mode 100644 index e40dbcaab7e01b09360943920553a366aae1f26c..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTree.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var __decorate=function(e,t,i,s){var n,d=arguments.length,r=d<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(r=(d<3?n(r):d>3?n(t,i,r):n(t,i))||r);return d>3&&r&&Object.defineProperty(t,i,r),r};import*as d3selection from"d3-selection";import{SvgTree}from"TYPO3/CMS/Backend/SvgTree.js";import{customElement}from"lit/decorators.js";let SelectTree=class extends SvgTree{constructor(){super(),this.textPosition=30,this.settings={unselectableElements:[],exclusiveNodesIdentifiers:"",validation:{},readOnlyMode:!1,showIcons:!0,marginTop:15,nodeHeight:20,indentWidth:16,width:300,duration:400,dataUrl:"",defaultProperties:{},expandUpToLevel:null},this.exclusiveSelectedNode=null,this.addIcons(),this.addEventListener("typo3:svg-tree:nodes-prepared",this.prepareLoadedNodes)}expandAll(){this.nodes.forEach(e=>{this.showChildren(e)}),this.prepareDataForVisibleNodes(),this.updateVisibleNodes()}selectNode(e,t=!0){if(!this.isNodeSelectable(e))return;const i=e.checked;this.handleExclusiveNodeSelection(e),this.settings.validation&&this.settings.validation.maxItems&&!i&&this.getSelectedNodes().length>=this.settings.validation.maxItems||(e.checked=!i,this.dispatchEvent(new CustomEvent("typo3:svg-tree:node-selected",{detail:{node:e,propagate:t}})),this.updateVisibleNodes())}filter(e){this.searchTerm=e,this.nodes.length&&(this.nodes[0].expanded=!1);const t=new RegExp(e,"i");this.nodes.forEach(e=>{t.test(e.name)?(this.showParents(e),e.expanded=!0,e.hidden=!1):(e.hidden=!0,e.expanded=!1)}),this.prepareDataForVisibleNodes(),this.updateVisibleNodes()}showParents(e){if(0===e.parents.length)return;const t=this.nodes[e.parents[0]];t.hidden=!1,t.expanded=!0,this.showParents(t)}updateVisibleNodes(){super.updateVisibleNodes();const e=Math.ceil(this.viewportHeight/this.settings.nodeHeight+1),t=Math.floor(Math.max(this.scrollTop-2*this.settings.nodeHeight,0)/this.settings.nodeHeight),i=this.data.nodes.slice(t,t+e);this.nodesContainer.selectAll(".node").data(i,e=>e.stateIdentifier).selectAll(".tree-check use").attr("visibility",(function(e){const t=Boolean(e.checked),i=d3selection.select(this);return i.classed("icon-checked")&&t||i.classed("icon-indeterminate")&&e.indeterminate&&!t?"visible":!i.classed("icon-check")||e.indeterminate||t?"hidden":"visible"}))}isNodeSelectable(e){return!this.settings.readOnlyMode&&-1===this.settings.unselectableElements.indexOf(e.identifier)}appendTextElement(e){return this.renderCheckbox(e),super.appendTextElement(e)}renderCheckbox(e){const t=e.filter(e=>this.isNodeSelectable(e)||Boolean(e.checked)).append("g").attr("class","tree-check").on("click",(e,t)=>this.selectNode(t));t.append("use").attr("x",28).attr("y",-8).attr("visibility","hidden").attr("class","icon-check").attr("xlink:href","#icon-check"),t.append("use").attr("x",28).attr("y",-8).attr("visibility","hidden").attr("class","icon-checked").attr("xlink:href","#icon-checked"),t.append("use").attr("x",28).attr("y",-8).attr("visibility","hidden").attr("class","icon-indeterminate").attr("xlink:href","#icon-indeterminate")}prepareLoadedNodes(e){let t=e.detail.nodes;e.detail.nodes=t.map(e=>{if(!e.stateIdentifier){const t=e.parents.length?e.parents[e.parents.length-1]:e.identifier;e.stateIdentifier=t+"_"+e.identifier}return!1===e.selectable&&this.settings.unselectableElements.push(e.identifier),e})}handleExclusiveNodeSelection(e){const t=this.settings.exclusiveNodesIdentifiers.split(",");this.settings.exclusiveNodesIdentifiers.length&&!1===e.checked&&(t.indexOf(""+e.identifier)>-1?(this.disableSelectedNodes(),this.exclusiveSelectedNode=e):-1===t.indexOf(""+e.identifier)&&this.exclusiveSelectedNode&&(this.exclusiveSelectedNode.checked=!1,this.exclusiveSelectedNode=null))}addIcons(){this.icons={check:{identifier:"check",icon:'<g width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><rect height="16" width="16" fill="transparent"></rect><path transform="scale(0.01)" d="M1312 256h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113v-832q0-66-47-113t-113-47zm288 160v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"></path></g>'},checked:{identifier:"checked",icon:'<g width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><rect height="16" width="16" fill="transparent"></rect><path transform="scale(0.01)" d="M813 1299l614-614q19-19 19-45t-19-45l-102-102q-19-19-45-19t-45 19l-467 467-211-211q-19-19-45-19t-45 19l-102 102q-19 19-19 45t19 45l358 358q19 19 45 19t45-19zm851-883v960q0 119-84.5 203.5t-203.5 84.5h-960q-119 0-203.5-84.5t-84.5-203.5v-960q0-119 84.5-203.5t203.5-84.5h960q119 0 203.5 84.5t84.5 203.5z"></path></g>'},indeterminate:{identifier:"indeterminate",icon:'<g width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><rect height="16" width="16" fill="transparent"></rect><path transform="scale(0.01)" d="M1344 800v64q0 14-9 23t-23 9h-832q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h832q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"></path></g>'}}}};SelectTree=__decorate([customElement("typo3-backend-form-selecttree")],SelectTree);export{SelectTree}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTreeElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTreeElement.js deleted file mode 100644 index 5c0053119e93661fadbb3dfc22fb58d2d8bb9190..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTreeElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"TYPO3/CMS/Backend/FormEngine/Element/SelectTree.js";import"TYPO3/CMS/Backend/FormEngine/Element/SelectTreeToolbar.js";import"TYPO3/CMS/Backend/Element/IconElement.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";export class SelectTreeElement{constructor(e,t,r,i){if(this.recordField=null,this.tree=null,this.selectNode=e=>{const t=e.detail.node;this.updateAncestorsIndeterminateState(t),this.calculateIndeterminate(this.tree.nodes),this.saveCheckboxes(),this.tree.setup.input.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},this.loadDataAfter=()=>{this.tree.nodes=this.tree.nodes.map(e=>(e.indeterminate=!1,e)),this.calculateIndeterminate(this.tree.nodes)},this.saveCheckboxes=()=>{void 0!==this.recordField&&(this.recordField.value=this.tree.getSelectedNodes().map(e=>e.identifier).join(","))},r instanceof Function)throw new Error("Function `callback` is not supported anymore since TYPO3 v12.0");this.recordField=document.getElementById(t);const a=document.getElementById(e);this.tree=document.createElement("typo3-backend-form-selecttree"),this.tree.classList.add("svg-tree-wrapper"),this.tree.addEventListener("typo3:svg-tree:nodes-prepared",this.loadDataAfter),this.tree.addEventListener("typo3:svg-tree:node-selected",this.selectNode),i instanceof Array&&this.tree.addEventListener("typo3:svg-tree:node-selected",()=>{FormEngine.processOnFieldChange(i)});const d={id:e,dataUrl:this.generateRequestUrl(),readOnlyMode:1===parseInt(this.recordField.dataset.readOnly,10),input:this.recordField,exclusiveNodesIdentifiers:this.recordField.dataset.treeExclusiveKeys,validation:JSON.parse(this.recordField.dataset.formengineValidationRules)[0],expandUpToLevel:this.recordField.dataset.treeExpandUpToLevel,unselectableElements:[]};this.tree.addEventListener("svg-tree:initialized",()=>{if(this.recordField.dataset.treeShowToolbar){const e=document.createElement("typo3-backend-form-selecttree-toolbar");e.tree=this.tree,this.tree.prepend(e)}}),this.tree.setup=d,a.append(this.tree),this.listenForVisibleTree()}listenForVisibleTree(){if(!this.tree.offsetParent){let e=this.tree.closest(".tab-pane").getAttribute("id");if(e){document.querySelector('[aria-controls="'+e+'"]').addEventListener("shown.bs.tab",()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))})}}}generateRequestUrl(){const e={tableName:this.recordField.dataset.tablename,fieldName:this.recordField.dataset.fieldname,uid:this.recordField.dataset.uid,defaultValues:this.recordField.dataset.defaultvalues,overrideValues:this.recordField.dataset.overridevalues,recordTypeValue:this.recordField.dataset.recordtypevalue,dataStructureIdentifier:this.recordField.dataset.datastructureidentifier,flexFormSheetName:this.recordField.dataset.flexformsheetname,flexFormFieldName:this.recordField.dataset.flexformfieldname,flexFormContainerName:this.recordField.dataset.flexformcontainername,flexFormContainerIdentifier:this.recordField.dataset.flexformcontaineridentifier,flexFormContainerFieldName:this.recordField.dataset.flexformcontainerfieldname,flexFormSectionContainerIsNew:this.recordField.dataset.flexformsectioncontainerisnew,command:this.recordField.dataset.command};return TYPO3.settings.ajaxUrls.record_tree_data+"&"+new URLSearchParams(e)}updateAncestorsIndeterminateState(e){let t=!1;e.parents.forEach(e=>{const r=this.tree.nodes[e];r.indeterminate=r.checked||r.indeterminate||t,t=r.checked||r.indeterminate||r.checked||r.indeterminate})}calculateIndeterminate(e){e.forEach(t=>{(t.checked||t.indeterminate)&&t.parents&&t.parents.length>0&&t.parents.forEach(t=>{e[t].indeterminate=!0})})}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SlugElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SlugElement.js deleted file mode 100644 index 7b90605773cd4c4061ea4a638cb1965530740527..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SlugElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import DebounceEvent from"TYPO3/CMS/Core/Event/DebounceEvent.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var Selectors,ProposalModes;!function(e){e.toggleButton=".t3js-form-field-slug-toggle",e.recreateButton=".t3js-form-field-slug-recreate",e.inputField=".t3js-form-field-slug-input",e.readOnlyField=".t3js-form-field-slug-readonly",e.hiddenField=".t3js-form-field-slug-hidden"}(Selectors||(Selectors={})),function(e){e.AUTO="auto",e.RECREATE="recreate",e.MANUAL="manual"}(ProposalModes||(ProposalModes={}));class SlugElement{constructor(e,t){this.options=null,this.fullElement=null,this.manuallyChanged=!1,this.readOnlyField=null,this.inputField=null,this.hiddenField=null,this.request=null,this.fieldsToListenOn={},this.options=t,this.fieldsToListenOn=this.options.listenerFieldNames||{},DocumentService.ready().then(t=>{this.fullElement=t.querySelector(e),this.inputField=this.fullElement.querySelector(Selectors.inputField),this.readOnlyField=this.fullElement.querySelector(Selectors.readOnlyField),this.hiddenField=this.fullElement.querySelector(Selectors.hiddenField),this.registerEvents()})}registerEvents(){const e=Object.values(this.getAvailableFieldsForProposalGeneration()).map(e=>`[data-formengine-input-name="${e}"]`),t=this.fullElement.querySelector(Selectors.recreateButton);e.length>0&&"new"===this.options.command&&new DebounceEvent("input",()=>{this.manuallyChanged||this.sendSlugProposal(ProposalModes.AUTO)}).delegateTo(document,e.join(",")),e.length>0||this.hasPostModifiersDefined()?new RegularEvent("click",e=>{e.preventDefault(),this.readOnlyField.classList.contains("hidden")&&(this.readOnlyField.classList.toggle("hidden",!1),this.inputField.classList.toggle("hidden",!0)),this.sendSlugProposal(ProposalModes.RECREATE)}).bindTo(t):(t.classList.add("disabled"),t.disabled=!0),new DebounceEvent("input",()=>{this.manuallyChanged=!0,this.sendSlugProposal(ProposalModes.MANUAL)}).bindTo(this.inputField);const s=this.fullElement.querySelector(Selectors.toggleButton);new RegularEvent("click",e=>{e.preventDefault();const t=this.readOnlyField.classList.contains("hidden");this.readOnlyField.classList.toggle("hidden",!t),this.inputField.classList.toggle("hidden",t),t?(this.inputField.value!==this.readOnlyField.value?this.readOnlyField.value=this.inputField.value:(this.manuallyChanged=!1,this.fullElement.querySelector(".t3js-form-proposal-accepted").classList.add("hidden"),this.fullElement.querySelector(".t3js-form-proposal-different").classList.add("hidden")),this.hiddenField.value=this.readOnlyField.value):this.hiddenField.value=this.inputField.value}).bindTo(s)}sendSlugProposal(e){const t={};if(e===ProposalModes.AUTO||e===ProposalModes.RECREATE){for(const[e,s]of Object.entries(this.getAvailableFieldsForProposalGeneration()))t[e]=document.querySelector('[data-formengine-input-name="'+s+'"]').value;!0===this.options.includeUidInValues&&(t.uid=this.options.recordId.toString())}else t.manual=this.inputField.value;this.request instanceof AjaxRequest&&this.request.abort(),this.request=new AjaxRequest(TYPO3.settings.ajaxUrls.record_slug_suggest),this.request.post({values:t,mode:e,tableName:this.options.tableName,pageId:this.options.pageId,parentPageId:this.options.parentPageId,recordId:this.options.recordId,language:this.options.language,fieldName:this.options.fieldName,command:this.options.command,signature:this.options.signature}).then(async t=>{const s=await t.resolve(),l="/"+s.proposal.replace(/^\//,""),i=this.fullElement.querySelector(".t3js-form-proposal-accepted"),n=this.fullElement.querySelector(".t3js-form-proposal-different");i.classList.toggle("hidden",s.hasConflicts),n.classList.toggle("hidden",!s.hasConflicts),(s.hasConflicts?n:i).querySelector("span").innerText=l;this.hiddenField.value!==s.proposal&&this.fullElement.querySelector("input[data-formengine-input-name]").dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})),e===ProposalModes.AUTO||e===ProposalModes.RECREATE?(this.readOnlyField.value=s.proposal,this.hiddenField.value=s.proposal,this.inputField.value=s.proposal):this.hiddenField.value=s.proposal}).finally(()=>{this.request=null})}getAvailableFieldsForProposalGeneration(){const e={};for(const[t,s]of Object.entries(this.fieldsToListenOn)){null!==document.querySelector('[data-formengine-input-name="'+s+'"]')&&(e[t]=s)}return e}hasPostModifiersDefined(){return Array.isArray(this.options.config.generatorOptions.postModifiers)&&this.options.config.generatorOptions.postModifiers.length>0}}export default SlugElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/TextElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/TextElement.js deleted file mode 100644 index e1913d66e07550b99fdfc6f9b2bd87fbaa4660c0..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/TextElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{Resizable}from"TYPO3/CMS/Backend/FormEngine/Element/Modifier/Resizable.js";import{Tabbable}from"TYPO3/CMS/Backend/FormEngine/Element/Modifier/Tabbable.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class TextElement{constructor(e){this.element=null,DocumentService.ready().then(()=>{this.element=document.getElementById(e),Resizable.enable(this.element),Tabbable.enable(this.element)})}}export default TextElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/TextTableElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/TextTableElement.js deleted file mode 100644 index dcc7653c441beecdbac6024c68ccb5d31e926d99..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/TextTableElement.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{Resizable}from"TYPO3/CMS/Backend/FormEngine/Element/Modifier/Resizable.js";import{Tabbable}from"TYPO3/CMS/Backend/FormEngine/Element/Modifier/Tabbable.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class TextTableElement{constructor(e){this.element=null,DocumentService.ready().then(()=>{this.element=document.getElementById(e),Resizable.enable(this.element),Tabbable.enable(this.element)})}}export default TextTableElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/AddRecord.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/AddRecord.js deleted file mode 100644 index 8af4b0e7b9c08faba5227dd8cbd38a195f362a51..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/AddRecord.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";class AddRecord{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault(),FormEngine.preventFollowLinkIfNotSaved(this.controlElement.getAttribute("href"))},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default AddRecord; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/EditPopup.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/EditPopup.js deleted file mode 100644 index edfdf51c27db0a96f23d63b721f6dd26828507d2..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/EditPopup.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class EditPopup{constructor(e){this.controlElement=null,this.assignedFormField=null,this.registerChangeHandler=()=>{this.controlElement.classList.toggle("disabled",-1===this.assignedFormField.options.selectedIndex)},this.registerClickHandler=e=>{e.preventDefault();const t=[];for(let e=0;e<this.assignedFormField.selectedOptions.length;++e){const s=this.assignedFormField.selectedOptions.item(e);t.push(s.value)}const s=this.controlElement.getAttribute("href")+"&P[currentValue]="+encodeURIComponent(this.assignedFormField.value)+"&P[currentSelectedValues]="+t.join(",");window.open(s,"",this.controlElement.dataset.windowParameters).focus()},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.assignedFormField=document.querySelector('select[data-formengine-input-name="'+this.controlElement.dataset.element+'"]'),-1===this.assignedFormField.options.selectedIndex&&this.controlElement.classList.add("disabled"),this.assignedFormField.addEventListener("change",this.registerChangeHandler),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default EditPopup; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/InsertClipboard.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/InsertClipboard.js deleted file mode 100644 index 3176ce1c1e22521e59de64dfd65627cbe04019d7..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/InsertClipboard.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";class InsertClipboard{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault();const t=this.controlElement.dataset.element,r=JSON.parse(this.controlElement.dataset.clipboardItems);for(let e of r)FormEngine.setSelectOptionFromExternalSource(t,e.value,e.title,e.title)},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default InsertClipboard; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/LinkPopup.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/LinkPopup.js deleted file mode 100644 index 5d2a26ab9fe28923d0ca14353f43937218acf8a4..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/LinkPopup.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";import Modal from"TYPO3/CMS/Backend/Modal.js";class LinkPopup{constructor(e){this.controlElement=null,this.handleControlClick=e=>{e.preventDefault();const t=this.controlElement.dataset.itemName,o=this.controlElement.getAttribute("href")+"&P[currentValue]="+encodeURIComponent(document.forms.namedItem("editform")[t].value)+"&P[currentSelectedValues]="+encodeURIComponent(FormEngine.getFieldElement(t).val());Modal.advanced({type:Modal.types.iframe,content:o,size:Modal.sizes.large})},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.handleControlClick)})}}export default LinkPopup; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/ListModule.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/ListModule.js deleted file mode 100644 index 8e64b9d1787bf859710600386fe792c7adba0843..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/ListModule.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";class ListModule{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault(),FormEngine.preventFollowLinkIfNotSaved(this.controlElement.getAttribute("href"))},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default ListModule; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/ResetSelection.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/ResetSelection.js deleted file mode 100644 index 6dfc14ab7c01eb124180c1fc7b11f24a76e59137..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/ResetSelection.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class ResetSelection{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault();const t=this.controlElement.dataset.itemName,n=JSON.parse(this.controlElement.dataset.selectedIndices),o=document.forms.namedItem("editform").querySelector('[name="'+t+'[]"]');o.selectedIndex=-1;for(let e of n)o.options[e].selected=!0},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),null!==this.controlElement&&this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default ResetSelection; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/TableWizard.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/TableWizard.js deleted file mode 100644 index c5d410c00c286af46f694f412de2611a08ef1721..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldControl/TableWizard.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";class TableWizard{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault(),FormEngine.preventFollowLinkIfNotSaved(this.controlElement.getAttribute("href"))},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default TableWizard; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldWizard/LocalizationStateSelector.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldWizard/LocalizationStateSelector.js deleted file mode 100644 index 8f22655814c3b796cdd7eec150a8708faa2bb0e5..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldWizard/LocalizationStateSelector.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var States;!function(e){e.CUSTOM="custom"}(States||(States={}));class LocalizationStateSelector{constructor(e){DocumentService.ready().then(()=>{this.registerEventHandler(e)})}registerEventHandler(e){new RegularEvent("change",e=>{const t=e.target,a=t.closest(".t3js-formengine-field-item")?.querySelector("[data-formengine-input-name]");if(!a)return;const n=a.dataset.lastL10nState||!1,r=t.value;n&&r===n||(r===States.CUSTOM?(n&&(t.dataset.originalLanguageValue=a.value),a.disabled=!1):(n===States.CUSTOM&&(t.closest(".t3js-l10n-state-container").querySelector(".t3js-l10n-state-custom").dataset.originalLanguageValue=a.value),a.disabled=!0),a.value=t.dataset.originalLanguageValue,a.dispatchEvent(new Event("change")),a.dataset.lastL10nState=t.value)}).delegateTo(document,'.t3js-l10n-state-container input[type="radio"][name="'+e+'"]')}}export default LocalizationStateSelector; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldWizard/ValueSlider.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldWizard/ValueSlider.js deleted file mode 100644 index 6fddbeb8e534e966384310486c16f8cb709822e3..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldWizard/ValueSlider.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import ThrottleEvent from"TYPO3/CMS/Core/Event/ThrottleEvent.js";class ValueSlider{constructor(e){this.controlElement=null,this.handleRangeChange=e=>{const t=e.target;ValueSlider.updateValue(t),ValueSlider.updateTooltipValue(t)},this.controlElement=document.getElementById(e),new ThrottleEvent("input",this.handleRangeChange,25).bindTo(this.controlElement)}static updateValue(e){const t=document.querySelector(`[data-formengine-input-name="${e.dataset.sliderItemName}"]`);t.value=e.value,t.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}static updateTooltipValue(e){let t;const a=e.value;switch(e.dataset.sliderValueType){case"double":t=parseFloat(a).toFixed(2);break;case"int":default:t=parseInt(a,10)}e.title=t.toString()}}export default ValueSlider; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/InlineRelation/AjaxDispatcher.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/InlineRelation/AjaxDispatcher.js deleted file mode 100644 index b7ff99b2289c0810e7d9387cc96c6c3eaae2c66f..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/InlineRelation/AjaxDispatcher.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import{JavaScriptItemProcessor}from"TYPO3/CMS/Core/JavaScriptItemProcessor.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import Utility from"TYPO3/CMS/Backend/Utility.js";export class AjaxDispatcher{constructor(e){this.objectGroup=null,this.objectGroup=e}newRequest(e){return new AjaxRequest(e)}getEndpoint(e){if(void 0!==TYPO3.settings.ajaxUrls[e])return TYPO3.settings.ajaxUrls[e];throw'Undefined endpoint for route "'+e+'"'}send(e,t){const s=e.post(this.createRequestBody(t)).then(async e=>this.processResponse(await e.resolve()));return s.catch(e=>{Notification.error("Error "+e.message)}),s}createRequestBody(e){const t={};for(let s=0;s<e.length;s++)t["ajax["+s+"]"]=e[s];return t["ajax[context]"]=JSON.stringify(this.getContext()),t}getContext(){let e;return void 0!==TYPO3.settings.FormEngineInline.config[this.objectGroup]&&void 0!==TYPO3.settings.FormEngineInline.config[this.objectGroup].context&&(e=TYPO3.settings.FormEngineInline.config[this.objectGroup].context),e}processResponse(json){if(json.hasErrors)for(const e of json.messages)Notification.error(e.title,e.message);if(json.stylesheetFiles)for(const[e,t]of json.stylesheetFiles.entries()){if(!t)break;const s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.href=t,document.querySelector("head").appendChild(s),delete json.stylesheetFiles[e]}if("object"==typeof json.inlineData&&(TYPO3.settings.FormEngineInline=Utility.mergeDeep(TYPO3.settings.FormEngineInline,json.inlineData)),json.scriptItems instanceof Array&&json.scriptItems.length>0){const e=new JavaScriptItemProcessor;e.processItems(json.scriptItems)}if("object"==typeof json.requireJsModules)for(let e of json.requireJsModules)new Function(e)();if(json.scriptCall&&json.scriptCall.length>0)for(const scriptCall of json.scriptCall)eval(scriptCall);return json}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/RequestUpdate.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/RequestUpdate.js deleted file mode 100644 index b68d03f14c8778889f90c2bcb6270c41804a21fe..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/RequestUpdate.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var UpdateMode,__decorate=function(e,t,o,r){var n,d=arguments.length,c=d<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(c=(d<3?n(c):d>3?n(t,o,c):n(t,o))||c);return d>3&&c&&Object.defineProperty(t,o,c),c};import{LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";!function(e){e.ask="ask",e.enforce="enforce"}(UpdateMode||(UpdateMode={}));const selectorConverter={fromAttribute:e=>document.querySelectorAll(e)};let RequestUpdate=class extends LitElement{constructor(){super(...arguments),this.mode=UpdateMode.ask,this.requestFormEngineUpdate=()=>{const e=this.mode===UpdateMode.ask;FormEngine.requestFormEngineUpdate(e)}}connectedCallback(){super.connectedCallback();for(let e of this.fields)e.addEventListener("change",this.requestFormEngineUpdate)}disconnectedCallback(){super.disconnectedCallback();for(let e of this.fields)e.removeEventListener("change",this.requestFormEngineUpdate)}};__decorate([property({type:String,attribute:"mode"})],RequestUpdate.prototype,"mode",void 0),__decorate([property({attribute:"field",converter:selectorConverter})],RequestUpdate.prototype,"fields",void 0),RequestUpdate=__decorate([customElement("typo3-formengine-updater")],RequestUpdate); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineLinkBrowserAdapter.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineLinkBrowserAdapter.js deleted file mode 100644 index 9142c2e10171468bd85f321f966928de30252297..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineLinkBrowserAdapter.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import Modal from"TYPO3/CMS/Backend/Modal.js";export default(function(){const e={onFieldChangeItems:null,setOnFieldChangeItems:function(n){e.onFieldChangeItems=n},checkReference:function(){const n='form[name="'+LinkBrowser.parameters.formName+'"] [data-formengine-input-name="'+LinkBrowser.parameters.itemName+'"]',t=e.getParent();if(t&&t.document&&t.document.querySelector(n))return t.document.querySelector(n);Modal.dismiss()}};return LinkBrowser.finalizeFunction=function(n){const t=e.checkReference();if(t){const r=LinkBrowser.getLinkAttributeValues();r.url=n,$.ajax({url:TYPO3.settings.ajaxUrls.link_browser_encodetypolink,data:r,method:"GET"}).done((function(n){n.typoLink&&(t.value=n.typoLink,t.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})),e.onFieldChangeItems instanceof Array&&e.getParent().TYPO3.FormEngine.processOnFieldChange(e.onFieldChangeItems),Modal.dismiss())}))}},e.getParent=function(){let e;return void 0!==window.parent&&void 0!==window.parent.document.list_frame&&null!==window.parent.document.list_frame.parent.document.querySelector(".t3js-modal-iframe")?e=window.parent.document.list_frame:void 0!==window.parent&&void 0!==window.parent.frames.list_frame&&null!==window.parent.frames.list_frame.parent.document.querySelector(".t3js-modal-iframe")?e=window.parent.frames.list_frame:void 0!==window.frames&&void 0!==window.frames.frameElement&&null!==window.frames.frameElement&&window.frames.frameElement.classList.contains("t3js-modal-iframe")?e=window.frames.frameElement.contentWindow.parent:window.opener&&(e=window.opener),e},e}()); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineReview.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineReview.js deleted file mode 100644 index 2b127021448610c9042ba3e95c946b366c744651..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineReview.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";class FormEngineReview{constructor(){this.checkForReviewableField=()=>{const t=this,e=FormEngineReview.findInvalidField(),i=$("."+this.toggleButtonClass);if(e.length>0){const n=$("<div />",{class:"list-group"});e.each((function(){const e=$(this),i=e.find("[data-formengine-validation-rules]");let o=i.attr("id");void 0===o&&(o=i.parent().children("[id]").first().attr("id")),n.append($("<a />",{class:"list-group-item "+t.fieldListItemClass,"data-field-id":o,href:"#"}).text(e.find(t.labelSelector).text()))})),i.removeClass("hidden");const o=i.data("bs.popover");o&&(o.options.html=!0,o.options.content=n.wrapAll("<div>").parent().html(),o.setContent(o.$tip),o.$tip.addClass(o.options.placement))}else i.addClass("hidden").popover("hide")},this.switchToField=t=>{t.preventDefault();const e=$(t.currentTarget).data("fieldId"),i=$("#"+e);i.parents('[id][role="tabpanel"]').each((function(){$('[aria-controls="'+$(this).attr("id")+'"]').tab("show")})),i.focus()},this.toggleButtonClass="t3js-toggle-review-panel",this.fieldListItemClass="t3js-field-item",this.labelSelector=".t3js-formengine-label",this.initialize()}static findInvalidField(){return $(document).find(".tab-content ."+FormEngine.Validation.errorClass)}static attachButtonToModuleHeader(t){const e=$(".t3js-module-docheader-bar-buttons").children().last().find('[role="toolbar"]'),i=$("<a />",{class:"btn btn-danger btn-sm hidden "+t.toggleButtonClass,href:"#",title:TYPO3.lang["buttons.reviewFailedValidationFields"]}).append($("<span />",{class:"fa fa-fw fa-info"}));i.popover({container:"body",html:!0,placement:"bottom"}),e.prepend(i)}initialize(){const t=this,e=$(document);$(()=>{FormEngineReview.attachButtonToModuleHeader(t)}),e.on("click","."+this.fieldListItemClass,this.switchToField),e.on("t3-formengine-postfieldvalidation",this.checkForReviewableField)}}export default new FormEngineReview; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineSuggest.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineSuggest.js deleted file mode 100644 index edf27abaed585354fbbc5ee9c9b60516433bedf0..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineSuggest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import"jquery/autocomplete.js";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";class FormEngineSuggest{constructor(e){$(()=>{this.initialize(e)})}initialize(e){const t=e.closest(".t3-form-suggest-container"),a=e.dataset.tablename,o=e.dataset.fieldname,n=e.dataset.field,s=parseInt(e.dataset.uid,10),i=parseInt(e.dataset.pid,10),r=e.dataset.datastructureidentifier,l=e.dataset.flexformsheetname,d=e.dataset.flexformfieldname,m=e.dataset.flexformcontainername,u=e.dataset.flexformcontainerfieldname,c=parseInt(e.dataset.minchars,10),p=TYPO3.settings.ajaxUrls.record_suggest,f={tableName:a,fieldName:o,uid:s,pid:i,dataStructureIdentifier:r,flexFormSheetName:l,flexFormFieldName:d,flexFormContainerName:m,flexFormContainerFieldName:u};$(e).autocomplete({serviceUrl:p,params:f,type:"POST",paramName:"value",dataType:"json",minChars:c,groupBy:"typeLabel",containerClass:"autocomplete-results",appendTo:t,forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,noSuggestionNotice:'<div class="autocomplete-info">No results</div>',minLength:c,preventBadQueries:!1,transformResult:e=>({suggestions:e.map(e=>({value:e.text,data:e}))}),formatResult:e=>$("<div>").append($('<a class="autocomplete-suggestion-link" href="#">'+e.data.sprite+e.data.text+"</a></div>").attr({"data-label":e.data.label,"data-table":e.data.table,"data-uid":e.data.uid})).html(),onSearchComplete:function(){t.classList.add("open")},beforeRender:function(e){e.attr("style",""),t.classList.add("open")},onHide:function(){t.classList.remove("open")},onSelect:function(){!function(t){let a="";a="select"===e.dataset.fieldtype?t.dataset.uid:t.dataset.table+"_"+t.dataset.uid,FormEngine.setSelectOptionFromExternalSource(n,a,t.dataset.label,t.dataset.label),FormEngine.Validation.markFieldAsChanged($(document.querySelector('input[name="'+n+'"]')))}(t.querySelector(".autocomplete-selected a"))}})}}export default FormEngineSuggest; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js deleted file mode 100644 index 59dbf5fc9dc58cf6a1c77eea94ce38e08e2e642b..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import moment from"moment";import Md5 from"TYPO3/CMS/Backend/Hashing/Md5.js";import DocumentSaveActions from"TYPO3/CMS/Backend/DocumentSaveActions.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Severity from"TYPO3/CMS/Backend/Severity.js";export default(function(){const FormEngineValidation={rulesSelector:"[data-formengine-validation-rules]",inputSelector:"[data-formengine-input-params]",markerSelector:".t3js-formengine-validation-marker",groupFieldHiddenElement:".t3js-formengine-field-group input[type=hidden]",relatedFieldSelector:"[data-relatedfieldname]",errorClass:"has-error",lastYear:0,lastDate:0,lastTime:0,passwordDummy:"********"},customEvaluations=new Map;return FormEngineValidation.initialize=function(){$(document).find("."+FormEngineValidation.errorClass).removeClass(FormEngineValidation.errorClass),FormEngineValidation.initializeInputFields().promise().done((function(){$(document).on("change",FormEngineValidation.rulesSelector,e=>{FormEngineValidation.validateField(e.currentTarget),FormEngineValidation.markFieldAsChanged(e.currentTarget)}),FormEngineValidation.registerSubmitCallback()}));const e=new Date;FormEngineValidation.lastYear=FormEngineValidation.getYear(e),FormEngineValidation.lastDate=FormEngineValidation.getDate(e),FormEngineValidation.lastTime=0,FormEngineValidation.validate()},FormEngineValidation.initializeInputFields=function(){return $(document).find(FormEngineValidation.inputSelector).each((function(e,n){const t=$(n).data("formengine-input-params"),a=t.field,i=$('[name="'+a+'"]');void 0===i.data("main-field")&&(i.data("main-field",a),i.data("config",t),FormEngineValidation.initializeInputField(a))}))},FormEngineValidation.initializeInputField=function(e){const n=$('[name="'+e+'"]'),t=$('[data-formengine-input-name="'+e+'"]');let a=$('[name="'+n.data("main-field")+'"]');0===a.length&&(a=n);const i=a.data("config");if(void 0!==i){const e=FormEngineValidation.trimExplode(",",i.evalList);let a=n.val();for(let n=0;n<e.length;n++)a=FormEngineValidation.formatValue(e[n],a,i);a.length&&"password"!==t.attr("type")&&t.val(a)}t.data("main-field",e),t.data("config",i),t.on("change",(function(){FormEngineValidation.updateInputField(t.attr("data-formengine-input-name"))})),t.attr("data-formengine-input-initialized","true")},FormEngineValidation.registerCustomEvaluation=function(e,n){customEvaluations.has(e)||customEvaluations.set(e,n)},FormEngineValidation.formatValue=function(e,n,t){let a,i,o="";switch(e){case"date":if(n.toString().indexOf("-")>0){o=moment.utc(n).format("DD-MM-YYYY")}else{if(a=1*n,!a)return"";i=new Date(1e3*a);o=i.getUTCDate().toString(10).padStart(2,"0")+"-"+(i.getUTCMonth()+1).toString(10).padStart(2,"0")+"-"+this.getYear(i)}break;case"datetime":if(n.toString().indexOf("-")<=0&&!("number"==typeof n?n:parseInt(n)))return"";o=FormEngineValidation.formatValue("time",n,t)+" "+FormEngineValidation.formatValue("date",n,t);break;case"time":case"timesec":let r;if(n.toString().indexOf("-")>0)r=moment.utc(n);else{if(a="number"==typeof n?n:parseInt(n),!a&&"0"!==n.toString())return"";r=moment.unix(a).utc()}o="timesec"===e?r.format("HH:mm:ss"):r.format("HH:mm");break;case"password":o=n?FormEngineValidation.passwordDummy:"";break;default:o=n}return o},FormEngineValidation.updateInputField=function(e){const n=$('[name="'+e+'"]');let t=$('[name="'+n.data("main-field")+'"]');0===t.length&&(t=n);const a=$('[data-formengine-input-name="'+t.attr("name")+'"]'),i=t.data("config");if(void 0!==i){const e=FormEngineValidation.trimExplode(",",i.evalList);let n=a.val();for(let t=0;t<e.length;t++)n=FormEngineValidation.processValue(e[t],n,i);let o=n;for(let n=0;n<e.length;n++)o=FormEngineValidation.formatValue(e[n],o,i);t.val(n),t.get(0).dispatchEvent(new Event("change")),a.val(o)}},FormEngineValidation.validateField=function(e,n){const t=e instanceof $?e.get(0):e;if(n=n||t.value||"",void 0===t.dataset.formengineValidationRules)return n;const a=JSON.parse(t.dataset.formengineValidationRules);let i,o,r,l=!1,s=0,m=n;$.isArray(n)||(n=FormEngineValidation.ltrim(n)),$.each(a,(function(e,a){if(l)return!1;switch(a.type){case"required":""===n&&(l=!0,t.closest(FormEngineValidation.markerSelector).classList.add(FormEngineValidation.errorClass));break;case"range":if(""!==n){if((a.minItems||a.maxItems)&&(i=$(document).find('[name="'+t.dataset.relatedfieldname+'"]'),s=i.length?FormEngineValidation.trimExplode(",",i.val()).length:t.value,void 0!==a.minItems&&(o=1*a.minItems,!isNaN(o)&&s<o&&(l=!0)),void 0!==a.maxItems&&(r=1*a.maxItems,!isNaN(r)&&s>r&&(l=!0))),void 0!==a.lower){const e=1*a.lower;!isNaN(e)&&n<e&&(l=!0)}if(void 0!==a.upper){const e=1*a.upper;!isNaN(e)&&n>e&&(l=!0)}}break;case"select":case"category":(a.minItems||a.maxItems)&&(i=$(document).find('[name="'+t.dataset.relatedfieldname+'"]'),s=i.length?FormEngineValidation.trimExplode(",",i.val()).length:t instanceof HTMLSelectElement?t.querySelectorAll("option:checked").length:t.querySelectorAll("input[value]:checked").length,void 0!==a.minItems&&(o=1*a.minItems,!isNaN(o)&&s<o&&(l=!0)),void 0!==a.maxItems&&(r=1*a.maxItems,!isNaN(r)&&s>r&&(l=!0)));break;case"group":case"inline":(a.minItems||a.maxItems)&&(s=FormEngineValidation.trimExplode(",",t.value).length,void 0!==a.minItems&&(o=1*a.minItems,!isNaN(o)&&s<o&&(l=!0)),void 0!==a.maxItems&&(r=1*a.maxItems,!isNaN(r)&&s>r&&(l=!0)))}}));const d=!l;return t.closest(FormEngineValidation.markerSelector).classList.toggle(FormEngineValidation.errorClass,!d),FormEngineValidation.markParentTab($(t),d),$(document).trigger("t3-formengine-postfieldvalidation"),m},FormEngineValidation.processValue=function(e,n,t){let a="",i="",o="",r=0,l=n;switch(e){case"alpha":case"num":case"alphanum":case"alphanum_x":for(a="",r=0;r<n.length;r++){const t=n.substr(r,1);let i="_"===t||"-"===t,o=t>="a"&&t<="z"||t>="A"&&t<="Z",l=t>="0"&&t<="9";switch(e){case"alphanum":i=!1;break;case"alpha":l=!1,i=!1;break;case"num":o=!1,i=!1}(o||l||i)&&(a+=t)}a!==n&&(l=a);break;case"is_in":if(t.is_in){i=""+n,t.is_in=t.is_in.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");const e=new RegExp("[^"+t.is_in+"]+","g");a=i.replace(e,"")}else a=i;l=a;break;case"nospace":l=(""+n).replace(/ /g,"");break;case"md5":""!==n&&(l=Md5.hash(n));break;case"upper":l=n.toUpperCase();break;case"lower":l=n.toLowerCase();break;case"int":""!==n&&(l=FormEngineValidation.parseInt(n));break;case"double2":""!==n&&(l=FormEngineValidation.parseDouble(n));break;case"trim":l=String(n).trim();break;case"datetime":""!==n&&(o=n.substr(0,1),l=FormEngineValidation.parseDateTime(n));break;case"date":""!==n&&(o=n.substr(0,1),l=FormEngineValidation.parseDate(n));break;case"time":case"timesec":""!==n&&(o=n.substr(0,1),l=FormEngineValidation.parseTime(n,e));break;case"year":""!==n&&(o=n.substr(0,1),l=FormEngineValidation.parseYear(n));break;case"null":case"password":break;default:customEvaluations.has(e)?l=customEvaluations.get(e).call(null,n):"object"==typeof TBE_EDITOR&&void 0!==TBE_EDITOR.customEvalFunctions&&"function"==typeof TBE_EDITOR.customEvalFunctions[e]&&(l=TBE_EDITOR.customEvalFunctions[e](n))}return l},FormEngineValidation.validate=function(e){(void 0===e||e instanceof Document)&&$(document).find(FormEngineValidation.markerSelector+", .t3js-tabmenu-item").removeClass(FormEngineValidation.errorClass).removeClass("has-validation-error");const n=e||document;$(n).find(FormEngineValidation.rulesSelector).each((e,n)=>{const t=$(n);if(!t.closest(".t3js-flex-section-deleted, .t3js-inline-record-deleted").length){let e=!1;const n=t.val(),a=FormEngineValidation.validateField(t,n);if($.isArray(a)&&$.isArray(n)){if(a.length!==n.length)e=!0;else for(let t=0;t<a.length;t++)if(a[t]!==n[t]){e=!0;break}}else a.length&&n!==a&&(e=!0);e&&t.val(a)}})},FormEngineValidation.markFieldAsChanged=function(e){if(e instanceof $&&(e=e.get(0)),!(e instanceof HTMLElement))return;e.closest(".t3js-formengine-palette-field").classList.add("has-change")},FormEngineValidation.trimExplode=function(e,n){const t=[],a=n.split(e);for(let e=0;e<a.length;e++){const n=a[e].trim();n.length>0&&t.push(n)}return t},FormEngineValidation.parseInt=function(e){let n;return e?(n=parseInt(""+e,10),isNaN(n)?0:n):0},FormEngineValidation.parseDouble=function(e){let n=""+e;n=n.replace(/[^0-9,\.-]/g,"");const t="-"===n.substring(0,1);n=n.replace(/-/g,""),n=n.replace(/,/g,"."),-1===n.indexOf(".")&&(n+=".0");const a=n.split("."),i=a.pop();let o=Number(a.join("")+"."+i);return t&&(o*=-1),n=o.toFixed(2),n},FormEngineValidation.ltrim=function(e){return e?(""+e).replace(/^\s+/,""):""},FormEngineValidation.btrim=function(e){return e?(""+e).replace(/\s+$/,""):""},FormEngineValidation.parseDateTime=function(e){const n=e.indexOf(" ");if(-1!==n){const t=FormEngineValidation.parseDate(e.substr(n,e.length));FormEngineValidation.lastTime=t+FormEngineValidation.parseTime(e.substr(0,n),"time")}else FormEngineValidation.lastTime=FormEngineValidation.parseDate(e);return FormEngineValidation.lastTime},FormEngineValidation.parseDate=function(e){const n=new Date;let t=FormEngineValidation.split(e);if(t.values[1]&&t.values[1].length>2){const e=t.values[1];t=FormEngineValidation.splitSingle(e)}const a=t.values[3]?FormEngineValidation.parseInt(t.values[3]):FormEngineValidation.getYear(n),i=t.values[2]?FormEngineValidation.parseInt(t.values[2]):n.getUTCMonth()+1,o=t.values[1]?FormEngineValidation.parseInt(t.values[1]):n.getUTCDate(),r=moment.utc();return r.year(parseInt(a)).month(parseInt(i)-1).date(parseInt(o)).hour(0).minute(0).second(0),FormEngineValidation.lastDate=r.unix(),FormEngineValidation.lastDate},FormEngineValidation.parseTime=function(e,n){const t=new Date;let a=FormEngineValidation.split(e);if(a.values[1]&&a.values[1].length>2){const e=a.values[1];a=FormEngineValidation.splitSingle(e)}const i=a.values[3]?FormEngineValidation.parseInt(a.values[3]):t.getUTCSeconds(),o=a.values[2]?FormEngineValidation.parseInt(a.values[2]):t.getUTCMinutes(),r=a.values[1]?FormEngineValidation.parseInt(a.values[1]):t.getUTCHours(),l=moment.utc();return l.year(1970).month(0).date(1).hour(r).minute(o).second("timesec"===n?i:0),FormEngineValidation.lastTime=l.unix(),FormEngineValidation.lastTime<0&&(FormEngineValidation.lastTime+=86400),FormEngineValidation.lastTime},FormEngineValidation.parseYear=function(e){const n=new Date,t=FormEngineValidation.split(e);return FormEngineValidation.lastYear=t.values[1]?FormEngineValidation.parseInt(t.values[1]):FormEngineValidation.getYear(n),FormEngineValidation.lastYear},FormEngineValidation.getYear=function(e){return null===e?null:e.getUTCFullYear()},FormEngineValidation.getDate=function(e){const n=new Date(FormEngineValidation.getYear(e),e.getUTCMonth(),e.getUTCDate());return FormEngineValidation.getTimestamp(n)},FormEngineValidation.pol=function(foreign,value){return eval(("-"==foreign?"-":"")+value)},FormEngineValidation.convertClientTimestampToUTC=function(e,n){const t=new Date(1e3*e);return t.setTime(1e3*(e-60*t.getTimezoneOffset())),n?FormEngineValidation.getTime(t):FormEngineValidation.getTimestamp(t)},FormEngineValidation.getTimestamp=function(e){return Date.parse(e instanceof Date?e.toISOString():e)/1e3},FormEngineValidation.getTime=function(e){return 60*e.getUTCHours()*60+60*e.getUTCMinutes()+FormEngineValidation.getSecs(e)},FormEngineValidation.getSecs=function(e){return e.getUTCSeconds()},FormEngineValidation.getTimeSecs=function(e){return 60*e.getHours()*60+60*e.getMinutes()+e.getSeconds()},FormEngineValidation.markParentTab=function(e,n){e.parents(".tab-pane").each((function(e,t){const a=$(t);n&&(n=0===a.find(".has-error").length);const i=a.attr("id");$(document).find('a[href="#'+i+'"]').closest(".t3js-tabmenu-item").toggleClass("has-validation-error",!n)}))},FormEngineValidation.splitSingle=function(e){const n=""+e,t={values:[],pointer:3};return t.values[1]=n.substr(0,2),t.values[2]=n.substr(2,2),t.values[3]=n.substr(4,10),t},FormEngineValidation.splitStr=function(e,n,t){const a=""+e,i=n.length;let o=-i;t<1&&(t=1);for(let e=1;e<t;e++)if(o=a.indexOf(n,o+i),-1==o)return null;let r=a.indexOf(n,o+i);return-1==r&&(r=a.length),a.substring(o+i,r)},FormEngineValidation.split=function(e){const n={values:[],valPol:[],pointer:0,numberMode:0,theVal:""};e+=" ";for(let t=0;t<e.length;t++){const a=e.substr(t,1);a<"0"||a>"9"?(n.numberMode&&(n.pointer++,n.values[n.pointer]=n.theVal,n.theVal="",n.numberMode=0),"+"!=a&&"-"!=a||(n.valPol[n.pointer+1]=a)):(n.theVal+=a,n.numberMode=1)}return n},FormEngineValidation.registerSubmitCallback=function(){DocumentSaveActions.getInstance().addPreSubmitCallback((function(e){$("."+FormEngineValidation.errorClass).length>0&&(Modal.confirm(TYPO3.lang.alert||"Alert",TYPO3.lang["FormEngine.fieldsMissing"],Severity.error,[{text:TYPO3.lang["button.ok"]||"OK",active:!0,btnClass:"btn-default",name:"ok"}]).on("button.clicked",(function(){Modal.dismiss()})),e.stopImmediatePropagation())}))},FormEngineValidation}()); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/GlobalEventHandler.js b/typo3/sysext/backend/Resources/Public/JavaScript/GlobalEventHandler.js deleted file mode 100644 index eabe36993ac672511e0f2ae0d2d2c09c6c7db28e..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/GlobalEventHandler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import documentService from"TYPO3/CMS/Core/DocumentService.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class GlobalEventHandler{constructor(){this.options={onChangeSelector:'[data-global-event="change"]',onClickSelector:'[data-global-event="click"]',onSubmitSelector:'form[data-global-event="submit"]'},documentService.ready().then(()=>this.registerEvents())}registerEvents(){new RegularEvent("change",this.handleChangeEvent.bind(this)).delegateTo(document,this.options.onChangeSelector),new RegularEvent("click",this.handleClickEvent.bind(this)).delegateTo(document,this.options.onClickSelector),new RegularEvent("submit",this.handleSubmitEvent.bind(this)).delegateTo(document,this.options.onSubmitSelector)}handleChangeEvent(e,t){e.preventDefault(),this.handleFormChildSubmitAction(e,t)||this.handleFormChildNavigateAction(e,t)}handleClickEvent(e,t){e.preventDefault()}handleSubmitEvent(e,t){e.preventDefault(),this.handleFormNavigateAction(e,t)}handleFormChildSubmitAction(e,t){const n=t.dataset.actionSubmit;if(!n)return!1;if("$form"===n&&this.isHTMLFormChildElement(t))return t.form.submit(),!0;const a=document.querySelector(n);return a instanceof HTMLFormElement&&(a.submit(),!0)}handleFormChildNavigateAction(e,t){const n=t.dataset.actionNavigate;if(!n)return!1;const a=this.resolveHTMLFormChildElementValue(t),l=t.dataset.navigateValue;return"$data=~s/$value/"===n&&l&&null!==a?(window.location.href=this.substituteValueVariable(l,a),!0):"$data"===n&&l?(window.location.href=l,!0):!("$value"!==n||!a)&&(window.location.href=a,!0)}handleFormNavigateAction(e,t){const n=t.action,a=t.dataset.actionNavigate;if(!n||!a)return!1;const l=t.dataset.navigateValue,i=t.dataset.valueSelector,o=this.resolveHTMLFormChildElementValue(t.querySelector(i));return"$form=~s/$value/"===a&&l&&null!==o?(window.location.href=this.substituteValueVariable(l,o),!0):"$form"===a&&(window.location.href=n,!0)}substituteValueVariable(e,t){return e.replace(/(\$\{value\}|%24%7Bvalue%7D|\$\[value\]|%24%5Bvalue%5D)/gi,t)}isHTMLFormChildElement(e){return e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement}resolveHTMLFormChildElementValue(e){const t=e.getAttribute("type");if(e instanceof HTMLSelectElement)return e.options[e.selectedIndex].value;if(e instanceof HTMLInputElement&&"checkbox"===t){const t=e.dataset.emptyValue;return e.checked?e.value:void 0!==t?t:""}return e instanceof HTMLInputElement?e.value:null}}export default new GlobalEventHandler; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/GridEditor.js b/typo3/sysext/backend/Resources/Public/JavaScript/GridEditor.js deleted file mode 100644 index 8f76fcaa16813487223c6b8af27e569b4ddbde83..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/GridEditor.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import"bootstrap";import $ from"jquery";import Modal from"TYPO3/CMS/Backend/Modal.js";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";export class GridEditor{constructor(t=null){this.colCount=1,this.rowCount=1,this.readOnly=!1,this.nameLabel="name",this.columnLabel="column label",this.defaultCell={spanned:0,rowspan:1,colspan:1,name:"",colpos:"",column:void 0},this.selectorEditor=".t3js-grideditor",this.selectorAddColumn=".t3js-grideditor-addcolumn",this.selectorRemoveColumn=".t3js-grideditor-removecolumn",this.selectorAddRowTop=".t3js-grideditor-addrow-top",this.selectorRemoveRowTop=".t3js-grideditor-removerow-top",this.selectorAddRowBottom=".t3js-grideditor-addrow-bottom",this.selectorRemoveRowBottom=".t3js-grideditor-removerow-bottom",this.selectorLinkEditor=".t3js-grideditor-link-editor",this.selectorLinkExpandRight=".t3js-grideditor-link-expand-right",this.selectorLinkShrinkLeft=".t3js-grideditor-link-shrink-left",this.selectorLinkExpandDown=".t3js-grideditor-link-expand-down",this.selectorLinkShrinkUp=".t3js-grideditor-link-shrink-up",this.selectorConfigPreview=".t3js-grideditor-preview-config",this.selectorPreviewArea=".t3js-tsconfig-preview-area",this.selectorCodeMirror=".t3js-grideditor-preview-config .CodeMirror",this.modalButtonClickHandler=t=>{const e=t.target;"cancel"===e.name?Modal.currentModal.trigger("modal-dismiss"):"ok"===e.name&&(this.setName(Modal.currentModal.find(".t3js-grideditor-field-name").val(),Modal.currentModal.data("col"),Modal.currentModal.data("row")),this.setColumn(Modal.currentModal.find(".t3js-grideditor-field-colpos").val(),Modal.currentModal.data("col"),Modal.currentModal.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord()),Modal.currentModal.trigger("modal-dismiss"))},this.addColumnHandler=t=>{t.preventDefault(),this.addColumn(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.removeColumnHandler=t=>{t.preventDefault(),this.removeColumn(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.addRowTopHandler=t=>{t.preventDefault(),this.addRowTop(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.addRowBottomHandler=t=>{t.preventDefault(),this.addRowBottom(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.removeRowTopHandler=t=>{t.preventDefault(),this.removeRowTop(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.removeRowBottomHandler=t=>{t.preventDefault(),this.removeRowBottom(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.linkEditorHandler=t=>{t.preventDefault();const e=$(t.target);this.showOptions(e.data("col"),e.data("row"))},this.linkExpandRightHandler=t=>{t.preventDefault();const e=$(t.target);this.addColspan(e.data("col"),e.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.linkShrinkLeftHandler=t=>{t.preventDefault();const e=$(t.target);this.removeColspan(e.data("col"),e.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.linkExpandDownHandler=t=>{t.preventDefault();const e=$(t.target);this.addRowspan(e.data("col"),e.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.linkShrinkUpHandler=t=>{t.preventDefault();const e=$(t.target);this.removeRowspan(e.data("col"),e.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord())};const e=$(this.selectorEditor);this.colCount=e.data("colcount"),this.rowCount=e.data("rowcount"),this.readOnly=e.data("readonly"),this.field=$('input[name="'+e.data("field")+'"]'),this.data=e.data("data"),this.nameLabel=null!==t?t.nameLabel:"Name",this.columnLabel=null!==t?t.columnLabel:"Column",this.targetElement=$(this.selectorEditor),this.initializeEvents(),this.addVisibilityObserver(e.get(0)),this.drawTable(),this.writeConfig(this.export2LayoutRecord())}static stripMarkup(t){return(new SecurityUtility).stripHtml(t)}initializeEvents(){this.readOnly||($(document).on("click",this.selectorAddColumn,this.addColumnHandler),$(document).on("click",this.selectorRemoveColumn,this.removeColumnHandler),$(document).on("click",this.selectorAddRowTop,this.addRowTopHandler),$(document).on("click",this.selectorAddRowBottom,this.addRowBottomHandler),$(document).on("click",this.selectorRemoveRowTop,this.removeRowTopHandler),$(document).on("click",this.selectorRemoveRowBottom,this.removeRowBottomHandler),$(document).on("click",this.selectorLinkEditor,this.linkEditorHandler),$(document).on("click",this.selectorLinkExpandRight,this.linkExpandRightHandler),$(document).on("click",this.selectorLinkShrinkLeft,this.linkShrinkLeftHandler),$(document).on("click",this.selectorLinkExpandDown,this.linkExpandDownHandler),$(document).on("click",this.selectorLinkShrinkUp,this.linkShrinkUpHandler))}getNewCell(){return $.extend({},this.defaultCell)}writeConfig(t){this.field.val(t);const e=t.split("\n");let o="";for(const t of e)t&&(o+="\t\t\t"+t+"\n");let n="mod.web_layout.BackendLayouts {\n exampleKey {\n title = Example\n icon = EXT:example_extension/Resources/Public/Images/BackendLayouts/default.gif\n config {\n"+o.replace(new RegExp("\t","g")," ")+" }\n }\n}\n";$(this.selectorConfigPreview).find(this.selectorPreviewArea).empty().append(n);const i=document.querySelector(this.selectorCodeMirror);i&&i.CodeMirror.setValue(n)}addRowTop(){const t=[];for(let e=0;e<this.colCount;e++){const o=this.getNewCell();o.name=e+"x"+this.data.length,t[e]=o}this.data.unshift(t),this.rowCount++}addRowBottom(){const t=[];for(let e=0;e<this.colCount;e++){const o=this.getNewCell();o.name=e+"x"+this.data.length,t[e]=o}this.data.push(t),this.rowCount++}removeRowTop(){if(this.rowCount<=1)return!1;const t=[];for(let e=1;e<this.rowCount;e++)t.push(this.data[e]);for(let t=0;t<this.colCount;t++)1===this.data[0][t].spanned&&this.findUpperCellWidthRowspanAndDecreaseByOne(t,0);return this.data=t,this.rowCount--,!0}removeRowBottom(){if(this.rowCount<=1)return!1;const t=[];for(let e=0;e<this.rowCount-1;e++)t.push(this.data[e]);for(let t=0;t<this.colCount;t++)1===this.data[this.rowCount-1][t].spanned&&this.findUpperCellWidthRowspanAndDecreaseByOne(t,this.rowCount-1);return this.data=t,this.rowCount--,!0}findUpperCellWidthRowspanAndDecreaseByOne(t,e){const o=this.getCell(t,e-1);return!!o&&(1===o.spanned?this.findUpperCellWidthRowspanAndDecreaseByOne(t,e-1):o.rowspan>1&&this.removeRowspan(t,e-1),!0)}removeColumn(){if(this.colCount<=1)return!1;const t=[];for(let e=0;e<this.rowCount;e++){const o=[];for(let t=0;t<this.colCount-1;t++)o.push(this.data[e][t]);1===this.data[e][this.colCount-1].spanned&&this.findLeftCellWidthColspanAndDecreaseByOne(this.colCount-1,e),t.push(o)}return this.data=t,this.colCount--,!0}findLeftCellWidthColspanAndDecreaseByOne(t,e){const o=this.getCell(t-1,e);return!!o&&(1===o.spanned?this.findLeftCellWidthColspanAndDecreaseByOne(t-1,e):o.colspan>1&&this.removeColspan(t-1,e),!0)}addColumn(){for(let t=0;t<this.rowCount;t++){const e=this.getNewCell();e.name=this.colCount+"x"+t,this.data[t].push(e)}this.colCount++}drawTable(){const t=$("<colgroup>");for(let e=0;e<this.colCount;e++){const e=100/this.colCount;t.append($("<col>").css({width:parseInt(e.toString(),10)+"%"}))}const e=$('<table id="base" class="table editor">');e.append(t);for(let t=0;t<this.rowCount;t++){if(0===this.data[t].length)continue;const o=$("<tr>");for(let e=0;e<this.colCount;e++){const n=this.data[t][e];if(1===n.spanned)continue;const i=100/this.rowCount,r=100/this.colCount,s=$("<td>").css({height:parseInt(i.toString(),10)*n.rowspan+"%",width:parseInt(r.toString(),10)*n.colspan+"%"});if(!this.readOnly){const o=$('<div class="cell_container">');s.append(o);const n=$('<a href="#" data-col="'+e+'" data-row="'+t+'">');o.append(n.clone().attr("class","t3js-grideditor-link-editor link link_editor").attr("title",TYPO3.lang.grid_editCell)),this.cellCanSpanRight(e,t)&&o.append(n.clone().attr("class","t3js-grideditor-link-expand-right link link_expand_right").attr("title",TYPO3.lang.grid_mergeCell)),this.cellCanShrinkLeft(e,t)&&o.append(n.clone().attr("class","t3js-grideditor-link-shrink-left link link_shrink_left").attr("title",TYPO3.lang.grid_splitCell)),this.cellCanSpanDown(e,t)&&o.append(n.clone().attr("class","t3js-grideditor-link-expand-down link link_expand_down").attr("title",TYPO3.lang.grid_mergeCell)),this.cellCanShrinkUp(e,t)&&o.append(n.clone().attr("class","t3js-grideditor-link-shrink-up link link_shrink_up").attr("title",TYPO3.lang.grid_splitCell))}s.append($('<div class="cell_data">').html(TYPO3.lang.grid_name+": "+(n.name?GridEditor.stripMarkup(n.name):TYPO3.lang.grid_notSet)+"<br />"+TYPO3.lang.grid_column+": "+(void 0===n.column||isNaN(n.column)?TYPO3.lang.grid_notSet:parseInt(n.column,10)))),n.colspan>1&&s.attr("colspan",n.colspan),n.rowspan>1&&s.attr("rowspan",n.rowspan),o.append(s)}e.append(o)}$(this.targetElement).empty().append(e)}setName(t,e,o){const n=this.getCell(e,o);return!!n&&(n.name=GridEditor.stripMarkup(t),!0)}setColumn(t,e,o){const n=this.getCell(e,o);return!!n&&(n.column=parseInt(t.toString(),10),!0)}showOptions(t,e){const o=this.getCell(t,e);if(!o)return!1;let n;n=0===o.column?0:o.column?parseInt(o.column.toString(),10):"";const i=$("<div>"),r=$('<div class="form-group">'),s=$("<label>"),a=$("<input>");i.append([r.clone().append([s.clone().text(TYPO3.lang.grid_nameHelp),a.clone().attr("type","text").attr("class","t3js-grideditor-field-name form-control").attr("name","name").val(GridEditor.stripMarkup(o.name)||"")]),r.clone().append([s.clone().text(TYPO3.lang.grid_columnHelp),a.clone().attr("type","text").attr("class","t3js-grideditor-field-colpos form-control").attr("name","column").val(n)])]);const l=Modal.show(TYPO3.lang.grid_windowTitle,i,SeverityEnum.notice,[{active:!0,btnClass:"btn-default",name:"cancel",text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel"},{btnClass:"btn-primary",name:"ok",text:$(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK"}]);return l.data("col",t),l.data("row",e),l.on("button.clicked",this.modalButtonClickHandler),!0}getCell(t,e){return!(t>this.colCount-1)&&(!(e>this.rowCount-1)&&(this.data.length>e-1&&this.data[e].length>t-1?this.data[e][t]:null))}cellCanSpanRight(t,e){if(t===this.colCount-1)return!1;const o=this.getCell(t,e);let n;if(o.rowspan>1){for(let i=e;i<e+o.rowspan;i++)if(n=this.getCell(t+o.colspan,i),!n||1===n.spanned||n.colspan>1||n.rowspan>1)return!1}else if(n=this.getCell(t+o.colspan,e),!n||1===o.spanned||1===n.spanned||n.colspan>1||n.rowspan>1)return!1;return!0}cellCanSpanDown(t,e){if(e===this.rowCount-1)return!1;const o=this.getCell(t,e);let n;if(o.colspan>1){for(let i=t;i<t+o.colspan;i++)if(n=this.getCell(i,e+o.rowspan),!n||1===n.spanned||n.colspan>1||n.rowspan>1)return!1}else if(n=this.getCell(t,e+o.rowspan),!n||1===o.spanned||1===n.spanned||n.colspan>1||n.rowspan>1)return!1;return!0}cellCanShrinkLeft(t,e){return this.data[e][t].colspan>1}cellCanShrinkUp(t,e){return this.data[e][t].rowspan>1}addColspan(t,e){const o=this.getCell(t,e);if(!o||!this.cellCanSpanRight(t,e))return!1;for(let n=e;n<e+o.rowspan;n++)this.data[n][t+o.colspan].spanned=1;return o.colspan+=1,!0}addRowspan(t,e){const o=this.getCell(t,e);if(!o||!this.cellCanSpanDown(t,e))return!1;for(let n=t;n<t+o.colspan;n++)this.data[e+o.rowspan][n].spanned=1;return o.rowspan+=1,!0}removeColspan(t,e){const o=this.getCell(t,e);if(!o||!this.cellCanShrinkLeft(t,e))return!1;o.colspan-=1;for(let n=e;n<e+o.rowspan;n++)this.data[n][t+o.colspan].spanned=0;return!0}removeRowspan(t,e){const o=this.getCell(t,e);if(!o||!this.cellCanShrinkUp(t,e))return!1;o.rowspan-=1;for(let n=t;n<t+o.colspan;n++)this.data[e+o.rowspan][n].spanned=0;return!0}export2LayoutRecord(){let t="backend_layout {\n\tcolCount = "+this.colCount+"\n\trowCount = "+this.rowCount+"\n\trows {\n";for(let e=0;e<this.rowCount;e++){t+="\t\t"+(e+1)+" {\n",t+="\t\t\tcolumns {\n";let o=0;for(let n=0;n<this.colCount;n++){const i=this.getCell(n,e);if(i&&!i.spanned){const r=GridEditor.stripMarkup(i.name)||"";o++,t+="\t\t\t\t"+o+" {\n",t+="\t\t\t\t\tname = "+(r||n+"x"+e)+"\n",i.colspan>1&&(t+="\t\t\t\t\tcolspan = "+i.colspan+"\n"),i.rowspan>1&&(t+="\t\t\t\t\trowspan = "+i.rowspan+"\n"),"number"==typeof i.column&&(t+="\t\t\t\t\tcolPos = "+i.column+"\n"),t+="\t\t\t\t}\n"}}t+="\t\t\t}\n",t+="\t\t}\n"}return t+="\t}\n}\n",t}addVisibilityObserver(t){null===t.offsetParent&&new IntersectionObserver((t,e)=>{t.forEach(t=>{const e=document.querySelector(this.selectorCodeMirror);t.intersectionRatio>0&&e&&e.CodeMirror.refresh()})}).observe(t)}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Icons.js b/typo3/sysext/backend/Resources/Public/JavaScript/Icons.js deleted file mode 100644 index 211172c4171178891e170b9470636f6ddcd26b96..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Icons.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import ClientStorage from"TYPO3/CMS/Backend/Storage/Client.js";import{Sizes,States,MarkupIdentifiers}from"TYPO3/CMS/Backend/Enum/IconTypes.js";class Icons{constructor(){this.sizes=Sizes,this.states=States,this.markupIdentifiers=MarkupIdentifiers,this.promiseCache={}}getIcon(e,t,i,s,r){const o=[e,t=t||Sizes.default,i,s=s||States.default,r=r||MarkupIdentifiers.default],n=o.join("_");return this.getIconRegistryCache().then(e=>(ClientStorage.isset("icon_registry_cache_identifier")&&ClientStorage.get("icon_registry_cache_identifier")===e||(ClientStorage.unsetByPrefix("icon_"),ClientStorage.set("icon_registry_cache_identifier",e)),this.fetchFromLocal(n).then(null,()=>this.fetchFromRemote(o,n))))}getIconRegistryCache(){const e="icon_registry_cache_identifier";return this.isPromiseCached(e)||this.putInPromiseCache(e,new AjaxRequest(TYPO3.settings.ajaxUrls.icons_cache).get().then(async e=>await e.resolve())),this.getFromPromiseCache(e)}fetchFromRemote(e,t){if(!this.isPromiseCached(t)){const i={icon:JSON.stringify(e)};this.putInPromiseCache(t,new AjaxRequest(TYPO3.settings.ajaxUrls.icons).withQueryArguments(i).get().then(async e=>{const i=await e.resolve();return i.includes("t3js-icon")&&i.includes('<span class="icon-markup">')&&ClientStorage.set("icon_"+t,i),i}))}return this.getFromPromiseCache(t)}fetchFromLocal(e){return ClientStorage.isset("icon_"+e)?Promise.resolve(ClientStorage.get("icon_"+e)):Promise.reject()}isPromiseCached(e){return void 0!==this.promiseCache[e]}getFromPromiseCache(e){return this.promiseCache[e]}putInPromiseCache(e,t){this.promiseCache[e]=t}}let iconsObject;iconsObject||(iconsObject=new Icons,TYPO3.Icons=iconsObject);export default iconsObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ImageManipulation.js b/typo3/sysext/backend/Resources/Public/JavaScript/ImageManipulation.js deleted file mode 100644 index a91195f5bab47947ce5340e96bc3193e269a16e7..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ImageManipulation.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import"jquery-ui/draggable.js";import"jquery-ui/resizable.js";import FormEngineValidation from"TYPO3/CMS/Backend/FormEngineValidation.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Cropper from"cropperjs";import ImagesLoaded from"imagesloaded";import Icons from"TYPO3/CMS/Backend/Icons.js";import Modal from"TYPO3/CMS/Backend/Modal.js";class ImageManipulation{constructor(){this.initialized=!1,this.cropImageContainerSelector="#t3js-crop-image-container",this.cropImageSelector="#t3js-crop-image",this.coverAreaSelector=".t3js-cropper-cover-area",this.cropInfoSelector=".t3js-cropper-info-crop",this.focusAreaSelector="#t3js-cropper-focus-area",this.defaultFocusArea={height:1/3,width:1/3,x:0,y:0},this.defaultOpts={autoCrop:!0,autoCropArea:.7,dragMode:"crop",guides:!0,responsive:!0,viewMode:1,zoomable:!1,checkCrossOrigin:!1},this.cropBuiltHandler=()=>{this.initialized=!0;const t=this.cropper.getImageData(),e=this.currentModal.find(this.cropImageSelector);this.currentModal.find(".cropper-canvas img").removeClass("cropper-hide"),this.imageOriginalSizeFactor=e.data("originalWidth")/t.naturalWidth,this.cropVariantTriggers.each((e,r)=>{const a=$(r).attr("data-crop-variant-id"),i=this.convertRelativeToAbsoluteCropArea(this.data[a].cropArea,t),o=$.extend(!0,{},this.data[a],{cropArea:i});this.updatePreviewThumbnail(o,$(r))}),this.currentCropVariant.cropArea=this.convertRelativeToAbsoluteCropArea(this.currentCropVariant.cropArea,t),this.cropBox=this.currentModal.find(".cropper-crop-box"),this.setCropArea(this.currentCropVariant.cropArea),this.currentCropVariant.coverAreas&&this.initCoverAreas(this.cropBox,this.currentCropVariant.coverAreas),this.currentCropVariant.focusArea&&(ImageManipulation.isEmptyArea(this.currentCropVariant.focusArea)&&(this.currentCropVariant.focusArea=$.extend(!0,{},this.defaultFocusArea)),this.initFocusArea(this.cropBox),this.scaleAndMoveFocusArea(this.currentCropVariant.focusArea)),this.currentCropVariant.selectedRatio&&this.currentModal.find(`[data-bs-option='${this.currentCropVariant.selectedRatio}']`).addClass("active")},this.cropMoveHandler=t=>{if(!this.initialized)return;this.currentCropVariant.cropArea=$.extend(!0,this.currentCropVariant.cropArea,{height:Math.floor(t.detail.height),width:Math.floor(t.detail.width),x:Math.floor(t.detail.x),y:Math.floor(t.detail.y)}),this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger),this.updateCropVariantData(this.currentCropVariant);const e=Math.round(this.currentCropVariant.cropArea.width*this.imageOriginalSizeFactor),r=Math.round(this.currentCropVariant.cropArea.height*this.imageOriginalSizeFactor);this.cropInfo.text(`${e}×${r} px`)},this.cropStartHandler=()=>{this.currentCropVariant.focusArea&&(this.focusArea.draggable("option","disabled",!0),this.focusArea.resizable("option","disabled",!0))},this.cropEndHandler=()=>{this.currentCropVariant.focusArea&&(this.focusArea.draggable("option","disabled",!1),this.focusArea.resizable("option","disabled",!1))}}static isEmptyArea(t){return $.isEmptyObject(t)}static wait(t,e){window.setTimeout(t,e)}static toCssPercent(t){return 100*t+"%"}static serializeCropVariants(t){return JSON.stringify(t,(t,e)=>"id"===t||"title"===t||"allowedAspectRatios"===t||"coverAreas"===t?void 0:e)}initializeTrigger(){$(".t3js-image-manipulation-trigger").off("click").on("click",t=>{t.preventDefault(),this.trigger=$(t.currentTarget),this.show()})}initializeCropperModal(){const t=this.currentModal.find(this.cropImageSelector);ImagesLoaded(t.get(0),()=>{this.init()})}show(){const t=this.trigger.data("modalTitle"),e=this.trigger.data("buttonPreviewText"),r=this.trigger.data("buttonDismissText"),a=this.trigger.data("buttonSaveText"),i=this.trigger.data("url"),o=this.trigger.data("payload");Icons.getIcon("spinner-circle",Icons.sizes.default,null,null,Icons.markupIdentifiers.inline).then(s=>{this.currentModal=Modal.advanced({additionalCssClasses:["modal-image-manipulation"],buttons:[{btnClass:"btn-default pull-left",dataAttributes:{method:"preview"},icon:"actions-view",text:e},{btnClass:"btn-default",dataAttributes:{method:"dismiss"},icon:"actions-close",text:r},{btnClass:"btn-primary",dataAttributes:{method:"save"},icon:"actions-document-save",text:a}],content:$('<div class="modal-loading">').append(s),size:Modal.sizes.full,style:Modal.styles.dark,title:t}),this.currentModal.on("shown.bs.modal",()=>{new AjaxRequest(i).post(o).then(async t=>{this.currentModal.find(".t3js-modal-body").append(await t.resolve()).addClass("cropper"),this.currentModal.find(".modal-loading").remove(),this.initializeCropperModal()})}),this.currentModal.on("hide.bs.modal",()=>{this.destroy()}),this.currentModal.css("pointer-events","none")})}init(){const t=this.currentModal.find(this.cropImageSelector),e=this.trigger.attr("data-crop-variants");if(!e)throw new TypeError("ImageManipulation: No cropVariants data found for image");this.data=$.isEmptyObject(this.data)?JSON.parse(e):this.data,this.cropVariantTriggers=this.currentModal.find(".t3js-crop-variant-trigger"),this.activeCropVariantTrigger=this.currentModal.find(".t3js-crop-variant-trigger.is-active"),this.cropInfo=this.currentModal.find(this.cropInfoSelector),this.saveButton=this.currentModal.find("[data-method=save]"),this.previewButton=this.currentModal.find("[data-method=preview]"),this.dismissButton=this.currentModal.find("[data-method=dismiss]"),this.resetButton=this.currentModal.find("[data-method=reset]"),this.aspectRatioTrigger=this.currentModal.find("[data-method=setAspectRatio]"),this.currentCropVariant=this.data[this.activeCropVariantTrigger.attr("data-crop-variant-id")],this.cropVariantTriggers.off("click").on("click",t=>{if($(t.currentTarget).hasClass("is-active"))return t.stopPropagation(),void t.preventDefault();this.activeCropVariantTrigger.removeClass("is-active"),$(t.currentTarget).addClass("is-active"),this.activeCropVariantTrigger=$(t.currentTarget);const e=this.data[this.activeCropVariantTrigger.attr("data-crop-variant-id")],r=this.cropper.getImageData();e.cropArea=this.convertRelativeToAbsoluteCropArea(e.cropArea,r),this.currentCropVariant=$.extend(!0,{},e),this.update(e)}),this.aspectRatioTrigger.off("click").on("click",t=>{const e=$(t.currentTarget).attr("data-bs-option"),r=$.extend(!0,{},this.currentCropVariant),a=r.allowedAspectRatios[e];this.setAspectRatio(a),this.setCropArea(r.cropArea),this.currentCropVariant=$.extend(!0,{},r,{selectedRatio:e}),this.update(this.currentCropVariant)}),this.saveButton.off("click").on("click",()=>{this.save(this.data)}),this.trigger.attr("data-preview-url")?this.previewButton.off("click").on("click",()=>{this.openPreview(this.data)}):this.previewButton.hide(),this.dismissButton.off("click").on("click",()=>{this.currentModal.modal("hide")}),this.resetButton.off("click").on("click",t=>{const e=this.cropper.getImageData(),r=$(t.currentTarget).attr("data-crop-variant");if(t.preventDefault(),t.stopPropagation(),!r)throw new TypeError("TYPO3 Cropper: No cropVariant data attribute found on reset element.");const a=JSON.parse(r),i=this.convertRelativeToAbsoluteCropArea(a.cropArea,e);this.currentCropVariant=$.extend(!0,{},a,{cropArea:i}),this.update(this.currentCropVariant)}),ImageManipulation.isEmptyArea(this.currentCropVariant.cropArea)&&(this.defaultOpts=$.extend({autoCropArea:1},this.defaultOpts)),this.cropper=new Cropper(t.get(0),$.extend(this.defaultOpts,{ready:this.cropBuiltHandler,crop:this.cropMoveHandler,cropend:this.cropEndHandler,cropstart:this.cropStartHandler,data:this.currentCropVariant.cropArea})),this.update(this.currentCropVariant)}update(t){const e=$.extend(!0,{},t),r=t.allowedAspectRatios[t.selectedRatio];this.currentModal.find("[data-bs-option]").removeClass("active"),this.currentModal.find(`[data-bs-option="${t.selectedRatio}"]`).addClass("active"),this.setAspectRatio(r),this.setCropArea(e.cropArea),this.currentCropVariant=$.extend(!0,{},e,t),this.cropBox.find(this.coverAreaSelector).remove(),this.cropBox.has(this.focusAreaSelector).length&&(this.focusArea.resizable("destroy").draggable("destroy"),this.focusArea.remove()),t.focusArea&&(ImageManipulation.isEmptyArea(t.focusArea)&&(this.currentCropVariant.focusArea=$.extend(!0,{},this.defaultFocusArea)),this.initFocusArea(this.cropBox),this.scaleAndMoveFocusArea(this.currentCropVariant.focusArea)),t.coverAreas&&this.initCoverAreas(this.cropBox,this.currentCropVariant.coverAreas),this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger)}initFocusArea(t){this.focusArea=$('<div id="t3js-cropper-focus-area" class="cropper-focus-area"></div>'),t.append(this.focusArea),this.focusArea.draggable({containment:t,create:()=>{const t="undefined"!=typeof window&&void 0!==window.document,e=!(!t||!window.document.documentElement)&&"ontouchstart"in window.document.documentElement,r=!!t&&"PointerEvent"in window,a=r?"pointerdown":e?"touchstart":"mousedown",i=r?"pointerup pointercancel":e?"touchend touchcancel":"mouseup";this.focusArea.on(a,()=>{this.cropper.disable()}),this.focusArea.on(i,()=>{this.cropper.enable()}),this.scaleAndMoveFocusArea(this.currentCropVariant.focusArea)},drag:()=>{const{left:e,top:r}=t.offset(),{left:a,top:i}=this.focusArea.offset(),{focusArea:o,coverAreas:s}=this.currentCropVariant;o.x=(a-e)/t.width(),o.y=(i-r)/t.height(),this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger),this.checkFocusAndCoverAreasCollision(o,s)?this.focusArea.addClass("has-nodrop"):this.focusArea.removeClass("has-nodrop")},revert:()=>{const{left:e,top:r}=t.offset(),{left:a,top:i}=this.focusArea.offset(),{focusArea:o,coverAreas:s}=this.currentCropVariant;return!!this.checkFocusAndCoverAreasCollision(o,s)&&(this.focusArea.removeClass("has-nodrop"),ImageManipulation.wait(()=>{o.x=(a-e)/t.width(),o.y=(i-r)/t.height(),this.updateCropVariantData(this.currentCropVariant)},250),!0)},revertDuration:200,stop:()=>{const{left:e,top:r}=t.offset(),{left:a,top:i}=this.focusArea.offset(),{focusArea:o}=this.currentCropVariant;o.x=(a-e)/t.width(),o.y=(i-r)/t.height(),this.scaleAndMoveFocusArea(o)}}).resizable({containment:t,handles:"all",resize:()=>{const{left:e,top:r}=t.offset(),{left:a,top:i}=this.focusArea.offset(),{focusArea:o,coverAreas:s}=this.currentCropVariant;o.height=this.focusArea.height()/t.height(),o.width=this.focusArea.width()/t.width(),o.x=(a-e)/t.width(),o.y=(i-r)/t.height(),this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger),this.checkFocusAndCoverAreasCollision(o,s)?this.focusArea.addClass("has-nodrop"):this.focusArea.removeClass("has-nodrop")},stop:(e,r)=>{const{left:a,top:i}=t.offset(),{left:o,top:s}=this.focusArea.offset(),{focusArea:n,coverAreas:c}=this.currentCropVariant;this.checkFocusAndCoverAreasCollision(n,c)?r.element.animate($.extend(r.originalPosition,r.originalSize),250,()=>{n.height=this.focusArea.height()/t.height(),n.width=this.focusArea.width()/t.width(),n.x=(o-a)/t.width(),n.y=(s-i)/t.height(),this.scaleAndMoveFocusArea(n),this.focusArea.removeClass("has-nodrop")}):this.scaleAndMoveFocusArea(n)}})}initCoverAreas(t,e){e.forEach(e=>{const r=$('<div class="cropper-cover-area t3js-cropper-cover-area"></div>');t.append(r),r.css({height:ImageManipulation.toCssPercent(e.height),left:ImageManipulation.toCssPercent(e.x),top:ImageManipulation.toCssPercent(e.y),width:ImageManipulation.toCssPercent(e.width)})})}updatePreviewThumbnail(t,e){let r;const a=e.find(".t3js-cropper-preview-thumbnail-crop-area"),i=e.find(".t3js-cropper-preview-thumbnail-crop-image"),o=e.find(".t3js-cropper-preview-thumbnail-focus-area"),s=this.cropper.getImageData();a.css({height:ImageManipulation.toCssPercent(t.cropArea.height/s.naturalHeight),left:ImageManipulation.toCssPercent(t.cropArea.x/s.naturalWidth),top:ImageManipulation.toCssPercent(t.cropArea.y/s.naturalHeight),width:ImageManipulation.toCssPercent(t.cropArea.width/s.naturalWidth)}),t.focusArea&&o.css({height:ImageManipulation.toCssPercent(t.focusArea.height),left:ImageManipulation.toCssPercent(t.focusArea.x),top:ImageManipulation.toCssPercent(t.focusArea.y),width:ImageManipulation.toCssPercent(t.focusArea.width)}),r=a.css(["width","height","left","top"]),i.css({height:parseFloat(r.height)*(1/(t.cropArea.height/s.naturalHeight))+"px",margin:-1*parseFloat(r.left)+"px",marginTop:-1*parseFloat(r.top)+"px",width:parseFloat(r.width)*(1/(t.cropArea.width/s.naturalWidth))+"px"})}scaleAndMoveFocusArea(t){this.focusArea.css({height:ImageManipulation.toCssPercent(t.height),left:ImageManipulation.toCssPercent(t.x),top:ImageManipulation.toCssPercent(t.y),width:ImageManipulation.toCssPercent(t.width)}),this.currentCropVariant.focusArea=t,this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger),this.updateCropVariantData(this.currentCropVariant)}updateCropVariantData(t){const e=this.cropper.getImageData(),r=this.convertAbsoluteToRelativeCropArea(t.cropArea,e);this.data[t.id]=$.extend(!0,{},t,{cropArea:r})}setAspectRatio(t){this.cropper.setAspectRatio(t.value)}setCropArea(t){const e=this.currentCropVariant.allowedAspectRatios[this.currentCropVariant.selectedRatio];0===e.value?this.cropper.setData({height:t.height,width:t.width,x:t.x,y:t.y}):this.cropper.setData({height:t.height,width:t.height*e.value,x:t.x,y:t.y})}checkFocusAndCoverAreasCollision(t,e){return!!e&&e.some(e=>t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.height+t.y>e.y)}convertAbsoluteToRelativeCropArea(t,e){const{height:r,width:a,x:i,y:o}=t;return{height:r/e.naturalHeight,width:a/e.naturalWidth,x:i/e.naturalWidth,y:o/e.naturalHeight}}convertRelativeToAbsoluteCropArea(t,e){const{height:r,width:a,x:i,y:o}=t;return{height:r*e.naturalHeight,width:a*e.naturalWidth,x:i*e.naturalWidth,y:o*e.naturalHeight}}setPreviewImages(t){const e=this.cropper.image,r=this.cropper.getImageData();Object.keys(t).forEach(a=>{const i=t[a],o=this.convertRelativeToAbsoluteCropArea(i.cropArea,r),s=this.trigger.closest(".form-group").find(`.t3js-image-manipulation-preview[data-crop-variant-id="${a}"]`),n=this.trigger.closest(".form-group").find(`.t3js-image-manipulation-selected-ratio[data-crop-variant-id="${a}"]`);if(0===s.length)return;let c=s.width(),h=s.data("preview-height");const p=o.width/o.height,d=c/p;d>h?c=h*p:h=d,c>o.width&&(c=o.width,h=o.height);const l=c/o.width,u=$("<div />").html('<img src="'+e.src+'">'),g=this.currentModal.find(`.t3-js-ratio-title[data-ratio-id="${i.id}${i.selectedRatio}"]`);n.text(g.text()),u.addClass("cropper-preview-container"),s.empty().append(u),u.wrap('<span class="thumbnail thumbnail-status"></span>'),u.width(c).height(h).find("img").css({height:r.naturalHeight*l,left:-o.x*l,top:-o.y*l,width:r.naturalWidth*l})})}openPreview(t){const e=ImageManipulation.serializeCropVariants(t);let r=this.trigger.attr("data-preview-url");r=r+"&cropVariants="+encodeURIComponent(e),window.open(r,"TYPO3ImageManipulationPreview")}save(t){const e=ImageManipulation.serializeCropVariants(t),r=$("#"+this.trigger.attr("data-field"));this.trigger.attr("data-crop-variants",JSON.stringify(t)),this.setPreviewImages(t),r.val(e),FormEngineValidation.markFieldAsChanged(r),this.currentModal.modal("hide")}destroy(){this.currentModal&&(this.cropper instanceof Cropper&&this.cropper.destroy(),this.initialized=!1,this.cropper=null,this.currentModal=null,this.data=null)}}export default new ImageManipulation; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/InfoWindow.js b/typo3/sysext/backend/Resources/Public/JavaScript/InfoWindow.js deleted file mode 100644 index 81733437584e862a32fd971e71368c0abe9e34dd..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/InfoWindow.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import Modal from"TYPO3/CMS/Backend/Modal.js";class InfoWindow{static showItem(o,e){Modal.advanced({type:Modal.types.iframe,size:Modal.sizes.large,content:top.TYPO3.settings.ShowItem.moduleUrl+"&table="+encodeURIComponent(o)+"&uid="+("number"==typeof e?e:encodeURIComponent(e)),severity:SeverityEnum.notice})}}top.TYPO3.InfoWindow||(top.TYPO3.InfoWindow=InfoWindow),TYPO3.InfoWindow=InfoWindow;export default InfoWindow; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js b/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js deleted file mode 100644 index bb05d2d9c317ace45db764a5cf40e195072ca6cd..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import"jquery-ui/droppable.js";import DataHandler from"TYPO3/CMS/Backend/AjaxDataHandler.js";import Icons from"TYPO3/CMS/Backend/Icons.js";class DragDrop{static initialize(){$(DragDrop.contentIdentifier).draggable({handle:DragDrop.dragHeaderIdentifier,scope:"tt_content",cursor:"move",distance:20,revert:"invalid",zIndex:100,start:e=>{DragDrop.onDragStart($(e.target))},stop:e=>{DragDrop.onDragStop($(e.target))}}),$(DragDrop.dropZoneIdentifier).droppable({accept:this.contentIdentifier,scope:"tt_content",tolerance:"pointer",over:(e,r)=>{DragDrop.onDropHoverOver($(r.draggable),$(e.target))},out:(e,r)=>{DragDrop.onDropHoverOut($(r.draggable),$(e.target))},drop:(e,r)=>{DragDrop.onDrop($(r.draggable),$(e.target),e)}})}static onDragStart(e){DragDrop.originalStyles=e.get(0).style.cssText,e.children(DragDrop.dragIdentifier).addClass("dragitem-shadow"),e.append('<div class="ui-draggable-copy-message">'+TYPO3.lang["dragdrop.copy.message"]+"</div>"),e.children(DragDrop.dropZoneIdentifier).addClass("drag-start"),e.closest(DragDrop.columnIdentifier).removeClass("active"),e.find(DragDrop.dropZoneIdentifier).hide(),$(DragDrop.dropZoneIdentifier).each((e,r)=>{const a=$(r);a.parent().find(DragDrop.addContentIdentifier).length&&a.addClass(DragDrop.validDropZoneClass)})}static onDragStop(e){e.children(DragDrop.dragIdentifier).removeClass("dragitem-shadow"),e.children(DragDrop.dropZoneIdentifier).removeClass("drag-start"),e.closest(DragDrop.columnIdentifier).addClass("active"),e.find(DragDrop.dropZoneIdentifier).show(),e.find(".ui-draggable-copy-message").remove(),e.get(0).style.cssText=DragDrop.originalStyles,$(DragDrop.dropZoneIdentifier+"."+DragDrop.validDropZoneClass).removeClass(DragDrop.validDropZoneClass)}static onDropHoverOver(e,r){r.hasClass(DragDrop.validDropZoneClass)&&r.addClass(DragDrop.dropPossibleHoverClass)}static onDropHoverOut(e,r){r.removeClass(DragDrop.dropPossibleHoverClass)}static onDrop(e,r,a){const t=DragDrop.getColumnPositionForElement(r);r.removeClass(DragDrop.dropPossibleHoverClass);const o=parseInt(e.data("uid"),10);if("number"==typeof o&&o>0){let s={};const n=r.closest(DragDrop.contentIdentifier).data("uid");let i=0;i=void 0===n?parseInt(a.target.offsetParent.getAttribute("data-page"),10):0-parseInt(n,10);let d=parseInt(e.data("language-uid"),10);-1!==d&&(d=parseInt(r.closest("[data-language-uid]").data("language-uid"),10));let p=0;0!==i&&(p=t);const g=a&&a.originalEvent.ctrlKey||r.hasClass("t3js-paste-copy"),l=g?"copy":"move";s.cmd={tt_content:{[o]:{[l]:{action:"paste",target:i,update:{colPos:p,sys_language_uid:d}}}}},DragDrop.ajaxAction(r,e,s,g).then(()=>{const r=$(`.t3-page-column-lang-name[data-language-uid="${d}"]`);if(0===r.length)return;const a=r.data("flagIdentifier"),t=r.data("languageTitle");Icons.getIcon(a,Icons.sizes.small).then(r=>{e.find(".t3js-flag").attr("title",t).html(r)})})}}static ajaxAction(e,r,a,t){const o=Object.keys(a.cmd).shift(),s=parseInt(Object.keys(a.cmd[o]).shift(),10),n={component:"dragdrop",action:t?"copy":"move",table:o,uid:s};return DataHandler.process(a,n).then(a=>{if(a.hasErrors)throw a.messages;e.parent().hasClass(DragDrop.contentIdentifier.substring(1))?r.detach().css({top:0,left:0}).insertAfter(e.closest(DragDrop.contentIdentifier)):r.detach().css({top:0,left:0}).insertAfter(e.closest(DragDrop.dropZoneIdentifier)),t&&self.location.reload()})}static getColumnPositionForElement(e){const r=e.closest("[data-colpos]");return!(!r.length||"undefined"===r.data("colpos"))&&r.data("colpos")}}DragDrop.contentIdentifier=".t3js-page-ce",DragDrop.dragIdentifier=".t3-page-ce-dragitem",DragDrop.dragHeaderIdentifier=".t3js-page-ce-draghandle",DragDrop.dropZoneIdentifier=".t3js-page-ce-dropzone-available",DragDrop.columnIdentifier=".t3js-page-column",DragDrop.validDropZoneClass="active",DragDrop.dropPossibleHoverClass="t3-page-ce-dropzone-possible",DragDrop.addContentIdentifier=".t3js-page-new-ce",DragDrop.originalStyles="";export default DragDrop;$(DragDrop.initialize); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/Paste.js b/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/Paste.js deleted file mode 100644 index ebb64f127ad106170f55a5efce8bdc37f4813a62..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/Paste.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import DataHandler from"TYPO3/CMS/Backend/AjaxDataHandler.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import"TYPO3/CMS/Backend/Element/IconElement.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";class Paste{constructor(){this.itemOnClipboardUid=0,this.itemOnClipboardTitle="",this.copyMode="",this.elementIdentifier=".t3js-page-ce",this.pasteAfterLinkTemplate="",this.pasteIntoLinkTemplate="",$(()=>{$(".t3js-page-columns").length&&(this.generateButtonTemplates(),this.activatePasteIcons(),this.initializeEvents())})}static determineColumn(t){const e=t.closest("[data-colpos]");return e.length&&"undefined"!==e.data("colpos")?e.data("colpos"):0}initializeEvents(){$(document).on("click",".t3js-paste",t=>{t.preventDefault(),this.activatePasteModal($(t.currentTarget))})}generateButtonTemplates(){this.itemOnClipboardUid&&(this.pasteAfterLinkTemplate='<button type="button" class="t3js-paste t3js-paste'+(this.copyMode?"-"+this.copyMode:"")+' t3js-paste-after btn btn-default btn-sm" title="'+TYPO3.lang?.pasteAfterRecord+'"><typo3-backend-icon identifier="actions-document-paste-into" size="small"></typo3-backend-icon></button>',this.pasteIntoLinkTemplate='<button type="button" class="t3js-paste t3js-paste'+(this.copyMode?"-"+this.copyMode:"")+' t3js-paste-into btn btn-default btn-sm" title="'+TYPO3.lang?.pasteIntoColumn+'"><typo3-backend-icon identifier="actions-document-paste-into" size="small"></typo3-backend-icon></button>')}activatePasteIcons(){$(".t3-page-ce-wrapper-new-ce").each((t,e)=>{if(this.pasteAfterLinkTemplate&&this.pasteIntoLinkTemplate){$(e).parent().data("page")?$(e).append(this.pasteIntoLinkTemplate):$(e).append(this.pasteAfterLinkTemplate)}})}activatePasteModal(t){const e=(TYPO3.lang["paste.modal.title.paste"]||"Paste record")+': "'+this.itemOnClipboardTitle+'"',a=TYPO3.lang["paste.modal.paste"]||"Do you want to paste the record to this position?";let s=[];s=[{text:TYPO3.lang["paste.modal.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["paste.modal.button.paste"]||"Paste",btnClass:"btn-"+Severity.getCssClass(SeverityEnum.warning),trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.execute(t)}}],Modal.show(e,a,SeverityEnum.warning,s)}execute(t){const e=Paste.determineColumn(t),a=t.closest(this.elementIdentifier),s=a.data("uid");let n;n=void 0===s?parseInt(a.data("page"),10):0-parseInt(s,10);const i={CB:{paste:"tt_content|"+n,pad:"normal",update:{colPos:e,sys_language_uid:parseInt(t.closest("[data-language-uid]").data("language-uid"),10)}}};DataHandler.process(i).then(t=>{t.hasErrors||window.location.reload()})}}export default new Paste; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Localization.js b/typo3/sysext/backend/Resources/Public/JavaScript/Localization.js deleted file mode 100644 index 1e7be4414bf2780a71b44013d1a268e676a8fe8b..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Localization.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import Wizard from"TYPO3/CMS/Backend/Wizard.js";class Localization{constructor(){this.triggerButton=".t3js-localize",this.localizationMode=null,this.sourceLanguage=null,this.records=[],$(()=>{this.initialize()})}initialize(){const e=this;Icons.getIcon("actions-localize",Icons.sizes.large).then(a=>{Icons.getIcon("actions-edit-copy",Icons.sizes.large).then(t=>{$(e.triggerButton).removeClass("disabled"),$(document).on("click",e.triggerButton,e=>{e.preventDefault();const l=$(e.currentTarget),i=[],s=[];let o="";l.data("allowTranslate")&&(i.push('<div class="row"><div class="col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-translate">'+a+'<input type="radio" name="mode" id="mode_translate" value="localize" style="display: none"><br>'+TYPO3.lang["localize.wizard.button.translate"]+'</label></div><div class="col-sm-9"><p class="t3js-helptext t3js-helptext-translate text-muted">'+TYPO3.lang["localize.educate.translate"]+"</p></div></div>"),s.push("localize")),l.data("allowCopy")&&(i.push('<div class="row"><div class="col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-copy">'+t+'<input type="radio" name="mode" id="mode_copy" value="copyFromLanguage" style="display: none"><br>'+TYPO3.lang["localize.wizard.button.copy"]+'</label></div><div class="col-sm-9"><p class="t3js-helptext t3js-helptext-copy text-muted">'+TYPO3.lang["localize.educate.copy"]+"</p></div></div>"),s.push("copyFromLanguage")),0===l.data("allowTranslate")&&0===l.data("allowCopy")&&i.push('<div class="row"><div class="col-sm-12"><div class="alert alert-warning"><div class="media"><div class="media-left"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-exclamation fa-stack-1x"></i></span></div><div class="media-body"><p class="alert-message">'+TYPO3.lang["localize.educate.noTranslate"]+"</p></div></div></div></div></div>"),o+='<div data-bs-toggle="buttons">'+i.join("<hr>")+"</div>",Wizard.addSlide("localize-choose-action",TYPO3.lang["localize.wizard.header_page"].replace("{0}",l.data("page")).replace("{1}",l.data("languageName")),o,SeverityEnum.info,()=>{1===s.length&&(this.localizationMode=s[0],Wizard.unlockNextStep().trigger("click"))}),Wizard.addSlide("localize-choose-language",TYPO3.lang["localize.view.chooseLanguage"],"",SeverityEnum.info,e=>{Icons.getIcon("spinner-circle-dark",Icons.sizes.large).then(a=>{e.html('<div class="text-center">'+a+"</div>"),this.loadAvailableLanguages(parseInt(l.data("pageId"),10),parseInt(l.data("languageId"),10)).then(async a=>{const t=await a.resolve();if(1===t.length)return this.sourceLanguage=t[0].uid,void Wizard.unlockNextStep().trigger("click");Wizard.getComponent().on("click",".t3js-language-option",e=>{const a=$(e.currentTarget).prev();this.sourceLanguage=a.val(),Wizard.unlockNextStep()});const l=$("<div />",{class:"row"});for(const e of t){const a="language"+e.uid,t=$("<input />",{type:"radio",name:"language",id:a,value:e.uid,style:"display: none;",class:"btn-check"}),i=$("<label />",{class:"btn btn-default btn-block t3js-language-option option",for:a}).text(" "+e.title).prepend(e.flagIcon);l.append($("<div />",{class:"col-sm-4"}).append(t).append(i))}e.empty().append(l)})})}),Wizard.addSlide("localize-summary",TYPO3.lang["localize.view.summary"],"",SeverityEnum.info,e=>{Icons.getIcon("spinner-circle-dark",Icons.sizes.large).then(a=>{e.html('<div class="text-center">'+a+"</div>")}),this.getSummary(parseInt(l.data("pageId"),10),parseInt(l.data("languageId"),10)).then(async a=>{const t=await a.resolve();e.empty(),this.records=[];const l=t.columns.columns;t.columns.columnList.forEach(a=>{if(void 0===t.records[a])return;const i=l[a],s=$("<div />",{class:"row"});t.records[a].forEach(e=>{const a=" ("+e.uid+") "+e.title;this.records.push(e.uid),s.append($("<div />",{class:"col-sm-6"}).append($("<div />",{class:"input-group"}).append($("<span />",{class:"input-group-addon"}).append($("<input />",{type:"checkbox",class:"t3js-localization-toggle-record",id:"record-uid-"+e.uid,checked:"checked","data-uid":e.uid,"aria-label":a})),$("<label />",{class:"form-control",for:"record-uid-"+e.uid}).text(a).prepend(e.icon))))}),e.append($("<fieldset />",{class:"localization-fieldset"}).append($("<label />").text(i).prepend($("<input />",{class:"t3js-localization-toggle-column",type:"checkbox",checked:"checked"})),s))}),Wizard.unlockNextStep(),Wizard.getComponent().on("change",".t3js-localization-toggle-record",e=>{const a=$(e.currentTarget),t=a.data("uid"),l=a.closest("fieldset"),i=l.find(".t3js-localization-toggle-column");if(a.is(":checked"))this.records.push(t);else{const e=this.records.indexOf(t);e>-1&&this.records.splice(e,1)}const s=l.find(".t3js-localization-toggle-record"),o=l.find(".t3js-localization-toggle-record:checked");i.prop("checked",o.length>0),i.prop("indeterminate",o.length>0&&o.length<s.length),this.records.length>0?Wizard.unlockNextStep():Wizard.lockNextStep()}).on("change",".t3js-localization-toggle-column",e=>{const a=$(e.currentTarget),t=a.closest("fieldset").find(".t3js-localization-toggle-record");t.prop("checked",a.is(":checked")),t.trigger("change")})})}),Wizard.addFinalProcessingSlide(()=>{this.localizeRecords(parseInt(l.data("pageId"),10),parseInt(l.data("languageId"),10),this.records).then(()=>{Wizard.dismiss(),document.location.reload()})}).then(()=>{Wizard.show(),Wizard.getComponent().on("click",".t3js-localization-option",e=>{const a=$(e.currentTarget),t=a.find('input[type="radio"]');if(a.data("helptext")){const t=$(e.delegateTarget);t.find(".t3js-localization-option").removeClass("active"),t.find(".t3js-helptext").addClass("text-muted"),a.addClass("active"),t.find(a.data("helptext")).removeClass("text-muted")}this.localizationMode=t.val(),Wizard.unlockNextStep()})})})})})}loadAvailableLanguages(e,a){return new AjaxRequest(TYPO3.settings.ajaxUrls.page_languages).withQueryArguments({pageId:e,languageId:a}).get()}getSummary(e,a){return new AjaxRequest(TYPO3.settings.ajaxUrls.records_localize_summary).withQueryArguments({pageId:e,destLanguageId:a,languageId:this.sourceLanguage}).get()}localizeRecords(e,a,t){return new AjaxRequest(TYPO3.settings.ajaxUrls.records_localize).withQueryArguments({pageId:e,srcLanguageId:this.sourceLanguage,destLanguageId:a,action:this.localizationMode,uidList:t}).get()}}export default new Localization; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Login.js b/typo3/sysext/backend/Resources/Public/JavaScript/Login.js deleted file mode 100644 index a7c73e92a069df33165d0470249d9881d745a871..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Login.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import"TYPO3/CMS/Backend/Input/Clearable.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";class BackendLogin{constructor(){this.ready=!0,this.options={error:".t3js-login-error",errorNoCookies:".t3js-login-error-nocookies",errorNoReferrer:".t3js-login-error-noreferrer",formFields:".t3js-login-formfields",interfaceField:".t3js-login-interface-field",loginForm:"#typo3-login-form",loginUrlLink:"t3js-login-url",submitButton:".t3js-login-submit",submitHandler:null,useridentField:".t3js-login-userident-field"},this.checkLoginRefresh(),this.checkCookieSupport(),this.checkForInterfaceCookie(),this.checkDocumentReferrerSupport(),this.initializeEvents(),top.location.href!==location.href&&(this.ready=!1,top.location.href=location.href),this.ready&&document.body.setAttribute("data-typo3-login-ready","true")}showLoginProcess(){this.showLoadingIndicator(),$(this.options.error).addClass("hidden"),$(this.options.errorNoCookies).addClass("hidden")}showLoadingIndicator(){const e=$(this.options.submitButton);e.html(e.data("loading-text"))}handleSubmit(e){this.showLoginProcess(),"function"==typeof this.options.submitHandler&&this.options.submitHandler(e)}interfaceSelectorChanged(){const e=new Date,o=new Date(e.getTime()+31536e6);document.cookie="typo3-login-interface="+$(this.options.interfaceField).val()+"; expires="+o.toUTCString()+";"}checkForInterfaceCookie(){if($(this.options.interfaceField).length){const e=document.cookie.indexOf("typo3-login-interface=");if(-1!==e){let o=document.cookie.substr(e+22);o=o.substr(0,o.indexOf(";")),$(this.options.interfaceField).val(o)}}}checkDocumentReferrerSupport(){const e=document.getElementById(this.options.loginUrlLink);null!==e&&void 0===e.dataset.referrerCheckEnabled&&"1"!==e.dataset.referrerCheckEnabled||void 0!==TYPO3.settings&&void 0!==TYPO3.settings.ajaxUrls&&new AjaxRequest(TYPO3.settings.ajaxUrls.login_preflight).get().then(async e=>{!0!==(await e.resolve("application/json")).capabilities.referrer&&document.querySelectorAll(this.options.errorNoReferrer).forEach(e=>e.classList.remove("hidden"))})}showCookieWarning(){$(this.options.formFields).addClass("hidden"),$(this.options.errorNoCookies).removeClass("hidden")}hideCookieWarning(){$(this.options.formFields).removeClass("hidden"),$(this.options.errorNoCookies).addClass("hidden")}checkLoginRefresh(){const e=document.querySelector(this.options.loginForm+' input[name="loginRefresh"]');e instanceof HTMLInputElement&&e.value&&window.opener&&window.opener.TYPO3&&window.opener.TYPO3.LoginRefresh&&(window.opener.TYPO3.LoginRefresh.startTask(),window.close())}checkCookieSupport(){const e=navigator.cookieEnabled;!1===e?this.showCookieWarning():document.cookie||null!==e||(document.cookie="typo3-login-cookiecheck=1",document.cookie?document.cookie="typo3-login-cookiecheck=; expires="+new Date(0).toUTCString():this.showCookieWarning())}initializeEvents(){$(document).ajaxStart(this.showLoadingIndicator.bind(this)),$(this.options.loginForm).on("submit",this.handleSubmit.bind(this)),$(this.options.interfaceField).length>0&&$(document).on("change blur",this.options.interfaceField,this.interfaceSelectorChanged.bind(this)),document.querySelectorAll(".t3js-clearable").forEach(e=>e.clearable()),$(".t3js-login-news-carousel").on("slide.bs.carousel",e=>{const o=$(e.relatedTarget).height();$(e.target).find("div.active").parent().animate({height:o},500)})}}export default new BackendLogin; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/LoginRefresh.js b/typo3/sysext/backend/Resources/Public/JavaScript/LoginRefresh.js deleted file mode 100644 index 458cd90c8a823974255d19854eb4e34d717a4f08..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/LoginRefresh.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Notification from"TYPO3/CMS/Backend/Notification.js";var MarkupIdentifiers;!function(e){e.loginrefresh="t3js-modal-loginrefresh",e.lockedModal="t3js-modal-backendlocked",e.loginFormModal="t3js-modal-backendloginform"}(MarkupIdentifiers||(MarkupIdentifiers={}));class LoginRefresh{constructor(){this.options={modalConfig:{backdrop:"static"}},this.intervalTime=60,this.intervalId=null,this.backendIsLocked=!1,this.isTimingOut=!1,this.$timeoutModal=null,this.$backendLockedModal=null,this.$loginForm=null,this.loginFramesetUrl="",this.logoutUrl="",this.submitForm=e=>{e.preventDefault();const o=this.$loginForm.find("form"),t=o.find("input[name=p_field]"),i=o.find("input[name=userident]"),s=t.val();if(""===s&&""===i.val())return Notification.error(TYPO3.lang["mess.refresh_login_failed"],TYPO3.lang["mess.refresh_login_emptyPassword"]),void t.focus();s&&(i.val(s),t.val(""));const a={login_status:"login"};$.each(o.serializeArray(),(function(e,o){a[o.name]=o.value})),new AjaxRequest(o.attr("action")).post(a).then(async e=>{(await e.resolve()).login.success?this.hideLoginForm():(Notification.error(TYPO3.lang["mess.refresh_login_failed"],TYPO3.lang["mess.refresh_login_failed_message"]),t.focus())})},this.checkActiveSession=()=>{new AjaxRequest(TYPO3.settings.ajaxUrls.login_timedout).get().then(async e=>{const o=await e.resolve();o.login.locked?this.backendIsLocked||(this.backendIsLocked=!0,this.showBackendLockedModal()):this.backendIsLocked&&(this.backendIsLocked=!1,this.hideBackendLockedModal()),this.backendIsLocked||(o.login.timed_out||o.login.will_time_out)&&(o.login.timed_out?this.showLoginForm():this.showTimeoutModal())})}}initialize(e){"object"==typeof e&&this.applyOptions(e),this.initializeTimeoutModal(),this.initializeBackendLockedModal(),this.initializeLoginForm(),this.startTask()}startTask(){if(null!==this.intervalId)return;let e=1e3*this.intervalTime;this.intervalId=setInterval(this.checkActiveSession,e)}stopTask(){clearInterval(this.intervalId),this.intervalId=null}setIntervalTime(e){this.intervalTime=Math.min(e,86400)}setLogoutUrl(e){this.logoutUrl=e}setLoginFramesetUrl(e){this.loginFramesetUrl=e}showTimeoutModal(){this.isTimingOut=!0,this.$timeoutModal.modal(this.options.modalConfig),this.$timeoutModal.modal("show"),this.fillProgressbar(this.$timeoutModal)}hideTimeoutModal(){this.isTimingOut=!1,this.$timeoutModal.modal("hide")}showBackendLockedModal(){this.$backendLockedModal.modal(this.options.modalConfig),this.$backendLockedModal.modal("show")}hideBackendLockedModal(){this.$backendLockedModal.modal("hide")}showLoginForm(){new AjaxRequest(TYPO3.settings.ajaxUrls.logout).get().then(()=>{TYPO3.configuration.showRefreshLoginPopup?this.showLoginPopup():(this.$loginForm.modal(this.options.modalConfig),this.$loginForm.modal("show"))})}showLoginPopup(){const e=window.open(this.loginFramesetUrl,"relogin_"+Math.random().toString(16).slice(2),"height=450,width=700,status=0,menubar=0,location=1");e&&e.focus()}hideLoginForm(){this.$loginForm.modal("hide")}initializeBackendLockedModal(){this.$backendLockedModal=this.generateModal(MarkupIdentifiers.lockedModal),this.$backendLockedModal.find(".modal-header h4").text(TYPO3.lang["mess.please_wait"]),this.$backendLockedModal.find(".modal-body").append($("<p />").text(TYPO3.lang["mess.be_locked"])),this.$backendLockedModal.find(".modal-footer").remove(),$("body").append(this.$backendLockedModal)}initializeTimeoutModal(){this.$timeoutModal=this.generateModal(MarkupIdentifiers.loginrefresh),this.$timeoutModal.addClass("modal-severity-notice"),this.$timeoutModal.find(".modal-header h4").text(TYPO3.lang["mess.login_about_to_expire_title"]),this.$timeoutModal.find(".modal-body").append($("<p />").text(TYPO3.lang["mess.login_about_to_expire"]),$("<div />",{class:"progress"}).append($("<div />",{class:"progress-bar progress-bar-warning progress-bar-striped progress-bar-animated",role:"progressbar","aria-valuemin":"0","aria-valuemax":"100"}).append($("<span />",{class:"sr-only"})))),this.$timeoutModal.find(".modal-footer").append($("<button />",{class:"btn btn-default","data-action":"logout"}).text(TYPO3.lang["mess.refresh_login_logout_button"]).on("click",()=>{top.location.href=this.logoutUrl}),$("<button />",{class:"btn btn-primary t3js-active","data-action":"refreshSession"}).text(TYPO3.lang["mess.refresh_login_refresh_button"]).on("click",()=>{new AjaxRequest(TYPO3.settings.ajaxUrls.login_timedout).get().then(()=>{this.hideTimeoutModal()})})),this.registerDefaultModalEvents(this.$timeoutModal),$("body").append(this.$timeoutModal)}initializeLoginForm(){if(TYPO3.configuration.showRefreshLoginPopup)return;this.$loginForm=this.generateModal(MarkupIdentifiers.loginFormModal),this.$loginForm.addClass("modal-notice");let e=String(TYPO3.lang["mess.refresh_login_title"]).replace("%s",TYPO3.configuration.username);this.$loginForm.find(".modal-header h4").text(e),this.$loginForm.find(".modal-body").append($("<p />").text(TYPO3.lang["mess.login_expired"]),$("<form />",{id:"beLoginRefresh",method:"POST",action:TYPO3.settings.ajaxUrls.login}).append($("<div />").append($("<input />",{type:"text",name:"username",class:"d-none",value:TYPO3.configuration.username}),$("<input />",{type:"hidden",name:"userident",id:"t3-loginrefresh-userident"})),$("<div />",{class:"form-group"}).append($("<input />",{type:"password",name:"p_field",autofocus:"autofocus",class:"form-control",placeholder:TYPO3.lang["mess.refresh_login_password"]})))),this.$loginForm.find(".modal-body .d-none").attr("autocomplete","username"),this.$loginForm.find(".modal-body .form-control").attr("autocomplete","current-password"),this.$loginForm.find(".modal-footer").append($("<a />",{href:this.logoutUrl,class:"btn btn-default"}).text(TYPO3.lang["mess.refresh_exit_button"]),$("<button />",{type:"button",class:"btn btn-primary","data-action":"refreshSession"}).text(TYPO3.lang["mess.refresh_login_button"]).on("click",()=>{this.$loginForm.find("form").trigger("submit")})),this.registerDefaultModalEvents(this.$loginForm).on("submit",this.submitForm),$("body").append(this.$loginForm)}generateModal(e){return $("<div />",{id:e,class:"t3js-modal "+e+" modal modal-type-default modal-severity-notice modal-style-light modal-size-small fade"}).append($("<div />",{class:"modal-dialog"}).append($("<div />",{class:"modal-content"}).append($("<div />",{class:"modal-header"}).append($("<h4 />",{class:"modal-title"})),$("<div />",{class:"modal-body"}),$("<div />",{class:"modal-footer"}))))}fillProgressbar(e){if(!this.isTimingOut)return;let o=0;const t=e.find(".progress-bar"),i=t.children(".sr-only"),s=setInterval(()=>{const e=o>=100;!this.isTimingOut||e?(clearInterval(s),e&&(this.hideTimeoutModal(),this.showLoginForm()),o=0):o+=1;const a=o+"%";t.css("width",a),i.text(a)},300)}registerDefaultModalEvents(e){return e.on("hidden.bs.modal",()=>{this.startTask()}).on("shown.bs.modal",()=>{this.stopTask(),this.$timeoutModal.find(".modal-footer .t3js-active").first().focus()}),e}applyOptions(e){void 0!==e.intervalTime&&this.setIntervalTime(e.intervalTime),void 0!==e.loginFramesetUrl&&this.setLoginFramesetUrl(e.loginFramesetUrl),void 0!==e.logoutUrl&&this.setLogoutUrl(e.logoutUrl)}}let loginRefreshObject;try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.LoginRefresh&&(loginRefreshObject=window.opener.TYPO3.LoginRefresh),parent&&parent.window.TYPO3&&parent.window.TYPO3.LoginRefresh&&(loginRefreshObject=parent.window.TYPO3.LoginRefresh),top&&top.TYPO3&&top.TYPO3.LoginRefresh&&(loginRefreshObject=top.TYPO3.LoginRefresh)}catch{}loginRefreshObject||(loginRefreshObject=new LoginRefresh,"undefined"!=typeof TYPO3&&(TYPO3.LoginRefresh=loginRefreshObject));export default loginRefreshObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js b/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js deleted file mode 100644 index 6e2273338ef782e2b6a4ca38ee1fc828750201cd..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Modal.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import{html,render}from"lit";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import Severity from"TYPO3/CMS/Backend/Severity.js";var Identifiers,Sizes,Styles,Types;!function(t){t.modal=".t3js-modal",t.content=".t3js-modal-content",t.title=".t3js-modal-title",t.close=".t3js-modal-close",t.body=".t3js-modal-body",t.footer=".t3js-modal-footer",t.iframe=".t3js-modal-iframe",t.iconPlaceholder=".t3js-modal-icon-placeholder"}(Identifiers||(Identifiers={})),function(t){t.small="small",t.default="default",t.medium="medium",t.large="large",t.full="full"}(Sizes||(Sizes={})),function(t){t.default="default",t.light="light",t.dark="dark"}(Styles||(Styles={})),function(t){t.default="default",t.ajax="ajax",t.iframe="iframe"}(Types||(Types={}));class Modal{constructor(t){this.sizes=Sizes,this.styles=Styles,this.types=Types,this.currentModal=null,this.instances=[],this.$template=$('\n <div class="t3js-modal modal fade">\n <div class="modal-dialog">\n <div class="t3js-modal-content modal-content">\n <div class="modal-header">\n <h4 class="t3js-modal-title modal-title"></h4>\n <button class="t3js-modal-close close">\n <span aria-hidden="true">\n <span class="t3js-modal-icon-placeholder" data-icon="actions-close"></span>\n </span>\n <span class="sr-only"></span>\n </button>\n </div>\n <div class="t3js-modal-body modal-body"></div>\n <div class="t3js-modal-footer modal-footer"></div>\n </div>\n </div>\n </div>'),this.defaultConfiguration={type:Types.default,title:"Information",content:"No content provided, please check your <code>Modal</code> configuration.",severity:SeverityEnum.notice,buttons:[],style:Styles.default,size:Sizes.default,additionalCssClasses:[],callback:$.noop(),ajaxCallback:$.noop(),ajaxTarget:null},this.securityUtility=t,$(document).on("modal-dismiss",this.dismiss),this.initializeMarkupTrigger(document)}static resolveEventNameTargetElement(t){const e=t.target,a=t.currentTarget;return e.dataset&&e.dataset.eventName?e:a.dataset&&a.dataset.eventName?a:null}static createModalResponseEventFromElement(t,e){return t&&t.dataset.eventName?new CustomEvent(t.dataset.eventName,{bubbles:!0,detail:{result:e,payload:t.dataset.eventPayload||null}}):null}dismiss(){this.currentModal&&this.currentModal.modal("hide")}confirm(t,e,a=SeverityEnum.warning,n=[],s){return 0===n.length&&n.push({text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(a),name:"ok"}),this.advanced({title:t,content:e,severity:a,buttons:n,additionalCssClasses:s,callback:t=>{t.on("button.clicked",t=>{"cancel"===t.target.getAttribute("name")?$(t.currentTarget).trigger("confirm.button.cancel"):"ok"===t.target.getAttribute("name")&&$(t.currentTarget).trigger("confirm.button.ok")})}})}loadUrl(t,e=SeverityEnum.info,a,n,s,i){return this.advanced({type:Types.ajax,title:t,severity:e,buttons:a,ajaxCallback:s,ajaxTarget:i,content:n})}show(t,e,a=SeverityEnum.info,n,s){return this.advanced({type:Types.default,title:t,content:e,severity:a,buttons:n,additionalCssClasses:s})}advanced(t){return t.type="string"==typeof t.type&&t.type in Types?t.type:this.defaultConfiguration.type,t.title="string"==typeof t.title?t.title:this.defaultConfiguration.title,t.content="string"==typeof t.content||"object"==typeof t.content?t.content:this.defaultConfiguration.content,t.severity=void 0!==t.severity?t.severity:this.defaultConfiguration.severity,t.buttons=t.buttons||this.defaultConfiguration.buttons,t.size="string"==typeof t.size&&t.size in Sizes?t.size:this.defaultConfiguration.size,t.style="string"==typeof t.style&&t.style in Styles?t.style:this.defaultConfiguration.style,t.additionalCssClasses=t.additionalCssClasses||this.defaultConfiguration.additionalCssClasses,t.callback="function"==typeof t.callback?t.callback:this.defaultConfiguration.callback,t.ajaxCallback="function"==typeof t.ajaxCallback?t.ajaxCallback:this.defaultConfiguration.ajaxCallback,t.ajaxTarget="string"==typeof t.ajaxTarget?t.ajaxTarget:this.defaultConfiguration.ajaxTarget,this.generate(t)}setButtons(t){const e=this.currentModal.find(Identifiers.footer);if(t.length>0){e.empty();for(let a=0;a<t.length;a++){const n=t[a],s=$("<button />",{class:"btn"});s.html("<span>"+this.securityUtility.encodeHtml(n.text,!1)+"</span>"),n.active&&s.addClass("t3js-active"),""!==n.btnClass&&s.addClass(n.btnClass),""!==n.name&&s.attr("name",n.name),n.action?s.on("click",()=>{e.find("button").not(s).addClass("disabled"),n.action.execute(s.get(0)).then(()=>{this.currentModal.modal("hide")})}):n.trigger&&s.on("click",n.trigger),n.dataAttributes&&Object.keys(n.dataAttributes).length>0&&Object.keys(n.dataAttributes).map(t=>{s.attr("data-"+t,n.dataAttributes[t])}),n.icon&&s.prepend('<span class="t3js-modal-icon-placeholder" data-icon="'+n.icon+'"></span>'),e.append(s)}e.show(),e.find("button").on("click",t=>{$(t.currentTarget).trigger("button.clicked")})}else e.hide();return this.currentModal}initializeMarkupTrigger(t){$(t).on("click",".t3js-modal-trigger",t=>{t.preventDefault();const e=$(t.currentTarget),a=e.data("bs-content")||"Are you sure?",n=void 0!==SeverityEnum[e.data("severity")]?SeverityEnum[e.data("severity")]:SeverityEnum.info;let s=e.data("url")||null;if(null!==s){const t=s.includes("?")?"&":"?";s=s+t+$.param({data:e.data()})}this.advanced({type:null!==s?Types.ajax:Types.default,title:e.data("title")||"Alert",content:null!==s?s:a,severity:n,buttons:[{text:e.data("button-close-text")||TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:()=>{this.currentModal.trigger("modal-dismiss");const e=Modal.resolveEventNameTargetElement(t),a=Modal.createModalResponseEventFromElement(e,!1);null!==a&&e.dispatchEvent(a)}},{text:e.data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(n),trigger:()=>{this.currentModal.trigger("modal-dismiss");const a=Modal.resolveEventNameTargetElement(t),n=Modal.createModalResponseEventFromElement(a,!0);null!==n&&a.dispatchEvent(n);let s=e.attr("data-uri")||e.data("href")||e.attr("href");s&&"#"!==s&&(t.target.ownerDocument.location.href=s),"submit"===t.currentTarget.getAttribute("type")&&(t.currentTarget.closest("form")?.submit(),"BUTTON"===t.currentTarget.tagName&&t.currentTarget.hasAttribute("form")&&t.target.ownerDocument.querySelector("form#"+t.currentTarget.getAttribute("form"))?.submit()),t.currentTarget.hasAttribute("data-target-form")&&t.target.ownerDocument.querySelector("form#"+t.currentTarget.getAttribute("data-target-form"))?.submit()}}]})})}generate(t){const e=this.$template.clone();if(t.additionalCssClasses.length>0)for(let a of t.additionalCssClasses)e.addClass(a);if(e.addClass("modal-type-"+t.type),e.addClass("modal-severity-"+Severity.getCssClass(t.severity)),e.addClass("modal-style-"+t.style),e.addClass("modal-size-"+t.size),e.attr("tabindex","-1"),e.find(Identifiers.title).text(t.title),e.find(Identifiers.close).on("click",()=>{e.modal("hide")}),"ajax"===t.type){const a=t.ajaxTarget?t.ajaxTarget:Identifiers.body,n=e.find(a);Icons.getIcon("spinner-circle",Icons.sizes.default,null,null,Icons.markupIdentifiers.inline).then(e=>{n.html('<div class="modal-loading">'+e+"</div>"),new AjaxRequest(t.content).get().finally(async()=>{this.currentModal.parent().length||this.currentModal.appendTo("body")}).then(async e=>{const n=await e.raw().text();this.currentModal.find(a).empty().append(n),t.ajaxCallback&&t.ajaxCallback(),this.currentModal.trigger("modal-loaded")}).catch(async e=>{const n=await e.raw().text(),s=this.currentModal.find(a).empty();n?s.append(n):render(html`<p><strong>Oops, received a ${e.response.status} response from </strong> <span class="text-break">${t.content}</span>.</p>`,s[0])})})}else"iframe"===t.type?(e.find(Identifiers.body).append($("<iframe />",{src:t.content,name:"modal_frame",class:"modal-iframe t3js-modal-iframe"})),e.find(Identifiers.iframe).on("load",()=>{e.find(Identifiers.title).text(e.find(Identifiers.iframe).get(0).contentDocument.title)})):("string"==typeof t.content&&(t.content=$("<p />").html(this.securityUtility.encodeHtml(t.content))),e.find(Identifiers.body).append(t.content));return e.on("shown.bs.modal",t=>{const e=$(t.currentTarget),a=e.prev(".modal-backdrop"),n=1e3+10*this.instances.length,s=n-10;e.css("z-index",n),a.css("z-index",s),e.find(Identifiers.footer).find(".t3js-active").first().focus(),e.find(Identifiers.iconPlaceholder).each((t,e)=>{Icons.getIcon($(e).data("icon"),Icons.sizes.small,null,null,Icons.markupIdentifiers.inline).then(t=>{this.currentModal.find(Identifiers.iconPlaceholder+"[data-icon="+$(t).data("identifier")+"]").replaceWith(t)})})}),e.on("hide.bs.modal",()=>{if(this.instances.length>0){const t=this.instances.length-1;this.instances.splice(t,1),this.currentModal=this.instances[t-1]}}),e.on("hidden.bs.modal",t=>{e.trigger("modal-destroyed"),$(t.currentTarget).remove(),this.instances.length>0&&$("body").addClass("modal-open")}),e.on("show.bs.modal",e=>{this.currentModal=$(e.currentTarget),this.setButtons(t.buttons),this.instances.push(this.currentModal)}),e.on("modal-dismiss",t=>{$(t.currentTarget).modal("hide")}),t.callback&&t.callback(e),e.modal("show"),e}}let modalObject=null;try{parent&&parent.window.TYPO3&&parent.window.TYPO3.Modal?(parent.window.TYPO3.Modal.initializeMarkupTrigger(document),modalObject=parent.window.TYPO3.Modal):top&&top.TYPO3.Modal&&(top.TYPO3.Modal.initializeMarkupTrigger(document),modalObject=top.TYPO3.Modal)}catch{}modalObject||(modalObject=new Modal(new SecurityUtility),TYPO3.Modal=modalObject);export default modalObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Module/Router.js b/typo3/sysext/backend/Resources/Public/JavaScript/Module/Router.js deleted file mode 100644 index 01b736408ca1ccb82ff7d7c20b825479f5bcff0f..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Module/Router.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var __decorate=function(t,e,o,r){var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};import{html,css,LitElement}from"lit";import{customElement,property,query}from"lit/decorators.js";import{getRecordFromName}from"TYPO3/CMS/Backend/Module.js";const IFRAME_COMPONENT="TYPO3/CMS/Backend/Module/Iframe",alwaysUpdate=(t,e)=>!0;let ModuleRouter=class extends LitElement{constructor(){super(),this.module="",this.endpoint="",this.addEventListener("typo3-module-load",({target:t,detail:e})=>{const o=t.getAttribute("slot");this.pushState({slotName:o,detail:e})}),this.addEventListener("typo3-module-loaded",({detail:t})=>{this.updateBrowserState(t)}),this.addEventListener("typo3-iframe-load",({detail:t})=>{let e={slotName:IFRAME_COMPONENT,detail:t};if(e.detail.url.includes(this.stateTrackerUrl+"?state=")){const t=e.detail.url.split("?state=");e=JSON.parse(decodeURIComponent(t[1]||"{}"))}this.slotElement.getAttribute("name")!==e.slotName&&this.slotElement.setAttribute("name",e.slotName),this.markActive(e.slotName,this.slotElement.getAttribute("name")===IFRAME_COMPONENT?null:e.detail.url,!1),this.updateBrowserState(e.detail),this.parentElement.dispatchEvent(new CustomEvent("typo3-module-load",{bubbles:!0,composed:!0,detail:e.detail}))}),this.addEventListener("typo3-iframe-loaded",({detail:t})=>{this.updateBrowserState(t),this.parentElement.dispatchEvent(new CustomEvent("typo3-module-loaded",{bubbles:!0,composed:!0,detail:t}))})}render(){const t=getRecordFromName(this.module).component||IFRAME_COMPONENT;return html`<slot name="${t}"></slot>`}updated(){const t=getRecordFromName(this.module).component||IFRAME_COMPONENT;this.markActive(t,this.endpoint)}async markActive(t,e,o=!0){const r=await this.getModuleElement(t);e&&(o||r.getAttribute("endpoint")!==e)&&r.setAttribute("endpoint",e),r.hasAttribute("active")||r.setAttribute("active","");for(let t=r.previousElementSibling;null!==t;t=t.previousElementSibling)t.removeAttribute("active");for(let t=r.nextElementSibling;null!==t;t=t.nextElementSibling)t.removeAttribute("active")}async getModuleElement(t){let e=this.querySelector(`*[slot="${t}"]`);if(null!==e)return e;try{const o=await import(t+".js");e=document.createElement(o.componentName)}catch(e){throw console.error({msg:`Error importing ${t} as backend module`,err:e}),e}return e.setAttribute("slot",t),this.appendChild(e),e}async pushState(t){const e=this.stateTrackerUrl+"?state="+encodeURIComponent(JSON.stringify(t));(await this.getModuleElement(IFRAME_COMPONENT)).setAttribute("endpoint",e)}updateBrowserState(t){const e=new URL(t.url||"",window.location.origin),o=new URLSearchParams(e.search),r="title"in t?t.title:"";if(null!==r){const t=[this.sitename];""!==r&&t.unshift(r),this.sitenameFirst&&t.reverse(),document.title=t.join(" · ")}if(!o.has("token"))return;o.delete("token"),e.search=o.toString();const i=e.toString();window.history.replaceState(t,"",i)}};ModuleRouter.styles=css` - :host { - width: 100%; - min-height: 100%; - flex: 1 0 auto; - display: flex; - flex-direction: row; - } - ::slotted(*) { - min-height: 100%; - width: 100%; - } - `,__decorate([property({type:String,hasChanged:alwaysUpdate})],ModuleRouter.prototype,"module",void 0),__decorate([property({type:String,hasChanged:alwaysUpdate})],ModuleRouter.prototype,"endpoint",void 0),__decorate([property({type:String,attribute:"state-tracker"})],ModuleRouter.prototype,"stateTrackerUrl",void 0),__decorate([property({type:String,attribute:"sitename"})],ModuleRouter.prototype,"sitename",void 0),__decorate([property({type:Boolean,attribute:"sitename-first"})],ModuleRouter.prototype,"sitenameFirst",void 0),__decorate([query("slot",!0)],ModuleRouter.prototype,"slotElement",void 0),ModuleRouter=__decorate([customElement("typo3-backend-module-router")],ModuleRouter);export{ModuleRouter}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ModuleMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/ModuleMenu.js deleted file mode 100644 index b80311519b7320bbf775e5fe406c1d7659eee5ed..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ModuleMenu.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{ScaffoldIdentifierEnum}from"TYPO3/CMS/Backend/Enum/Viewport/ScaffoldIdentifier.js";import{getRecordFromName}from"TYPO3/CMS/Backend/Module.js";import $ from"jquery";import PersistentStorage from"TYPO3/CMS/Backend/Storage/Persistent.js";import Viewport from"TYPO3/CMS/Backend/Viewport.js";import ClientRequest from"TYPO3/CMS/Backend/Event/ClientRequest.js";import TriggerRequest from"TYPO3/CMS/Backend/Event/TriggerRequest.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import{ModuleStateStorage}from"TYPO3/CMS/Backend/Storage/ModuleStateStorage.js";class ModuleMenu{constructor(){this.loadedModule=null,this.spaceKeyPressedOnCollapsible=!1,$(()=>this.initialize())}static getCollapsedMainMenuItems(){return PersistentStorage.isset("modulemenu")?JSON.parse(PersistentStorage.get("modulemenu")):{}}static addCollapsedMainMenuItem(e){const t=ModuleMenu.getCollapsedMainMenuItems();t[e]=!0,PersistentStorage.set("modulemenu",JSON.stringify(t))}static removeCollapseMainMenuItem(e){const t=this.getCollapsedMainMenuItems();delete t[e],PersistentStorage.set("modulemenu",JSON.stringify(t))}static includeId(e,t){if(!e.navigationComponentId)return t;let n="";n="TYPO3/CMS/Backend/PageTree/PageTreeElement"===e.navigationComponentId?"web":e.name.split("_")[0];const o=ModuleStateStorage.current(n);return o.selection&&(t="id="+o.selection+"&"+t),t}static toggleMenu(e){const t=$(ScaffoldIdentifierEnum.scaffold),n="scaffold-modulemenu-expanded";void 0===e&&(e=t.hasClass(n)),t.toggleClass(n,!e),e||$(".scaffold").removeClass("scaffold-search-expanded").removeClass("scaffold-toolbar-expanded"),PersistentStorage.set("BackendComponents.States.typo3-module-menu",{collapsed:e})}static toggleModuleGroup(e){const t=e.closest(".modulemenu-group"),n=t.querySelector(".modulemenu-group-container"),o="true"===e.attributes.getNamedItem("aria-expanded").value;o?ModuleMenu.addCollapsedMainMenuItem(e.id):ModuleMenu.removeCollapseMainMenuItem(e.id),t.classList.toggle("modulemenu-group-collapsed",o),t.classList.toggle("modulemenu-group-expanded",!o),e.attributes.getNamedItem("aria-expanded").value=(!o).toString(),$(n).stop().slideToggle()}static highlightModuleMenuItem(e){$(".modulemenu-action.modulemenu-action-active").removeClass("modulemenu-action-active").removeAttr("aria-current"),$("#"+e).addClass("modulemenu-action-active").attr("aria-current","location")}static getPreviousItem(e){let t=e.parentElement.previousElementSibling;return null===t?ModuleMenu.getLastItem(e):t.firstElementChild}static getNextItem(e){let t=e.parentElement.nextElementSibling;return null===t?ModuleMenu.getFirstItem(e):t.firstElementChild}static getFirstItem(e){return e.parentElement.parentElement.firstElementChild.firstElementChild}static getLastItem(e){return e.parentElement.parentElement.lastElementChild.firstElementChild}static getParentItem(e){return e.parentElement.parentElement.parentElement.firstElementChild}static getFirstChildItem(e){return e.nextElementSibling.firstElementChild.firstElementChild}static getLastChildItem(e){return e.nextElementSibling.lastElementChild.firstElementChild}refreshMenu(){new AjaxRequest(TYPO3.settings.ajaxUrls.modulemenu).get().then(async e=>{const t=await e.resolve();document.getElementById("modulemenu").outerHTML=t.menu,this.initializeModuleMenuEvents(),this.loadedModule&&ModuleMenu.highlightModuleMenuItem(this.loadedModule)})}getCurrentModule(){return this.loadedModule}reloadFrames(){Viewport.ContentContainer.refresh()}showModule(e,t,n=null){t=t||"";const o=getRecordFromName(e);return this.loadModuleComponents(o,t,new ClientRequest("typo3.showModule",n))}initialize(){if(null===document.querySelector(".t3js-modulemenu"))return;let e=$.Deferred();e.resolve(),e.then(()=>{this.initializeModuleMenuEvents(),Viewport.Topbar.Toolbar.registerEvent(()=>{document.querySelector(".t3js-scaffold-toolbar")&&this.initializeTopBarEvents()})})}keyboardNavigation(e,t,n=!1){const o=t.parentElement.attributes.getNamedItem("data-level").value;let l=null;switch(n&&(this.spaceKeyPressedOnCollapsible=!1),e.code){case"ArrowUp":l=ModuleMenu.getPreviousItem(t);break;case"ArrowDown":l=ModuleMenu.getNextItem(t);break;case"ArrowLeft":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")?("false"===t.attributes.getNamedItem("aria-expanded").value&&ModuleMenu.toggleModuleGroup(t),l=ModuleMenu.getLastChildItem(t)):"2"===o&&(l=ModuleMenu.getPreviousItem(ModuleMenu.getParentItem(t)));break;case"ArrowRight":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")?("false"===t.attributes.getNamedItem("aria-expanded").value&&ModuleMenu.toggleModuleGroup(t),l=ModuleMenu.getFirstChildItem(t)):"2"===o&&(l=ModuleMenu.getNextItem(ModuleMenu.getParentItem(t)));break;case"Home":l=e.ctrlKey&&"2"===o?ModuleMenu.getFirstItem(ModuleMenu.getParentItem(t)):ModuleMenu.getFirstItem(t);break;case"End":l=e.ctrlKey&&"2"===o?ModuleMenu.getLastItem(ModuleMenu.getParentItem(t)):ModuleMenu.getLastItem(t);break;case"Space":case"Enter":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")&&("Enter"===e.code&&e.preventDefault(),ModuleMenu.toggleModuleGroup(t),"true"===t.attributes.getNamedItem("aria-expanded").value&&(l=ModuleMenu.getFirstChildItem(t),"Space"===e.code&&(this.spaceKeyPressedOnCollapsible=!0)));break;case"Esc":case"Escape":"2"===o&&(l=ModuleMenu.getParentItem(t),ModuleMenu.toggleModuleGroup(l));break;default:l=null}null!==l&&(e.defaultPrevented||e.preventDefault(),l.focus())}initializeModuleMenuEvents(){const e=document.querySelector(".t3js-modulemenu"),t=function(e){"Space"===e.code&&this.spaceKeyPressedOnCollapsible&&(e.preventDefault(),this.spaceKeyPressedOnCollapsible=!1)}.bind(this);new RegularEvent("keydown",this.keyboardNavigation).delegateTo(e,".t3js-modulemenu-action"),e.querySelectorAll('[data-level="2"] a.t3js-modulemenu-action[href]').forEach(e=>{e.addEventListener("keyup",t)}),new RegularEvent("keyup",(e,t)=>{"Space"===e.code&&e.preventDefault()}).delegateTo(e,".t3js-modulemenu-collapsible"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.showModule(t.id,"",e)}).delegateTo(e,"a.t3js-modulemenu-action[href]"),new RegularEvent("click",(e,t)=>{e.preventDefault(),ModuleMenu.toggleModuleGroup(t)}).delegateTo(e,".t3js-modulemenu-collapsible")}initializeTopBarEvents(){const e=document.querySelector(".t3js-scaffold-toolbar");new RegularEvent("keydown",(e,t)=>{this.keyboardNavigation(e,t)}).delegateTo(e,".t3js-modulemenu-action"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.showModule(t.id,"",e)}).delegateTo(e,"a.t3js-modulemenu-action[href]"),new RegularEvent("click",e=>{e.preventDefault(),ModuleMenu.toggleMenu()}).bindTo(document.querySelector(".t3js-topbar-button-modulemenu")),new RegularEvent("click",e=>{e.preventDefault(),ModuleMenu.toggleMenu(!0)}).bindTo(document.querySelector(".t3js-scaffold-content-overlay"));const t=e=>{const t=e.detail.module;if(!t||this.loadedModule===t)return;const n=getRecordFromName(t);n.link&&(ModuleMenu.highlightModuleMenuItem(t),$("#"+t).focus(),this.loadedModule=t,n.navigationComponentId?Viewport.NavigationContainer.showComponent(n.navigationComponentId):Viewport.NavigationContainer.hide(!1))};document.addEventListener("typo3-module-load",t),document.addEventListener("typo3-module-loaded",t)}loadModuleComponents(e,t,n){const o=e.name,l=Viewport.ContentContainer.beforeSetUrl(n);return l.then(()=>{e.navigationComponentId?Viewport.NavigationContainer.showComponent(e.navigationComponentId):Viewport.NavigationContainer.hide(!0),ModuleMenu.highlightModuleMenuItem(o),this.loadedModule=o,t=ModuleMenu.includeId(e,t),this.openInContentContainer(o,e.link,t,new TriggerRequest("typo3.loadModuleComponents",n))}),l}openInContentContainer(e,t,n,o){const l=t+(n?(t.includes("?")?"&":"?")+n:"");return Viewport.ContentContainer.setUrl(l,new TriggerRequest("typo3.openInContentFrame",o),e)}}top.TYPO3.ModuleMenu||(top.TYPO3.ModuleMenu={App:new ModuleMenu});const moduleMenuApp=top.TYPO3.ModuleMenu;export default moduleMenuApp; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/MultiRecordSelection.js b/typo3/sysext/backend/Resources/Public/JavaScript/MultiRecordSelection.js deleted file mode 100644 index d05085df98a3c3bb5ecdd770f6f7f2acf0d58ce4..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/MultiRecordSelection.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Notification from"TYPO3/CMS/Backend/Notification.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var Selectors,Buttons,CheckboxActions,CheckboxState;!function(e){e.actionsSelector=".t3js-multi-record-selection-actions",e.checkboxSelector=".t3js-multi-record-selection-check",e.checkboxActionsSelector=".t3js-multi-record-selection-check-actions",e.checkboxActionsToggleSelector=".t3js-multi-record-selection-check-actions-toggle",e.rowSelectionSelector="[data-multi-record-selection-row-selection] tr"}(Selectors||(Selectors={})),function(e){e.actionButton="button[data-multi-record-selection-action]",e.checkboxActionButton="button[data-multi-record-selection-check-action]"}(Buttons||(Buttons={})),function(e){e.checkAll="check-all",e.checkNone="check-none",e.toggle="toggle"}(CheckboxActions||(CheckboxActions={})),function(e){e.any="",e.checked=":checked",e.unchecked=":not(:checked)"}(CheckboxState||(CheckboxState={}));class MultiRecordSelection{constructor(){this.lastChecked=null,DocumentService.ready().then(()=>{MultiRecordSelection.restoreTemporaryState(),this.registerActions(),this.registerActionsEventHandlers(),this.registerCheckboxActions(),this.registerCheckboxKeyboardActions(),this.registerCheckboxTableRowSelectionAction(),this.registerToggleCheckboxActions(),this.registerDispatchCheckboxStateChangedEvent(),this.registerCheckboxStateChangedEventHandler()})}static getCheckboxes(e=CheckboxState.any,t=""){return document.querySelectorAll(MultiRecordSelection.getCombinedSelector(Selectors.checkboxSelector+e,t))}static getCombinedSelector(e,t){return""!==t?['[data-multi-record-selection-identifier="'+t+'"]',e].join(" "):e}static getIdentifier(e){return e.closest("[data-multi-record-selection-identifier]")?.dataset.multiRecordSelectionIdentifier||""}static changeCheckboxState(e,t){e.checked===t||e.dataset.manuallyChanged||(e.checked=t,e.dispatchEvent(new CustomEvent("multiRecordSelection:checkbox:state:changed",{detail:{identifier:MultiRecordSelection.getIdentifier(e)},bubbles:!0,cancelable:!1})))}static restoreTemporaryState(){const e=MultiRecordSelection.getCheckboxes(CheckboxState.checked);if(!e.length)return;let t=!1,c=[];e.forEach(e=>{e.closest("tr").classList.add("success");const o=MultiRecordSelection.getIdentifier(e);""===o||c.includes(o)||(c.push(o),t=!0,MultiRecordSelection.toggleActionsState(o))}),t||MultiRecordSelection.toggleActionsState()}static toggleActionsState(e=""){const t=document.querySelectorAll(MultiRecordSelection.getCombinedSelector(Selectors.actionsSelector,e));if(!t.length)return;if(!MultiRecordSelection.getCheckboxes(CheckboxState.checked,e).length)return void t.forEach(e=>MultiRecordSelection.changeActionContainerVisibility(e,!1));t.forEach(e=>MultiRecordSelection.changeActionContainerVisibility(e));const c=document.querySelectorAll([MultiRecordSelection.getCombinedSelector(Selectors.actionsSelector,e),Buttons.actionButton].join(" "));c.length&&c.forEach(t=>{if(!t.dataset.multiRecordSelectionActionConfig)return;const c=JSON.parse(t.dataset.multiRecordSelectionActionConfig);if(!c.idField)return;t.classList.add("disabled");const o=MultiRecordSelection.getCheckboxes(CheckboxState.checked,e);for(let e=0;e<o.length;e++)if(o[e].closest("tr").dataset[c.idField]){t.classList.remove("disabled");break}})}static changeActionContainerVisibility(e,t=!0){const c=e.closest(".multi-record-selection-panel")?.children;if(t){if(c)for(let e=0;e<c.length;e++)c[e].classList.add("hidden");e.classList.remove("hidden")}else{if(c)for(let e=0;e<c.length;e++)c[e].classList.remove("hidden");e.classList.add("hidden")}}static unsetManuallyChangedAttribute(e){MultiRecordSelection.getCheckboxes(CheckboxState.any,e).forEach(e=>{e.removeAttribute("data-manually-changed")})}registerActions(){new RegularEvent("click",(e,t)=>{t.dataset.multiRecordSelectionAction;const c=MultiRecordSelection.getIdentifier(t),o=JSON.parse(t.dataset.multiRecordSelectionActionConfig||"{}"),i=MultiRecordSelection.getCheckboxes(CheckboxState.checked,c);i.length&&t.dispatchEvent(new CustomEvent("multiRecordSelection:action:"+t.dataset.multiRecordSelectionAction,{detail:{identifier:c,checkboxes:i,configuration:o},bubbles:!0,cancelable:!1}))}).delegateTo(document,[Selectors.actionsSelector,Buttons.actionButton].join(" "))}registerActionsEventHandlers(){new RegularEvent("multiRecordSelection:actions:show",e=>{const t=e.detail?.identifier||"",c=document.querySelectorAll(MultiRecordSelection.getCombinedSelector(Selectors.actionsSelector,t));c.length&&c.forEach(e=>MultiRecordSelection.changeActionContainerVisibility(e))}).bindTo(document),new RegularEvent("multiRecordSelection:actions:hide",e=>{const t=e.detail?.identifier||"",c=document.querySelectorAll(MultiRecordSelection.getCombinedSelector(Selectors.actionsSelector,t));c.length&&c.forEach(e=>MultiRecordSelection.changeActionContainerVisibility(e,!1))}).bindTo(document)}registerCheckboxActions(){new RegularEvent("click",(e,t)=>{if(e.preventDefault(),!t.dataset.multiRecordSelectionCheckAction)return;const c=MultiRecordSelection.getIdentifier(t),o=MultiRecordSelection.getCheckboxes(CheckboxState.any,c);if(o.length){switch(MultiRecordSelection.unsetManuallyChangedAttribute(c),t.dataset.multiRecordSelectionCheckAction){case CheckboxActions.checkAll:o.forEach(e=>{MultiRecordSelection.changeCheckboxState(e,!0)});break;case CheckboxActions.checkNone:o.forEach(e=>{MultiRecordSelection.changeCheckboxState(e,!1)});break;case CheckboxActions.toggle:o.forEach(e=>{MultiRecordSelection.changeCheckboxState(e,!e.checked)});break;default:Notification.warning("Unknown checkbox action")}MultiRecordSelection.unsetManuallyChangedAttribute(c)}}).delegateTo(document,[Selectors.checkboxActionsSelector,Buttons.checkboxActionButton].join(" "))}registerCheckboxKeyboardActions(){new RegularEvent("click",(e,t)=>this.handleCheckboxKeyboardActions(e,t)).delegateTo(document,Selectors.checkboxSelector)}registerCheckboxTableRowSelectionAction(){new RegularEvent("click",(e,t)=>{const c=e.target.tagName;if("TH"!==c&&"TD"!==c)return;const o=t.querySelector(Selectors.checkboxSelector);null!==o&&(MultiRecordSelection.changeCheckboxState(o,!o.checked),this.handleCheckboxKeyboardActions(e,o,!1))}).delegateTo(document,Selectors.rowSelectionSelector),new RegularEvent("mousedown",e=>(e.shiftKey||e.altKey||e.ctrlKey)&&e.preventDefault()).delegateTo(document,Selectors.rowSelectionSelector)}registerDispatchCheckboxStateChangedEvent(){new RegularEvent("change",(e,t)=>{t.dispatchEvent(new CustomEvent("multiRecordSelection:checkbox:state:changed",{detail:{identifier:MultiRecordSelection.getIdentifier(t)},bubbles:!0,cancelable:!1}))}).delegateTo(document,Selectors.checkboxSelector)}registerCheckboxStateChangedEventHandler(){new RegularEvent("multiRecordSelection:checkbox:state:changed",e=>{const t=e.target,c=e.detail?.identifier||"";t.checked?t.closest("tr").classList.add("success"):t.closest("tr").classList.remove("success"),MultiRecordSelection.toggleActionsState(c)}).bindTo(document)}registerToggleCheckboxActions(){new RegularEvent("click",(e,t)=>{const c=MultiRecordSelection.getIdentifier(t),o=document.querySelector([MultiRecordSelection.getCombinedSelector(Selectors.checkboxActionsSelector,c),'button[data-multi-record-selection-check-action="'+CheckboxActions.checkAll+'"]'].join(" "));null!==o&&o.classList.toggle("disabled",!MultiRecordSelection.getCheckboxes(CheckboxState.unchecked,c).length);const i=document.querySelector([MultiRecordSelection.getCombinedSelector(Selectors.checkboxActionsSelector,c),'button[data-multi-record-selection-check-action="'+CheckboxActions.checkNone+'"]'].join(" "));null!==i&&i.classList.toggle("disabled",!MultiRecordSelection.getCheckboxes(CheckboxState.checked,c).length)}).delegateTo(document,Selectors.checkboxActionsToggleSelector)}handleCheckboxKeyboardActions(e,t,c=!0){const o=MultiRecordSelection.getIdentifier(t);if(this.lastChecked&&document.body.contains(this.lastChecked)&&MultiRecordSelection.getIdentifier(this.lastChecked)===o&&(e.shiftKey||e.altKey||e.ctrlKey)){if(c&&MultiRecordSelection.unsetManuallyChangedAttribute(o),e.shiftKey){const e=Array.from(MultiRecordSelection.getCheckboxes(CheckboxState.any,o)),c=e.indexOf(t),i=e.indexOf(this.lastChecked);e.slice(Math.min(c,i),Math.max(c,i)+1).forEach(e=>{e!==t&&MultiRecordSelection.changeCheckboxState(e,t.checked)})}this.lastChecked=t,(e.altKey||e.ctrlKey)&&MultiRecordSelection.getCheckboxes(CheckboxState.any,o).forEach(e=>{e!==t&&MultiRecordSelection.changeCheckboxState(e,!e.checked)}),MultiRecordSelection.unsetManuallyChangedAttribute(o)}else this.lastChecked=t}}export default new MultiRecordSelection; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/MultiStepWizard.js b/typo3/sysext/backend/Resources/Public/JavaScript/MultiStepWizard.js deleted file mode 100644 index 4e437764ac90eb166e2c421cbda03c3b10d222b3..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/MultiStepWizard.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import $ from"jquery";import Modal from"TYPO3/CMS/Backend/Modal.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import Icons from"TYPO3/CMS/Backend/Icons.js";class MultiStepWizard{constructor(){this.setup={slides:[],settings:{},forceSelection:!0,$carousel:null},this.originalSetup=$.extend(!0,{},this.setup)}set(e,t){return this.setup.settings[e]=t,this}addSlide(e,t,s="",i=SeverityEnum.info,r,a){const l={identifier:e,title:t,content:s,severity:i,progressBarTitle:r,callback:a};return this.setup.slides.push(l),this}addFinalProcessingSlide(e){return e||(e=()=>{this.dismiss()}),Icons.getIcon("spinner-circle",Icons.sizes.default,null,null).then(t=>{let s=$("<div />",{class:"text-center"}).append(t);this.addSlide("final-processing-slide",top.TYPO3.lang["wizard.processing.title"],s[0].outerHTML,Severity.info,null,e)})}show(){let e=this.generateSlides(),t=this.setup.slides[0];Modal.confirm(t.title,e,t.severity,[{text:top.TYPO3.lang["wizard.button.cancel"],active:!0,btnClass:"btn-default pull-left",name:"cancel",trigger:()=>{this.getComponent().trigger("wizard-dismiss")}},{text:top.TYPO3.lang["wizard.button.prev"],btnClass:"btn-"+Severity.getCssClass(t.severity),name:"prev"},{text:top.TYPO3.lang["wizard.button.next"],btnClass:"btn-"+Severity.getCssClass(t.severity),name:"next"}],["modal-multi-step-wizard"]),this.addButtonContainer(),this.addProgressBar(),this.initializeEvents(),this.getComponent().on("wizard-visible",()=>{this.runSlideCallback(t,this.setup.$carousel.find(".carousel-item").first())}).on("wizard-dismissed",()=>{this.setup=$.extend(!0,{},this.originalSetup)})}getComponent(){return null===this.setup.$carousel&&this.generateSlides(),this.setup.$carousel}dismiss(){Modal.dismiss()}lockNextStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="next"]');return e.prop("disabled",!0),e}unlockNextStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="next"]');return e.prop("disabled",!1),e}lockPrevStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="prev"]');return e.prop("disabled",!0),e}unlockPrevStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="prev"]');return e.prop("disabled",!1),e}triggerStepButton(e){let t=this.setup.$carousel.closest(".modal").find('button[name="'+e+'"]');return t.length>0&&!0!==t.prop("disabled")&&t.trigger("click"),t}blurCancelStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="cancel"]');return e.trigger("blur"),e}initializeEvents(){let e=this.setup.$carousel.closest(".modal");this.initializeSlideNextEvent(e),this.initializeSlidePrevEvent(e),this.setup.$carousel.on("slide.bs.carousel",t=>{"left"===t.direction?this.nextSlideChanges(e):this.prevSlideChanges(e)}).on("slid.bs.carousel",e=>{let t=this.setup.$carousel.data("currentIndex"),s=this.setup.slides[t];this.runSlideCallback(s,$(e.relatedTarget)),this.setup.forceSelection&&this.lockNextStep()});let t=this.getComponent();t.on("wizard-dismiss",this.dismiss),Modal.currentModal.on("hidden.bs.modal",()=>{t.trigger("wizard-dismissed")}).on("shown.bs.modal",()=>{t.trigger("wizard-visible")})}initializeSlideNextEvent(e){e.find(".modal-footer").find('button[name="next"]').off().on("click",()=>{this.setup.$carousel.carousel("next")})}initializeSlidePrevEvent(e){e.find(".modal-footer").find('button[name="prev"]').off().on("click",()=>{this.setup.$carousel.carousel("prev")})}nextSlideChanges(e){this.initializeSlideNextEvent(e);const t=e.find(".modal-title"),s=e.find(".modal-footer"),i=this.setup.$carousel.data("currentSlide")+1,r=this.setup.$carousel.data("currentIndex"),a=r+1;t.text(this.setup.slides[a].title),this.setup.$carousel.data("currentSlide",i),this.setup.$carousel.data("currentIndex",a);const l=s.find(".progress-bar");l.eq(r).width("0%"),l.eq(a).width(this.setup.$carousel.data("initialStep")*i+"%").removeClass("inactive"),this.updateCurrentSeverity(e,r,a)}prevSlideChanges(e){this.initializeSlidePrevEvent(e);const t=e.find(".modal-title"),s=e.find(".modal-footer"),i=s.find('button[name="next"]'),r=this.setup.$carousel.data("currentSlide")-1,a=this.setup.$carousel.data("currentIndex"),l=a-1;this.setup.$carousel.data("currentSlide",r),this.setup.$carousel.data("currentIndex",l),t.text(this.setup.slides[l].title),s.find(".progress-bar.last-step").width(this.setup.$carousel.data("initialStep")+"%").text(this.getProgressBarTitle(this.setup.$carousel.data("slideCount")-1)),i.text(top.TYPO3.lang["wizard.button.next"]);const n=s.find(".progress-bar");n.eq(a).width(this.setup.$carousel.data("initialStep")+"%").addClass("inactive"),n.eq(l).width(this.setup.$carousel.data("initialStep")*r+"%").removeClass("inactive"),this.updateCurrentSeverity(e,a,l)}updateCurrentSeverity(e,t,s){e.find(".modal-footer").find('button[name="next"]').removeClass("btn-"+Severity.getCssClass(this.setup.slides[t].severity)).addClass("btn-"+Severity.getCssClass(this.setup.slides[s].severity)),e.removeClass("modal-severity-"+Severity.getCssClass(this.setup.slides[t].severity)).addClass("modal-severity-"+Severity.getCssClass(this.setup.slides[s].severity))}getProgressBarTitle(e){let t;return t=null===this.setup.slides[e].progressBarTitle?0===e?top.TYPO3.lang["wizard.progressStep.start"]:e>=this.setup.$carousel.data("slideCount")-1?top.TYPO3.lang["wizard.progressStep.finish"]:top.TYPO3.lang["wizard.progressStep"]+String(e+1):this.setup.slides[e].progressBarTitle,t}runSlideCallback(e,t){"function"==typeof e.callback&&e.callback(t,this.setup.settings,e.identifier)}addProgressBar(){let e,t=this.setup.$carousel.find(".carousel-item").length,s=Math.max(1,t),i=this.setup.$carousel.closest(".modal").find(".modal-footer");if(e=Math.round(100/s),this.setup.$carousel.data("initialStep",e).data("slideCount",s).data("realSlideCount",t).data("currentIndex",0).data("currentSlide",1),s>1){i.prepend($("<div />",{class:"progress"}));for(let t=0;t<this.setup.slides.length;++t){let s;s=0===t?"progress-bar first-step":t===this.setup.$carousel.data("slideCount")-1?"progress-bar last-step inactive":"progress-bar step inactive",i.find(".progress").append($("<div />",{role:"progressbar",class:s,"aria-valuemin":0,"aria-valuenow":e,"aria-valuemax":100}).width(e+"%").text(this.getProgressBarTitle(t)))}}}addButtonContainer(){this.setup.$carousel.closest(".modal").find(".modal-footer .btn").wrapAll('<div class="modal-btn-group" />')}generateSlides(){if(null!==this.setup.$carousel)return this.setup.$carousel;let e='<div class="carousel slide" data-bs-ride="carousel" data-bs-interval="false"><div class="carousel-inner" role="listbox">';for(let t=0;t<this.setup.slides.length;++t){let s=this.setup.slides[t],i=s.content;"object"==typeof i&&(i=i.html()),e+='<div class="carousel-item" data-bs-slide="'+s.identifier+'" data-step="'+t+'">'+i+"</div>"}return e+="</div></div>",this.setup.$carousel=$(e),this.setup.$carousel.find(".carousel-item").first().addClass("active"),this.setup.$carousel}}let multistepWizardObject;try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.MultiStepWizard&&(multistepWizardObject=window.opener.TYPO3.MultiStepWizard),parent&&parent.window.TYPO3&&parent.window.TYPO3.MultiStepWizard&&(multistepWizardObject=parent.window.TYPO3.MultiStepWizard),top&&top.TYPO3&&top.TYPO3.MultiStepWizard&&(multistepWizardObject=top.TYPO3.MultiStepWizard)}catch(e){}multistepWizardObject||(multistepWizardObject=new MultiStepWizard,"undefined"!=typeof TYPO3&&(TYPO3.MultiStepWizard=multistepWizardObject));export default multistepWizardObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/NewContentElementWizard.js b/typo3/sysext/backend/Resources/Public/JavaScript/NewContentElementWizard.js deleted file mode 100644 index 12395dc40055285c362af8d658bcfe81443b6e49..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/NewContentElementWizard.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import DebounceEvent from"TYPO3/CMS/Core/Event/DebounceEvent.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";var ClassNames,Selectors;!function(e){e.wizardWindow="t3-new-content-element-wizard-window"}(ClassNames||(ClassNames={})),function(e){e.modalBodySelector=".t3js-modal-body",e.modalTabsSelector=".t3js-tabs",e.elementsFilterSelector=".t3js-contentWizard-search",e.noResultSelector=".t3js-filter-noresult",e.wizardWindowSelector=".t3-new-content-element-wizard-window",e.wizardElementSelector=".t3js-media-new-content-element-wizard",e.wizardElementWithTargetSelector="button[data-target]",e.wizardElementWithPositionMapArugmentsSelector="button[data-position-map-arguments]"}(Selectors||(Selectors={}));export class NewContentElementWizard{constructor(e){this.modal=e,this.elementsFilter=this.modal.querySelector(Selectors.elementsFilterSelector),this.modal.querySelector(Selectors.modalBodySelector)?.classList.add(ClassNames.wizardWindow),this.registerEvents()}static getTabIdentifier(e){const t=e.querySelector("a"),[,o]=t.href.split("#");return o}static countVisibleContentElements(e){return e.querySelectorAll(Selectors.wizardElementSelector+":not(.hidden)").length}registerEvents(){new RegularEvent("shown.bs.modal",()=>{this.elementsFilter.focus()}).bindTo(this.modal),new RegularEvent("keydown",e=>{const t=e.target;"Escape"===e.code&&(e.stopImmediatePropagation(),t.value="")}).bindTo(this.elementsFilter),new DebounceEvent("keyup",e=>{this.filterElements(e.target)},150).bindTo(this.elementsFilter),new RegularEvent("search",e=>{this.filterElements(e.target)}).bindTo(this.elementsFilter),new RegularEvent("click",e=>{e.preventDefault(),e.stopPropagation()}).delegateTo(this.modal,[Selectors.modalTabsSelector,".disabled"].join(" ")),new RegularEvent("click",(e,t)=>{e.preventDefault();const o=t.dataset.target;o&&(Modal.dismiss(),top.list_frame.location.href=o)}).delegateTo(this.modal,[Selectors.wizardWindowSelector,Selectors.wizardElementWithTargetSelector].join(" ")),new RegularEvent("click",(e,t)=>{if(e.preventDefault(),!t.dataset.positionMapArguments)return;const o=JSON.parse(t.dataset.positionMapArguments);o.url&&new AjaxRequest(o.url).post({defVals:o.defVals,saveAndClose:o.saveAndClose?"1":"0"}).then(async e=>{this.modal.querySelector(Selectors.wizardWindowSelector).innerHTML=await e.raw().text()}).catch(()=>{Notification.error("Could not load module data")})}).delegateTo(this.modal,[Selectors.wizardWindowSelector,Selectors.wizardElementWithPositionMapArugmentsSelector].join(" "))}filterElements(e){const t=this.modal.querySelector(Selectors.modalTabsSelector),o=this.modal.querySelector(Selectors.noResultSelector);this.modal.querySelectorAll(Selectors.wizardElementSelector).forEach(t=>{const o=t.textContent.trim().replace(/\s+/g," ");t.classList.toggle("hidden",""!==e.value&&!RegExp(e.value,"i").test(o))});const a=NewContentElementWizard.countVisibleContentElements(this.modal);t.parentElement.classList.toggle("hidden",0===a),o.classList.toggle("hidden",a>0),this.switchTabIfNecessary(t)}switchTabIfNecessary(e){const t=e.querySelector(".active").parentElement,o=Array.from(t.parentElement.children);for(let e of o){const t=NewContentElementWizard.getTabIdentifier(e),o=e.querySelector("a");o.classList.toggle("disabled",!this.hasTabContent(t)),o.classList.contains("disabled")?o.setAttribute("tabindex","-1"):o.removeAttribute("tabindex")}if(!this.hasTabContent(NewContentElementWizard.getTabIdentifier(t)))for(let a of o){if(a===t)continue;const o=NewContentElementWizard.getTabIdentifier(a);if(this.hasTabContent(o)){this.switchTab(e.parentElement,o);break}}}hasTabContent(e){const t=this.modal.querySelector("#"+e);return NewContentElementWizard.countVisibleContentElements(t)>0}switchTab(e,t){const o=e.querySelector(`a[href="#${t}"]`),a=this.modal.querySelector("#"+t);e.querySelector("a.active").classList.remove("active"),e.querySelector(".tab-pane.active").classList.remove("active"),o.classList.add("active"),a.classList.add("active")}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/NewContentElementWizardButton.js b/typo3/sysext/backend/Resources/Public/JavaScript/NewContentElementWizardButton.js deleted file mode 100644 index 4dbe925e836272b528936b60094a968c395d15bb..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/NewContentElementWizardButton.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var NewContentElementWizardButton_1,__decorate=function(e,t,n,o){var r,a=arguments.length,i=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(i=(a<3?r(i):a>3?r(t,n,i):r(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i};import{customElement,property}from"lit/decorators.js";import{html,LitElement}from"lit";import Modal from"TYPO3/CMS/Backend/Modal.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import{NewContentElementWizard}from"TYPO3/CMS/Backend/NewContentElementWizard.js";let NewContentElementWizardButton=NewContentElementWizardButton_1=class extends LitElement{constructor(){super(),this.addEventListener("click",e=>{e.preventDefault(),this.renderWizard()})}static handleModalContentLoaded(e){e&&e.querySelector(".t3-new-content-element-wizard-inner")&&new NewContentElementWizard(e)}render(){return html`<slot></slot>`}renderWizard(){this.url&&Modal.advanced({content:this.url,title:this.title,severity:SeverityEnum.notice,size:Modal.sizes.medium,type:Modal.types.ajax,ajaxCallback:()=>NewContentElementWizardButton_1.handleModalContentLoaded(Modal.currentModal[0])})}};__decorate([property({type:String})],NewContentElementWizardButton.prototype,"url",void 0),__decorate([property({type:String})],NewContentElementWizardButton.prototype,"title",void 0),NewContentElementWizardButton=NewContentElementWizardButton_1=__decorate([customElement("typo3-backend-new-content-element-wizard-button")],NewContentElementWizardButton);export{NewContentElementWizardButton}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js b/typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js deleted file mode 100644 index e4e41d06295d5d28388b4f6e84bf1862f1ba41c0..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import{MessageUtility}from"TYPO3/CMS/Backend/Utility/MessageUtility.js";import{KeyTypesEnum}from"TYPO3/CMS/Backend/Enum/KeyTypes.js";import NProgress from"nprogress";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Severity from"TYPO3/CMS/Backend/Severity.js";class OnlineMedia{constructor(){this.securityUtility=new SecurityUtility,$(()=>{this.registerEvents()})}registerEvents(){const e=this;$(document).on("click",".t3js-online-media-add-btn",t=>{e.triggerModal($(t.currentTarget))})}addOnlineMedia(e,t){const i=e.data("target-folder"),r=e.data("online-media-allowed"),o=e.data("file-irre-object");NProgress.start(),new AjaxRequest(TYPO3.settings.ajaxUrls.online_media_create).post({url:t,targetFolder:i,allowed:r}).then(async e=>{const t=await e.resolve();if(t.file){const e={actionName:"typo3:foreignRelation:insert",objectGroup:o,table:"sys_file",uid:t.file};MessageUtility.send(e)}else{const e=Modal.confirm("ERROR",t.error,Severity.error,[{text:TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(Severity.error),name:"ok",active:!0}]).on("confirm.button.ok",()=>{e.modal("hide")})}NProgress.done()})}triggerModal(e){const t=e.data("btn-submit")||"Add",i=e.data("placeholder")||"Paste media url here...",r=$.map(e.data("online-media-allowed").split(","),e=>'<span class="label label-success">'+this.securityUtility.encodeHtml(e.toUpperCase(),!1)+"</span>"),o=e.data("online-media-allowed-help-text")||"Allow to embed from sources:",a=$("<div>").attr("class","form-control-wrap").append([$("<input>").attr("type","text").attr("class","form-control online-media-url").attr("placeholder",i),$("<div>").attr("class","help-block").html(this.securityUtility.encodeHtml(o,!1)+"<br>"+r.join(" "))]),n=Modal.show(e.attr("title"),a,Severity.notice,[{text:t,btnClass:"btn btn-primary",name:"ok",trigger:()=>{const t=n.find("input.online-media-url").val();t&&(n.modal("hide"),this.addOnlineMedia(e,t))}}]);n.on("shown.bs.modal",e=>{$(e.currentTarget).find("input.online-media-url").first().focus().on("keydown",e=>{e.keyCode===KeyTypesEnum.ENTER&&n.find('button[name="ok"]').trigger("click")})})}}export default new OnlineMedia; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/PageActions.js b/typo3/sysext/backend/Resources/Public/JavaScript/PageActions.js deleted file mode 100644 index ec27bd26e8dbb367c912951650738ac04de35af8..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/PageActions.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{KeyTypesEnum}from"TYPO3/CMS/Backend/Enum/KeyTypes.js";import $ from"jquery";import PersistentStorage from"TYPO3/CMS/Backend/Storage/Persistent.js";import"TYPO3/CMS/Backend/Element/IconElement.js";import"TYPO3/CMS/Backend/NewContentElementWizardButton.js";var IdentifierEnum;!function(e){e.pageTitle=".t3js-title-inlineedit",e.hiddenElements=".t3js-hidden-record"}(IdentifierEnum||(IdentifierEnum={}));class PageActions{constructor(){this.pageId=0,this.pageOverlayId=0,this.$pageTitle=null,this.$showHiddenElementsCheckbox=null,$(()=>{this.initializeElements(),this.initializeEvents(),this.initializePageTitleRenaming()})}setPageId(e){this.pageId=e}setLanguageOverlayId(e){this.pageOverlayId=e}initializePageTitleRenaming(){if(!$.isReady)return void $(()=>{this.initializePageTitleRenaming()});if(this.pageId<=0)return;const e=$('<button type="button" class="btn btn-link" aria-label="'+TYPO3.lang.editPageTitle+'" data-action="edit"><typo3-backend-icon identifier="actions-open" size="small"></typo3-backend-icon></button>');e.on("click",()=>{this.editPageTitle()}),this.$pageTitle.on("dblclick",()=>{this.editPageTitle()}).append(e)}initializeElements(){this.$pageTitle=$(IdentifierEnum.pageTitle+":first"),this.$showHiddenElementsCheckbox=$("#checkShowHidden")}initializeEvents(){this.$showHiddenElementsCheckbox.on("change",this.toggleContentElementVisibility)}toggleContentElementVisibility(e){const t=$(e.currentTarget),i=$(IdentifierEnum.hiddenElements),n=$('<span class="form-check-spinner"><typo3-backend-icon identifier="spinner-circle" size="small"></typo3-backend-icon></span>');t.hide().after(n),t.prop("checked")?i.slideDown():i.slideUp(),PersistentStorage.set("moduleData.web_layout.showHidden",t.prop("checked")?"1":"0").done(()=>{n.remove(),t.show()})}editPageTitle(){const e=$('<form class="t3js-title-edit-form"><div class="form-group"><div class="input-group input-group-lg"><input class="form-control t3js-title-edit-input"><button class="btn btn-default" type="button" data-action="submit"><typo3-backend-icon identifier="actions-save" size="small"></typo3-backend-icon></button> <button class="btn btn-default" type="button" data-action="cancel"><typo3-backend-icon identifier="actions-close" size="small"></typo3-backend-icon></button> </div></div></form>'),t=e.find("input");e.find('[data-action="cancel"]').on("click",()=>{e.replaceWith(this.$pageTitle),this.initializePageTitleRenaming()}),e.find('[data-action="submit"]').on("click",()=>{const i=t.val().trim();""!==i&&this.$pageTitle.text()!==i?this.saveChanges(t):e.find('[data-action="cancel"]').trigger("click")}),t.parents("form").on("submit",e=>(e.preventDefault(),!1));const i=this.$pageTitle;i.children().last().remove(),i.replaceWith(e),t.val(i.text()).focus(),t.on("keydown",t=>{switch(t.which){case KeyTypesEnum.ENTER:e.find('[data-action="submit"]').trigger("click");break;case KeyTypesEnum.ESCAPE:e.find('[data-action="cancel"]').trigger("click")}})}saveChanges(e){const t=e.parents("form.t3js-title-edit-form");t.find("button").addClass("disabled"),e.attr("disabled","disabled");let i,n={};i=this.pageOverlayId>0?this.pageOverlayId:this.pageId,n.data={},n.data.pages={},n.data.pages[i]={title:e.val()},import("TYPO3/CMS/Backend/AjaxDataHandler.js").then(({default:i})=>{i.process(n).then(()=>{t.find("[data-action=cancel]").trigger("click"),this.$pageTitle.text(e.val()),this.initializePageTitleRenaming(),top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}).catch(()=>{t.find("[data-action=cancel]").trigger("click")})})}}export default new PageActions; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js b/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js deleted file mode 100644 index dadcb19de7f2b028569be090a586455371af8381..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import{SvgTree}from"TYPO3/CMS/Backend/SvgTree.js";export class PageTree extends SvgTree{constructor(){super(),this.networkErrorTitle=TYPO3.lang.pagetree_networkErrorTitle,this.networkErrorMessage=TYPO3.lang.pagetree_networkErrorDesc,this.settings.defaultProperties={hasChildren:!1,nameSourceField:"title",itemType:"pages",prefix:"",suffix:"",locked:!1,loaded:!1,overlayIcon:"",selectable:!0,expanded:!1,checked:!1,backgroundColor:"",stopPageTree:!1,class:"",readableRootline:"",isMountPoint:!1}}showChildren(e){this.loadChildrenOfNode(e),super.showChildren(e)}nodesUpdate(e){return(e=super.nodesUpdate(e)).append("text").text("+").attr("class","node-stop").attr("dx",30).attr("dy",5).attr("visibility",e=>e.stopPageTree&&0!==e.depth?"visible":"hidden").on("click",(e,t)=>{document.dispatchEvent(new CustomEvent("typo3:pagetree:mountPoint",{detail:{pageId:parseInt(t.identifier,10)}}))}),e}loadChildrenOfNode(e){e.loaded||(this.nodesAddPlaceholder(),new AjaxRequest(this.settings.dataUrl+"&pid="+e.identifier+"&mount="+e.mountPoint+"&pidDepth="+e.depth).get({cache:"no-cache"}).then(e=>e.resolve()).then(t=>{let r=Array.isArray(t)?t:[];r.shift();const o=this.nodes.indexOf(e)+1;r.forEach((e,t)=>{this.nodes.splice(o+t,0,e)}),e.loaded=!0,this.setParametersNode(),this.prepareDataForVisibleNodes(),this.updateVisibleNodes(),this.nodesRemovePlaceholder(),this.switchFocusNode(e)}).catch(e=>{throw this.errorNotification(e,!1),this.nodesRemovePlaceholder(),e}))}appendTextElement(e){return super.appendTextElement(e).attr("dx",e=>{let t=this.textPosition;return e.stopPageTree&&0!==e.depth&&(t+=15),e.locked&&(t+=15),t})}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Severity.js b/typo3/sysext/backend/Resources/Public/JavaScript/Severity.js deleted file mode 100644 index 019d67c3e1bab4ade121ad2be6c862827eb79d90..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Severity.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";class Severity{static getCssClass(e){let t;switch(e){case SeverityEnum.notice:t="notice";break;case SeverityEnum.ok:t="success";break;case SeverityEnum.warning:t="warning";break;case SeverityEnum.error:t="danger";break;case SeverityEnum.info:default:t="info"}return t}}let severityObject;Severity.notice=SeverityEnum.notice,Severity.info=SeverityEnum.info,Severity.ok=SeverityEnum.ok,Severity.warning=SeverityEnum.warning,Severity.error=SeverityEnum.error;try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.Severity&&(severityObject=window.opener.TYPO3.Severity),parent&&parent.window.TYPO3&&parent.window.TYPO3.Severity&&(severityObject=parent.window.TYPO3.Severity),top&&top.TYPO3&&top.TYPO3.Severity&&(severityObject=top.TYPO3.Severity)}catch{}severityObject||(severityObject=Severity,"undefined"!=typeof TYPO3&&(TYPO3.Severity=severityObject));export default severityObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/SiteInlineActions.js b/typo3/sysext/backend/Resources/Public/JavaScript/SiteInlineActions.js deleted file mode 100644 index 6a4691fe88493c3da3c447146f48c4c4a15c409c..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/SiteInlineActions.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class SiteInlineActions{constructor(){DocumentService.ready().then(()=>{TYPO3.settings.ajaxUrls.record_inline_details=TYPO3.settings.ajaxUrls.site_configuration_inline_details,TYPO3.settings.ajaxUrls.record_inline_create=TYPO3.settings.ajaxUrls.site_configuration_inline_create})}}export default new SiteInlineActions; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Storage/Client.js b/typo3/sysext/backend/Resources/Public/JavaScript/Storage/Client.js deleted file mode 100644 index 603bf1a3a44c8cd1963085aa4854a7a5e2110dec..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Storage/Client.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AbstractClientStorage from"TYPO3/CMS/Backend/Storage/AbstractClientStorage.js";class Client extends AbstractClientStorage{constructor(){super(),this.storage=localStorage}}export default new Client; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/SwitchUser.js b/typo3/sysext/backend/Resources/Public/JavaScript/SwitchUser.js deleted file mode 100644 index 569aea9cc5ac96d798a25d87b26e0238d30ee861..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/SwitchUser.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var Modes,__decorate=function(t,e,r,o){var i,s=arguments.length,c=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,o);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(c=(s<3?i(c):s>3?i(e,r,c):i(e,r))||c);return s>3&&c&&Object.defineProperty(e,r,c),c};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Notification from"TYPO3/CMS/Backend/Notification.js";!function(t){t.switch="switch",t.exit="exit"}(Modes||(Modes={}));let SwitchUser=class extends LitElement{constructor(){super(),this.mode=Modes.switch,this.addEventListener("click",t=>{t.preventDefault(),this.mode===Modes.switch?this.handleSwitchUser():this.mode===Modes.exit&&this.handleExitSwitchUser()})}render(){return html`<slot></slot>`}handleSwitchUser(){this.targetUser?new AjaxRequest(TYPO3.settings.ajaxUrls.switch_user).post({targetUser:this.targetUser}).then(async t=>{const e=await t.resolve();!0===e.success&&e.url?top.window.location.href=e.url:Notification.error("Switching to user went wrong.")}):Notification.error("Switching to user went wrong.")}handleExitSwitchUser(){new AjaxRequest(TYPO3.settings.ajaxUrls.switch_user_exit).post({}).then(async t=>{const e=await t.resolve();!0===e.success&&e.url?top.window.location.href=e.url:Notification.error("Exiting current user went wrong.")})}};__decorate([property({type:String})],SwitchUser.prototype,"targetUser",void 0),__decorate([property({type:Modes})],SwitchUser.prototype,"mode",void 0),SwitchUser=__decorate([customElement("typo3-backend-switch-user")],SwitchUser); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Tabs.js b/typo3/sysext/backend/Resources/Public/JavaScript/Tabs.js deleted file mode 100644 index 888ff64504a44dfe2795adbfe8b11c52580e39b8..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Tabs.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{Tab}from"bootstrap";import BrowserSession from"TYPO3/CMS/Backend/Storage/BrowserSession.js";import Client from"TYPO3/CMS/Backend/Storage/Client.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class Tabs{static receiveActiveTab(e){return BrowserSession.get(e)||""}static storeActiveTab(e,t){BrowserSession.set(e,t)}constructor(){DocumentService.ready().then(()=>{document.querySelectorAll(".t3js-tabs").forEach(e=>{const t=Tabs.receiveActiveTab(e.id);t&&new Tab(document.querySelector('a[href="'+t+'"]')).show();"1"===e.dataset.storeLastTab&&e.addEventListener("show.bs.tab",e=>{const t=e.currentTarget.id,r=e.target.hash;Tabs.storeActiveTab(t,r)})})}),Client.unsetByPrefix("tabs-")}}export default new Tabs; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar.js deleted file mode 100644 index 223728f3a9d5b08ad9a4d1bfc3d58abac327cf80..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class Toolbar{static initialize(){Toolbar.initializeEvents()}static initializeEvents(){new RegularEvent("click",()=>{const e=document.querySelector(".scaffold");e.classList.remove("scaffold-modulemenu-expanded","scaffold-search-expanded"),e.classList.toggle("scaffold-toolbar-expanded")}).bindTo(document.querySelector(".t3js-topbar-button-toolbar")),new RegularEvent("click",()=>{const e=document.querySelector(".scaffold");e.classList.remove("scaffold-modulemenu-expanded","scaffold-toolbar-expanded"),e.classList.toggle("scaffold-search-expanded")}).bindTo(document.querySelector(".t3js-topbar-button-search"))}}DocumentService.ready().then(Toolbar.initialize); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js deleted file mode 100644 index a285d4b4800965dd59a2ef4a344b622c2db6089c..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import Viewport from"TYPO3/CMS/Backend/Viewport.js";var Identifiers;!function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-clearcachetoolbaritem",e.menuItemSelector="a.toolbar-cache-flush-action",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon"}(Identifiers||(Identifiers={}));class ClearCacheMenu{constructor(){this.initializeEvents=()=>{$(Identifiers.containerSelector).on("click",Identifiers.menuItemSelector,e=>{e.preventDefault();const t=$(e.currentTarget).attr("href");t&&this.clearCache(t)})},Viewport.Topbar.Toolbar.registerEvent(this.initializeEvents)}clearCache(e){$(Identifiers.containerSelector).removeClass("open");const t=$(Identifiers.toolbarIconSelector,Identifiers.containerSelector),o=t.clone();Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(e=>{t.replaceWith(e)}),new AjaxRequest(e).post({}).then(async e=>{const t=await e.resolve();!0===t.success?Notification.success(t.title,t.message):!1===t.success&&Notification.error(t.title,t.message)},()=>{Notification.error(TYPO3.lang["flushCaches.error"],TYPO3.lang["flushCaches.error.description"])}).finally(()=>{$(Identifiers.toolbarIconSelector,Identifiers.containerSelector).replaceWith(o)})}}export default new ClearCacheMenu; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js deleted file mode 100644 index 31306cc47dde2b51d22dff0172a0f11ab8b49c9c..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import Viewport from"TYPO3/CMS/Backend/Viewport.js";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";import{ModuleStateStorage}from"TYPO3/CMS/Backend/Storage/ModuleStateStorage.js";var Identifiers;!function(t){t.containerSelector="#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem",t.toolbarIconSelector=".dropdown-toggle span.icon",t.toolbarMenuSelector=".dropdown-menu",t.shortcutItemSelector=".t3js-topbar-shortcut",t.shortcutJumpSelector=".t3js-shortcut-jump",t.shortcutDeleteSelector=".t3js-shortcut-delete",t.shortcutEditSelector=".t3js-shortcut-edit",t.shortcutFormTitleSelector='input[name="shortcut-title"]',t.shortcutFormGroupSelector='select[name="shortcut-group"]',t.shortcutFormSaveSelector=".shortcut-form-save",t.shortcutFormCancelSelector=".shortcut-form-cancel",t.shortcutFormSelector=".shortcut-form"}(Identifiers||(Identifiers={}));class ShortcutMenu{constructor(){this.initializeEvents=()=>{$(Identifiers.containerSelector).on("click",Identifiers.shortcutDeleteSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.deleteShortcut($(t.currentTarget).closest(Identifiers.shortcutItemSelector))}).on("click",Identifiers.shortcutFormGroupSelector,t=>{t.preventDefault(),t.stopImmediatePropagation()}).on("click",Identifiers.shortcutEditSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.editShortcut($(t.currentTarget).closest(Identifiers.shortcutItemSelector))}).on("click",Identifiers.shortcutFormSaveSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.saveShortcutForm($(t.currentTarget).closest(Identifiers.shortcutFormSelector))}).on("submit",Identifiers.shortcutFormSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.saveShortcutForm($(t.currentTarget).closest(Identifiers.shortcutFormSelector))}).on("click",Identifiers.shortcutFormCancelSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.refreshMenu()}).on("click",Identifiers.shortcutJumpSelector,t=>{t.preventDefault(),t.stopImmediatePropagation();const e=$(t.currentTarget).data("pageid");e&&ModuleStateStorage.updateWithCurrentMount("web",e,!0);const r=document.querySelector("typo3-backend-module-router");r.setAttribute("endpoint",$(t.currentTarget).attr("href")),r.setAttribute("module",$(t.currentTarget).data("module"))})},Viewport.Topbar.Toolbar.registerEvent(this.initializeEvents)}createShortcut(t,e,r,o,s){void 0!==o&&Modal.confirm(TYPO3.lang["bookmark.create"],o).on("confirm.button.ok",o=>{const c=$(Identifiers.toolbarIconSelector,Identifiers.containerSelector),i=c.clone();Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(t=>{c.replaceWith(t)}),new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_create).post({routeIdentifier:t,arguments:e,displayName:r}).then(()=>{if(this.refreshMenu(),$(Identifiers.toolbarIconSelector,Identifiers.containerSelector).replaceWith(i),"object"==typeof s){const t=$(s).hasClass("dropdown-item"),e=new SecurityUtility;Icons.getIcon("actions-system-shortcut-active",Icons.sizes.small).then(r=>{$(s).html(r+(t?" "+e.encodeHtml(TYPO3.lang["labels.alreadyBookmarked"]):""))}),$(s).addClass(t?"disabled":"active"),$(s).attr("data-dispatch-disabled","disabled"),$(s).attr("title",TYPO3.lang["labels.alreadyBookmarked"])}}),$(o.currentTarget).trigger("modal-dismiss")}).on("confirm.button.cancel",t=>{$(t.currentTarget).trigger("modal-dismiss")})}deleteShortcut(t){Modal.confirm(TYPO3.lang["bookmark.delete"],TYPO3.lang["bookmark.confirmDelete"]).on("confirm.button.ok",e=>{new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_remove).post({shortcutId:t.data("shortcutid")}).then(()=>{this.refreshMenu()}),$(e.currentTarget).trigger("modal-dismiss")}).on("confirm.button.cancel",t=>{$(t.currentTarget).trigger("modal-dismiss")})}editShortcut(t){new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_editform).withQueryArguments({shortcutId:t.data("shortcutid"),shortcutGroup:t.data("shortcutgroup")}).get({cache:"no-cache"}).then(async t=>{$(Identifiers.containerSelector).find(Identifiers.toolbarMenuSelector).html(await t.resolve())})}saveShortcutForm(t){new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_saveform).post({shortcutId:t.data("shortcutid"),shortcutTitle:t.find(Identifiers.shortcutFormTitleSelector).val(),shortcutGroup:t.find(Identifiers.shortcutFormGroupSelector).val()}).then(()=>{Notification.success(TYPO3.lang["bookmark.savedTitle"],TYPO3.lang["bookmark.savedMessage"]),this.refreshMenu()})}refreshMenu(){new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_list).get({cache:"no-cache"}).then(async t=>{$(Identifiers.toolbarMenuSelector,Identifiers.containerSelector).html(await t.resolve())})}}top.TYPO3.ShortcutMenu&&"object"==typeof top.TYPO3.ShortcutMenu||(top.TYPO3.ShortcutMenu=new ShortcutMenu);const shortcutMenuObject=top.TYPO3.ShortcutMenu;export default shortcutMenuObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/SystemInformationMenu.js b/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/SystemInformationMenu.js deleted file mode 100644 index 8ca7b934fa25e1282d661db2efd331a477896d21..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/SystemInformationMenu.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import PersistentStorage from"TYPO3/CMS/Backend/Storage/Persistent.js";import Viewport from"TYPO3/CMS/Backend/Viewport.js";var Identifiers;!function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-systeminformationtoolbaritem",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon",e.menuContainerSelector=".dropdown-menu",e.moduleLinks=".t3js-systeminformation-module",e.counter=".t3js-systeminformation-counter"}(Identifiers||(Identifiers={}));class SystemInformationMenu{constructor(){this.timer=null,this.updateMenu=()=>{const e=$(Identifiers.toolbarIconSelector,Identifiers.containerSelector),t=e.clone(),o=$(Identifiers.containerSelector).find(Identifiers.menuContainerSelector);null!==this.timer&&(clearTimeout(this.timer),this.timer=null),Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(t=>{e.replaceWith(t)}),new AjaxRequest(TYPO3.settings.ajaxUrls.systeminformation_render).get().then(async e=>{o.html(await e.resolve()),SystemInformationMenu.updateCounter(),$(Identifiers.moduleLinks).on("click",this.openModule)}).finally(()=>{$(Identifiers.toolbarIconSelector,Identifiers.containerSelector).replaceWith(t),this.timer=setTimeout(this.updateMenu,3e5)})},Viewport.Topbar.Toolbar.registerEvent(this.updateMenu)}static updateCounter(){const e=$(Identifiers.containerSelector).find(Identifiers.menuContainerSelector).find(".t3js-systeminformation-container"),t=$(Identifiers.counter),o=e.data("count"),n=e.data("severityclass");t.text(o).toggle(parseInt(o,10)>0),t.removeClass(),t.addClass("t3js-systeminformation-counter toolbar-item-badge badge rounded-pill"),""!==n&&t.addClass(n)}openModule(e){e.preventDefault(),e.stopPropagation();let t={};const o={},n=$(e.currentTarget).data("modulename"),r=$(e.currentTarget).data("moduleparams"),i=Math.floor((new Date).getTime()/1e3);PersistentStorage.isset("systeminformation")&&(t=JSON.parse(PersistentStorage.get("systeminformation"))),o[n]={lastAccess:i},$.extend(!0,t,o);PersistentStorage.set("systeminformation",JSON.stringify(t)).done(()=>{TYPO3.ModuleMenu.App.showModule(n,r),Viewport.Topbar.refresh()})}}export default new SystemInformationMenu; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Tooltip.js b/typo3/sysext/backend/Resources/Public/JavaScript/Tooltip.js deleted file mode 100644 index 459be3460c70f62a69e7528b0e8439f7de56f33c..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Tooltip.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{Tooltip as BootstrapTooltip}from"bootstrap";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class Tooltip{static applyAttributes(t,o){for(const[e,i]of Object.entries(t))o.setAttribute(e,i)}constructor(){DocumentService.ready().then(()=>{this.initialize('[data-bs-toggle="tooltip"]')})}initialize(t,o={}){0===Object.entries(o).length&&(o={container:"body",trigger:"hover",delay:{show:500,hide:100}});const e=document.querySelectorAll(t);for(const t of e)BootstrapTooltip.getOrCreateInstance(t,o)}show(t,o){const e={"data-bs-placement":"auto",title:o};if(t instanceof NodeList)for(const o of t)Tooltip.applyAttributes(e,o),BootstrapTooltip.getInstance(o).show();else if(t instanceof HTMLElement)return Tooltip.applyAttributes(e,t),void BootstrapTooltip.getInstance(t).show()}hide(t){if(t instanceof NodeList)for(const o of t){const t=BootstrapTooltip.getInstance(o);null!==t&&t.hide()}else t instanceof HTMLElement&&BootstrapTooltip.getInstance(t).hide()}}const tooltipObject=new Tooltip;TYPO3.Tooltip=tooltipObject;export default tooltipObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/FileStorageBrowser.js b/typo3/sysext/backend/Resources/Public/JavaScript/Tree/FileStorageBrowser.js deleted file mode 100644 index d6c2ce82f17f5f66917e7a009ff3270c78a50b5f..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/FileStorageBrowser.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var __decorate=function(e,t,r,o){var i,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,r,s):i(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};import{html,LitElement}from"lit";import{customElement,query}from"lit/decorators.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import ElementBrowser from"TYPO3/CMS/Recordlist/ElementBrowser.js";import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import"TYPO3/CMS/Backend/Element/IconElement.js";import Persistent from"TYPO3/CMS/Backend/Storage/Persistent.js";import{FileStorageTree}from"TYPO3/CMS/Backend/Tree/FileStorageTree.js";const componentName="typo3-backend-component-filestorage-browser";let FileStorageBrowserTree=class extends FileStorageTree{updateNodeActions(e){const t=super.updateNodeActions(e);if(this.settings.actions.includes("link")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.linkItem(t)});this.createIconAreaForAction(e,"actions-link")}else if(this.settings.actions.includes("select")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.selectItem(t)});this.createIconAreaForAction(e,"actions-link")}return t}linkItem(e){LinkBrowser.finalizeFunction("t3://folder?storage="+e.storage+"&identifier="+e.pathIdentifier)}selectItem(e){ElementBrowser.insertElement(e.itemType,e.identifier,e.name,e.identifier,!0)}};FileStorageBrowserTree=__decorate([customElement("typo3-backend-component-filestorage-browser-tree")],FileStorageBrowserTree);let FileStorageBrowser=class extends LitElement{constructor(){super(...arguments),this.activeFolder="",this.actions=[],this.triggerRender=()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))},this.selectActiveNode=e=>{let t=e.detail.nodes;e.detail.nodes=t.map(e=>(decodeURIComponent(e.identifier)===this.activeFolder&&(e.checked=!0),e))},this.toggleExpandState=e=>{const t=e.detail.node;t&&Persistent.set("BackendComponents.States.FileStorageTree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadFolderDetails=e=>{const t=e.detail.node;if(!t.checked)return;let r=document.location.href+"&contentOnly=1&expandFolder="+t.identifier;new AjaxRequest(r).get().then(e=>e.resolve()).then(e=>{document.querySelector(".element-browser-main-content .element-browser-body").innerHTML=e})}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:navigation:resized",this.triggerRender)}disconnectedCallback(){document.removeEventListener("typo3:navigation:resized",this.triggerRender),super.disconnectedCallback()}firstUpdated(){this.activeFolder=this.getAttribute("active-folder")||""}createRenderRoot(){return this}render(){this.hasAttribute("tree-actions")&&this.getAttribute("tree-actions").length&&(this.actions=JSON.parse(this.getAttribute("tree-actions")));const e={dataUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_data,filterUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_filter,showIcons:!0,actions:this.actions};return html` - <div class="svg-tree"> - <div> - <typo3-backend-tree-toolbar .tree="${this.tree}" class="svg-toolbar"></typo3-backend-tree-toolbar> - <div class="navigation-tree-container"> - <typo3-backend-component-filestorage-browser-tree class="svg-tree-wrapper" .setup=${e} @svg-tree:initialized=${()=>{this.tree.dispatchEvent(new Event("svg-tree:visible")),this.tree.addEventListener("typo3:svg-tree:expand-toggle",this.toggleExpandState),this.tree.addEventListener("typo3:svg-tree:node-selected",this.loadFolderDetails),this.tree.addEventListener("typo3:svg-tree:nodes-prepared",this.selectActiveNode);this.querySelector("typo3-backend-tree-toolbar").tree=this.tree}}></typo3-backend-component-page-browser-tree> - </div> - </div> - <div class="svg-tree-loader"> - <typo3-backend-icon identifier="spinner-circle-light" size="large"></typo3-backend-icon> - </div> - </div> - `}};__decorate([query(".svg-tree-wrapper")],FileStorageBrowser.prototype,"tree",void 0),FileStorageBrowser=__decorate([customElement(componentName)],FileStorageBrowser);export{FileStorageBrowser}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/FileStorageTree.js b/typo3/sysext/backend/Resources/Public/JavaScript/Tree/FileStorageTree.js deleted file mode 100644 index 217dc77789de5d13ef65c5ac16c9a342d168f4bd..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/FileStorageTree.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import{SvgTree}from"TYPO3/CMS/Backend/SvgTree.js";export class FileStorageTree extends SvgTree{constructor(){super(),this.settings.defaultProperties={hasChildren:!1,nameSourceField:"title",itemType:"sys_file",prefix:"",suffix:"",locked:!1,loaded:!1,overlayIcon:"",selectable:!0,expanded:!1,checked:!1,backgroundColor:"",class:"",readableRootline:""}}showChildren(e){this.loadChildrenOfNode(e),super.showChildren(e)}getNodeTitle(e){return decodeURIComponent(e.name)}loadChildrenOfNode(e){if(e.loaded)return this.prepareDataForVisibleNodes(),void this.updateVisibleNodes();this.nodesAddPlaceholder(),new AjaxRequest(this.settings.dataUrl+"&parent="+e.identifier+"¤tDepth="+e.depth).get({cache:"no-cache"}).then(e=>e.resolve()).then(t=>{let o=Array.isArray(t)?t:[];const s=this.nodes.indexOf(e)+1;o.forEach((e,t)=>{this.nodes.splice(s+t,0,e)}),e.loaded=!0,this.setParametersNode(),this.prepareDataForVisibleNodes(),this.updateVisibleNodes(),this.nodesRemovePlaceholder(),this.switchFocusNode(e)}).catch(e=>{throw this.errorNotification(e,!1),this.nodesRemovePlaceholder(),e})}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/PageBrowser.js b/typo3/sysext/backend/Resources/Public/JavaScript/Tree/PageBrowser.js deleted file mode 100644 index 3d9d2c5ea1a5063d495777ecf1e1653aca994f2c..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/PageBrowser.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var __decorate=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};import{html,LitElement}from"lit";import{customElement,property,query}from"lit/decorators.js";import{until}from"lit/directives/until.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";import{PageTree}from"TYPO3/CMS/Backend/PageTree/PageTree.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import ElementBrowser from"TYPO3/CMS/Recordlist/ElementBrowser.js";import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import"TYPO3/CMS/Backend/Element/IconElement.js";import Persistent from"TYPO3/CMS/Backend/Storage/Persistent.js";const componentName="typo3-backend-component-page-browser";let PageBrowserTree=class extends PageTree{appendTextElement(e){return super.appendTextElement(e).attr("opacity",e=>this.settings.actions.includes("link")?this.isLinkable(e)?1:.5:1)}updateNodeActions(e){const t=super.updateNodeActions(e);if(this.settings.actions.includes("link")){this.fetchIcon("actions-link");const e=this.nodesActionsContainer.selectAll(".node-action").append("g").attr("visibility",e=>this.isLinkable(e)?"visible":"hidden").on("click",(e,t)=>{this.linkItem(t)});this.createIconAreaForAction(e,"actions-link")}else if(this.settings.actions.includes("select")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.selectItem(t)});this.createIconAreaForAction(e,"actions-link")}return t}linkItem(e){LinkBrowser.finalizeFunction("t3://page?uid="+e.identifier)}isLinkable(e){return!1===["199","254","255"].includes(String(e.type))}selectItem(e){ElementBrowser.insertElement(e.itemType,e.identifier,e.name,e.identifier,!0)}};PageBrowserTree=__decorate([customElement("typo3-backend-component-page-browser-tree")],PageBrowserTree);let PageBrowser=class extends LitElement{constructor(){super(...arguments),this.mountPointPath=null,this.activePageId=0,this.actions=[],this.configuration=null,this.triggerRender=()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))},this.selectActivePageInTree=e=>{let t=e.detail.nodes;e.detail.nodes=t.map(e=>(parseInt(e.identifier,10)===this.activePageId&&(e.checked=!0),e))},this.toggleExpandState=e=>{const t=e.detail.node;t&&Persistent.set("BackendComponents.States.Pagetree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadRecordsOfPage=e=>{const t=e.detail.node;if(!t.checked)return;let n=document.location.href+"&contentOnly=1&expandPage="+t.identifier;new AjaxRequest(n).get().then(e=>e.resolve()).then(e=>{document.querySelector(".element-browser-main-content .element-browser-body").innerHTML=e})},this.setMountPoint=e=>{this.setTemporaryMountPoint(e.detail.pageId)}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:navigation:resized",this.triggerRender),document.addEventListener("typo3:pagetree:mountPoint",this.setMountPoint)}disconnectedCallback(){document.removeEventListener("typo3:navigation:resized",this.triggerRender),document.removeEventListener("typo3:pagetree:mountPoint",this.setMountPoint),super.disconnectedCallback()}firstUpdated(){this.activePageId=parseInt(this.getAttribute("active-page"),10),this.actions=JSON.parse(this.getAttribute("tree-actions"))}createRenderRoot(){return this}getConfiguration(){if(null!==this.configuration)return Promise.resolve(this.configuration);const e=top.TYPO3.settings.ajaxUrls.page_tree_browser_configuration,t=this.hasAttribute("alternative-entry-points")?JSON.parse(this.getAttribute("alternative-entry-points")):[];let n=new AjaxRequest(e);return t.length&&(n=n.withQueryArguments("alternativeEntryPoints="+encodeURIComponent(t))),n.get().then(async e=>{const t=await e.resolve("json");return t.actions=this.actions,this.configuration=t,this.mountPointPath=t.temporaryMountPoint||null,t})}render(){return html` - <div class="svg-tree"> - ${until(this.renderTree(),this.renderLoader())} - </div> - `}renderTree(){return this.getConfiguration().then(e=>html` - <div> - <typo3-backend-tree-toolbar .tree="${this.tree}" class="svg-toolbar"></typo3-backend-tree-toolbar> - <div class="navigation-tree-container"> - ${this.renderMountPoint()} - <typo3-backend-component-page-browser-tree id="typo3-pagetree-tree" class="svg-tree-wrapper" .setup=${e} @svg-tree:initialized=${()=>{this.tree.dispatchEvent(new Event("svg-tree:visible")),this.tree.addEventListener("typo3:svg-tree:expand-toggle",this.toggleExpandState),this.tree.addEventListener("typo3:svg-tree:node-selected",this.loadRecordsOfPage),this.tree.addEventListener("typo3:svg-tree:nodes-prepared",this.selectActivePageInTree);this.querySelector("typo3-backend-tree-toolbar").tree=this.tree}}></typo3-backend-component-page-browser-tree> - </div> - </div> - ${this.renderLoader()} - `)}renderLoader(){return html` - <div class="svg-tree-loader"> - <typo3-backend-icon identifier="spinner-circle-light" size="large"></typo3-backend-icon> - </div> - `}unsetTemporaryMountPoint(){this.mountPointPath=null,Persistent.unset("pageTree_temporaryMountPoint").then(()=>{this.tree.refreshTree()})}renderMountPoint(){return null===this.mountPointPath?html``:html` - <div class="node-mount-point"> - <div class="node-mount-point__icon"><typo3-backend-icon identifier="actions-document-info" size="small"></typo3-backend-icon></div> - <div class="node-mount-point__text">${this.mountPointPath}</div> - <div class="node-mount-point__icon mountpoint-close" @click="${()=>this.unsetTemporaryMountPoint()}" title="${lll("labels.temporaryDBmount")}"> - <typo3-backend-icon identifier="actions-close" size="small"></typo3-backend-icon> - </div> - </div> - `}setTemporaryMountPoint(e){new AjaxRequest(this.configuration.setTemporaryMountPointUrl).post("pid="+e,{headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"}}).then(e=>e.resolve()).then(e=>{e&&e.hasErrors?(this.tree.errorNotification(e.message,!0),this.tree.updateVisibleNodes()):(this.mountPointPath=e.mountPointPath,this.tree.refreshOrFilterTree())}).catch(e=>{this.tree.errorNotification(e,!0)})}};__decorate([property({type:String})],PageBrowser.prototype,"mountPointPath",void 0),__decorate([query(".svg-tree-wrapper")],PageBrowser.prototype,"tree",void 0),PageBrowser=__decorate([customElement(componentName)],PageBrowser);export{PageBrowser}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/UserPassLogin.js b/typo3/sysext/backend/Resources/Public/JavaScript/UserPassLogin.js deleted file mode 100644 index 8244745780c524db74585f50a3567bd929d5befa..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/UserPassLogin.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Login from"TYPO3/CMS/Backend/Login.js";class UserPassLogin{constructor(){this.resetPassword=()=>{const s=$(this.options.passwordField);s.val()&&($(Login.options.useridentField).val(s.val()),s.val(""))},this.showCapsLockWarning=s=>{$(s.target).parent().parent().find(".t3js-login-alert-capslock").toggleClass("hidden",!UserPassLogin.isCapslockEnabled(s))},this.toggleCopyright=s=>{" "===s.key&&s.target.click()},this.options={passwordField:".t3js-login-password-field",usernameField:".t3js-login-username-field",copyrightLink:"t3js-login-copyright-link"},Login.options.submitHandler=this.resetPassword;const s=$(this.options.usernameField),e=$(this.options.passwordField),o=document.getElementsByClassName(this.options.copyrightLink)[0];s.on("keypress",this.showCapsLockWarning),e.on("keypress",this.showCapsLockWarning),o.addEventListener("keydown",this.toggleCopyright);try{parent.opener&&parent.opener.TYPO3&&parent.opener.TYPO3.configuration&&parent.opener.TYPO3.configuration.username&&s.val(parent.opener.TYPO3.configuration.username)}catch(s){}""===s.val()?s.focus():e.focus()}static isCapslockEnabled(s){const e=s||window.event;if(!e)return!1;let o=-1;e.which?o=e.which:e.keyCode&&(o=e.keyCode);let i=!1;return e.shiftKey?i=e.shiftKey:e.modifiers&&(i=!!(4&e.modifiers)),o>=65&&o<=90&&!i||o>=97&&o<=122&&i}}export default new UserPassLogin; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport.js b/typo3/sysext/backend/Resources/Public/JavaScript/Viewport.js deleted file mode 100644 index 37f1ee4a8be0fe98efd9238f2c4f4c4a30768d4d..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import ContentContainer from"TYPO3/CMS/Backend/Viewport/ContentContainer.js";import ConsumerScope from"TYPO3/CMS/Backend/Event/ConsumerScope.js";import Loader from"TYPO3/CMS/Backend/Viewport/Loader.js";import NavigationContainer from"TYPO3/CMS/Backend/Viewport/NavigationContainer.js";import Topbar from"TYPO3/CMS/Backend/Viewport/Topbar.js";class Viewport{constructor(){this.Loader=Loader,this.NavigationContainer=null,this.ContentContainer=null,this.consumerScope=ConsumerScope,this.Topbar=new Topbar,this.NavigationContainer=new NavigationContainer(this.consumerScope),this.ContentContainer=new ContentContainer(this.consumerScope)}}let viewportObject;top.TYPO3.Backend?viewportObject=top.TYPO3.Backend:(viewportObject=new Viewport,top.TYPO3.Backend=viewportObject);export default viewportObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/ContentContainer.js b/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/ContentContainer.js deleted file mode 100644 index 90fc4ef01112698a7bbaa8784ccb2b6378f556dd..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/ContentContainer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{ScaffoldIdentifierEnum}from"TYPO3/CMS/Backend/Enum/Viewport/ScaffoldIdentifier.js";import{AbstractContainer}from"TYPO3/CMS/Backend/Viewport/AbstractContainer.js";import $ from"jquery";import ClientRequest from"TYPO3/CMS/Backend/Event/ClientRequest.js";import InteractionRequest from"TYPO3/CMS/Backend/Event/InteractionRequest.js";import Loader from"TYPO3/CMS/Backend/Viewport/Loader.js";import Utility from"TYPO3/CMS/Backend/Utility.js";import TriggerRequest from"TYPO3/CMS/Backend/Event/TriggerRequest.js";class ContentContainer extends AbstractContainer{get(){return $(ScaffoldIdentifierEnum.contentModuleIframe)[0].contentWindow}beforeSetUrl(e){return this.consumerScope.invoke(new TriggerRequest("typo3.beforeSetUrl",e))}setUrl(e,t,r){let n;const o=this.resolveRouterElement();return null===o?(n=$.Deferred(),n.reject(),n):(t instanceof InteractionRequest||(t=new ClientRequest("typo3.setUrl",null)),n=this.consumerScope.invoke(new TriggerRequest("typo3.setUrl",t)),n.then(()=>{Loader.start(),o.setAttribute("endpoint",e),o.setAttribute("module",r||null),o.parentElement.addEventListener("typo3-module-loaded",()=>Loader.finish(),{once:!0})}),n)}getUrl(){return this.resolveRouterElement().getAttribute("endpoint")}refresh(e){let t;const r=this.resolveIFrameElement();return null===r?(t=$.Deferred(),t.reject(),t):(t=this.consumerScope.invoke(new TriggerRequest("typo3.refresh",e)),t.then(()=>{r.contentWindow.location.reload()}),t)}getIdFromUrl(){return this.getUrl?parseInt(Utility.getParameterFromUrl(this.getUrl(),"id"),10):0}resolveIFrameElement(){const e=$(ScaffoldIdentifierEnum.contentModuleIframe+":first");return 0===e.length?null:e.get(0)}resolveRouterElement(){return document.querySelector(ScaffoldIdentifierEnum.contentModuleRouter)}}export default ContentContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/Loader.js b/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/Loader.js deleted file mode 100644 index 7fcff652104f689ea59b217075f225f351d7220b..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/Loader.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{ScaffoldIdentifierEnum}from"TYPO3/CMS/Backend/Enum/Viewport/ScaffoldIdentifier.js";import NProgress from"nprogress";class Loader{static start(){NProgress.configure({parent:ScaffoldIdentifierEnum.contentModule,showSpinner:!1}),NProgress.start()}static finish(){NProgress.done()}}export default Loader; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/NavigationContainer.js b/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/NavigationContainer.js deleted file mode 100644 index 49586a57dad7bcf7397b5f3cd0749dcb503e44f4..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/NavigationContainer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{ScaffoldIdentifierEnum}from"TYPO3/CMS/Backend/Enum/Viewport/ScaffoldIdentifier.js";import{AbstractContainer}from"TYPO3/CMS/Backend/Viewport/AbstractContainer.js";import TriggerRequest from"TYPO3/CMS/Backend/Event/TriggerRequest.js";class NavigationContainer extends AbstractContainer{constructor(t){super(t),this.activeComponentId=""}get parent(){return document.querySelector(ScaffoldIdentifierEnum.scaffold)}get container(){return document.querySelector(ScaffoldIdentifierEnum.contentNavigation)}get switcher(){return document.querySelector(ScaffoldIdentifierEnum.contentNavigationSwitcher)}showComponent(t){const e=this.container;if(this.show(t),t===this.activeComponentId)return;if(""!==this.activeComponentId){let t=e.querySelector("#navigationComponent-"+this.activeComponentId.replace(/[/]/g,"_"));t&&(t.style.display="none")}const n="navigationComponent-"+t.replace(/[/]/g,"_");if(1===e.querySelectorAll('[data-component="'+t+'"]').length)return this.show(t),void(this.activeComponentId=t);import(t+".js").then(o=>{if("string"==typeof o.navigationComponentName){const i=o.navigationComponentName,a=document.createElement(i);a.setAttribute("id",n),a.classList.add("scaffold-content-navigation-component"),a.dataset.component=t,e.append(a)}else{e.insertAdjacentHTML("beforeend",'<div class="scaffold-content-navigation-component" data-component="'+t+'" id="'+n+'"></div>');Object.values(o)[0].initialize("#"+n)}this.show(t),this.activeComponentId=t})}hide(t){const e=this.parent,n=this.switcher;e.classList.remove("scaffold-content-navigation-expanded"),e.classList.remove("scaffold-content-navigation-available"),t&&n&&(n.style.display="none")}show(t){const e=this.parent,n=this.container,o=this.switcher;if(n.querySelectorAll(ScaffoldIdentifierEnum.contentNavigationDataComponent).forEach(t=>t.style.display="none"),void 0!==typeof t){e.classList.add("scaffold-content-navigation-expanded"),e.classList.add("scaffold-content-navigation-available");const o=n.querySelector('[data-component="'+t+'"]');o&&(o.style.display=null)}o&&(o.style.display=null)}setUrl(t,e){const n=this.consumerScope.invoke(new TriggerRequest("typo3.setUrl",e));return n.then(()=>{this.parent.classList.add("scaffold-content-navigation-expanded")}),n}}export default NavigationContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/Toolbar.js b/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/Toolbar.js deleted file mode 100644 index ec59f1472bc7bba0ae8e1afd461ba1a52d80a8eb..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/Toolbar.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{ScaffoldIdentifierEnum}from"TYPO3/CMS/Backend/Enum/Viewport/ScaffoldIdentifier.js";import $ from"jquery";class Toolbar{registerEvent(e){$(e),$(ScaffoldIdentifierEnum.header).on("t3-topbar-update",e)}}export default Toolbar; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/Topbar.js b/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/Topbar.js deleted file mode 100644 index 92e14e174a00e58acd73ed161d62216e260cf541..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/Topbar.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{ScaffoldIdentifierEnum}from"TYPO3/CMS/Backend/Enum/Viewport/ScaffoldIdentifier.js";import Toolbar from"TYPO3/CMS/Backend/Viewport/Toolbar.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";class Topbar{constructor(){this.Toolbar=new Toolbar}refresh(){new AjaxRequest(TYPO3.settings.ajaxUrls.topbar).get().then(async e=>{const o=await e.resolve(),r=document.querySelector(Topbar.topbarSelector);null!==r&&(r.innerHTML=o.topbar,r.dispatchEvent(new Event("t3-topbar-update")))})}}Topbar.topbarSelector=ScaffoldIdentifierEnum.header;export default Topbar; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Wizard.js b/typo3/sysext/backend/Resources/Public/JavaScript/Wizard.js deleted file mode 100644 index e3a95b357706c634b11526846aa64479eb0a5c71..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Wizard.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import $ from"jquery";import Modal from"TYPO3/CMS/Backend/Modal.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import Icons from"TYPO3/CMS/Backend/Icons.js";class Wizard{constructor(){this.setup={slides:[],settings:{},forceSelection:!0,$carousel:null},this.originalSetup=$.extend(!0,{},this.setup)}set(e,t){return this.setup.settings[e]=t,this}addSlide(e,t,s="",i=SeverityEnum.info,r){const a={identifier:e,title:t,content:s,severity:i,callback:r};return this.setup.slides.push(a),this}addFinalProcessingSlide(e){return e||(e=()=>{this.dismiss()}),Icons.getIcon("spinner-circle-dark",Icons.sizes.large,null,null).then(t=>{let s=$("<div />",{class:"text-center"}).append(t);this.addSlide("final-processing-slide",top.TYPO3.lang["wizard.processing.title"],s[0].outerHTML,Severity.info,e)})}show(){let e=this.generateSlides(),t=this.setup.slides[0];Modal.confirm(t.title,e,t.severity,[{text:top.TYPO3.lang["wizard.button.cancel"],active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{this.getComponent().trigger("wizard-dismiss")}},{text:top.TYPO3.lang["wizard.button.next"],btnClass:"btn-"+Severity.getCssClass(t.severity),name:"next"}]),this.setup.forceSelection&&this.lockNextStep(),this.addProgressBar(),this.initializeEvents(),this.getComponent().on("wizard-visible",()=>{this.runSlideCallback(t,this.setup.$carousel.find(".carousel-item").first())}).on("wizard-dismissed",()=>{this.setup=$.extend(!0,{},this.originalSetup)})}getComponent(){return null===this.setup.$carousel&&this.generateSlides(),this.setup.$carousel}dismiss(){Modal.dismiss()}lockNextStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="next"]');return e.prop("disabled",!0),e}unlockNextStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="next"]');return e.prop("disabled",!1),e}setForceSelection(e){this.setup.forceSelection=e}initializeEvents(){let e=this.setup.$carousel.closest(".modal"),t=e.find(".modal-title"),s=e.find(".modal-footer"),i=s.find('button[name="next"]');i.on("click",()=>{this.setup.$carousel.carousel("next")}),this.setup.$carousel.on("slide.bs.carousel",()=>{let r=this.setup.$carousel.data("currentSlide")+1,a=this.setup.$carousel.data("currentIndex")+1;t.text(this.setup.slides[a].title),this.setup.$carousel.data("currentSlide",r),this.setup.$carousel.data("currentIndex",a),r>=this.setup.$carousel.data("realSlideCount")?(e.find(".modal-header .close").remove(),s.slideUp()):s.find(".progress-bar").width(this.setup.$carousel.data("initialStep")*r+"%").text(top.TYPO3.lang["wizard.progress"].replace("{0}",r).replace("{1}",this.setup.$carousel.data("slideCount"))),i.removeClass("btn-"+Severity.getCssClass(this.setup.slides[a-1].severity)).addClass("btn-"+Severity.getCssClass(this.setup.slides[a].severity)),e.removeClass("modal-severity-"+Severity.getCssClass(this.setup.slides[a-1].severity)).addClass("modal-severity-"+Severity.getCssClass(this.setup.slides[a].severity))}).on("slid.bs.carousel",e=>{let t=this.setup.$carousel.data("currentIndex"),s=this.setup.slides[t];this.runSlideCallback(s,$(e.relatedTarget)),this.setup.forceSelection&&this.lockNextStep()});let r=this.getComponent();r.on("wizard-dismiss",this.dismiss),Modal.currentModal.on("hidden.bs.modal",()=>{r.trigger("wizard-dismissed")}).on("shown.bs.modal",()=>{r.trigger("wizard-visible")})}runSlideCallback(e,t){"function"==typeof e.callback&&e.callback(t,this.setup.settings,e.identifier)}addProgressBar(){let e,t=this.setup.$carousel.find(".carousel-item").length,s=Math.max(1,t),i=this.setup.$carousel.closest(".modal").find(".modal-footer");e=Math.round(100/s),this.setup.$carousel.data("initialStep",e).data("slideCount",s).data("realSlideCount",t).data("currentIndex",0).data("currentSlide",1),s>1&&i.prepend($("<div />",{class:"progress"}).append($("<div />",{role:"progressbar",class:"progress-bar","aria-valuemin":0,"aria-valuenow":e,"aria-valuemax":100}).width(e+"%").text(top.TYPO3.lang["wizard.progress"].replace("{0}","1").replace("{1}",s))))}generateSlides(){if(null!==this.setup.$carousel)return this.setup.$carousel;let e='<div class="carousel slide" data-bs-ride="carousel" data-bs-interval="false"><div class="carousel-inner" role="listbox">';for(let t of Object.values(this.setup.slides)){let s=t.content;"object"==typeof s&&(s=s.html()),e+='<div class="carousel-item" data-bs-slide="'+t.identifier+'">'+s+"</div>"}return e+="</div></div>",this.setup.$carousel=$(e),this.setup.$carousel.find(".carousel-item").first().addClass("active"),this.setup.$carousel}}let wizardObject;try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.Wizard&&(wizardObject=window.opener.TYPO3.Wizard),parent&&parent.window.TYPO3&&parent.window.TYPO3.Wizard&&(wizardObject=parent.window.TYPO3.Wizard),top&&top.TYPO3&&top.TYPO3.Wizard&&(wizardObject=top.TYPO3.Wizard)}catch{}wizardObject||(wizardObject=new Wizard,"undefined"!=typeof TYPO3&&(TYPO3.Wizard=wizardObject));export default wizardObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/AbstractAction.js b/typo3/sysext/backend/Resources/Public/JavaScript/action-button/abstract-action.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/ActionButton/AbstractAction.js rename to typo3/sysext/backend/Resources/Public/JavaScript/action-button/abstract-action.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/action-button/deferred-action.js b/typo3/sysext/backend/Resources/Public/JavaScript/action-button/deferred-action.js new file mode 100644 index 0000000000000000000000000000000000000000..5a09d6776cbdb078a12454728c27d4f6bf853b67 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/action-button/deferred-action.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{AbstractAction}from"@typo3/backend/action-button/abstract-action.js";import Icons from"@typo3/backend/icons.js";class DeferredAction extends AbstractAction{async execute(t){return Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(e=>{t.innerHTML=e}),await this.executeCallback()}async executeCallback(){return await this.callback()}}export default DeferredAction; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/action-button/immediate-action.js b/typo3/sysext/backend/Resources/Public/JavaScript/action-button/immediate-action.js new file mode 100644 index 0000000000000000000000000000000000000000..4b770d75fa62dae93679321eb1252928f5cec8b9 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/action-button/immediate-action.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{AbstractAction}from"@typo3/backend/action-button/abstract-action.js";class ImmediateAction extends AbstractAction{execute(){return this.executeCallback()}async executeCallback(){return Promise.resolve(this.callback())}}export default ImmediateAction; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/action-dispatcher.js b/typo3/sysext/backend/Resources/Public/JavaScript/action-dispatcher.js new file mode 100644 index 0000000000000000000000000000000000000000..83feeedb6e2a51152e16cc0a5cab491a1c367cc7 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/action-dispatcher.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import InfoWindow from"@typo3/backend/info-window.js";import RegularEvent from"@typo3/core/event/regular-event.js";import shortcutMenu from"@typo3/backend/toolbar/shortcut-menu.js";import windowManager from"@typo3/backend/window-manager.js";import moduleMenuApp from"@typo3/backend/module-menu.js";import documentService from"@typo3/core/document-service.js";import Utility from"@typo3/backend/utility.js";class ActionDispatcher{constructor(){this.delegates={},this.createDelegates(),documentService.ready().then(()=>this.registerEvents())}static resolveArguments(e){if(e.dataset.dispatchArgs){const t=e.dataset.dispatchArgs.replace(/"/g,'"'),n=JSON.parse(t);return n instanceof Array?Utility.trimItems(n):null}if(e.dataset.dispatchArgsList){const t=e.dataset.dispatchArgsList.split(",");return Utility.trimItems(t)}return null}static enrichItems(e,t,n){return e.map(e=>e instanceof Object&&e.$event?e.$target?n:e.$event?t:void 0:e)}createDelegates(){this.delegates={"TYPO3.InfoWindow.showItem":InfoWindow.showItem.bind(null),"TYPO3.ShortcutMenu.createShortcut":shortcutMenu.createShortcut.bind(shortcutMenu),"TYPO3.WindowManager.localOpen":windowManager.localOpen.bind(windowManager),"TYPO3.ModuleMenu.showModule":moduleMenuApp.App.showModule.bind(moduleMenuApp.App)}}registerEvents(){new RegularEvent("click",this.handleClickEvent.bind(this)).delegateTo(document,"[data-dispatch-action]")}handleClickEvent(e,t){e.preventDefault(),this.delegateTo(e,t)}delegateTo(e,t){if(t.hasAttribute("data-dispatch-disabled"))return;const n=t.dataset.dispatchAction;let r=ActionDispatcher.resolveArguments(t);r instanceof Array&&(r=r.map(n=>{switch(n){case"{$target}":return t;case"{$event}":return e;default:return n}})),this.delegates[n]&&this.delegates[n].apply(null,r||[])}}export default new ActionDispatcher; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ajax-data-handler.js b/typo3/sysext/backend/Resources/Public/JavaScript/ajax-data-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..51ec759201614ade6d3444791e34bf949372fd44 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/ajax-data-handler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{BroadcastMessage}from"@typo3/backend/broadcast-message.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import $ from"jquery";import BroadcastService from"@typo3/backend/broadcast-service.js";import Icons from"@typo3/backend/icons.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";var Identifiers;!function(e){e.hide=".t3js-record-hide",e.delete=".t3js-record-delete",e.icon=".t3js-icon"}(Identifiers||(Identifiers={}));class AjaxDataHandler{static refreshPageTree(){top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}static call(e){return new AjaxRequest(TYPO3.settings.ajaxUrls.record_process).withQueryArguments(e).get().then(async e=>await e.resolve())}constructor(){$(()=>{this.initialize()})}process(e,t){return AjaxDataHandler.call(e).then(e=>{if(e.hasErrors&&this.handleErrors(e),t){const a={...t,hasErrors:e.hasErrors},s=new BroadcastMessage("datahandler","process",a);BroadcastService.post(s);const n=new CustomEvent("typo3:datahandler:process",{detail:{payload:a}});document.dispatchEvent(n)}return e})}initialize(){$(document).on("click",Identifiers.hide,e=>{e.preventDefault();const t=$(e.currentTarget),a=t.find(Identifiers.icon),s=t.closest("tr[data-uid]"),n=t.data("params");this._showSpinnerIcon(a),this.process(n).then(e=>{e.hasErrors||this.toggleRow(s)})}),$(document).on("click",Identifiers.delete,e=>{e.preventDefault();const t=$(e.currentTarget);t.tooltip("hide");Modal.confirm(t.data("title"),t.data("message"),SeverityEnum.warning,[{text:t.data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:t.data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",e=>{"cancel"===e.target.getAttribute("name")?Modal.dismiss():"delete"===e.target.getAttribute("name")&&(Modal.dismiss(),this.deleteRecord(t))})})}toggleRow(e){const t=e.find(Identifiers.hide),a=t.closest("table[data-table]").data("table"),s=t.data("params");let n,o,i;"hidden"===t.data("state")?(o="visible",n=s.replace("=0","=1"),i="actions-edit-hide"):(o="hidden",n=s.replace("=1","=0"),i="actions-edit-unhide"),t.data("state",o).data("params",n),t.one("hidden.bs.tooltip",()=>{const e=t.data("toggleTitle");t.data("toggleTitle",t.attr("data-bs-original-title")).attr("data-bs-original-title",e)}),t.tooltip("hide");const r=t.find(Identifiers.icon);Icons.getIcon(i,Icons.sizes.small).then(e=>{r.replaceWith(e)});const d=e.find(".col-icon "+Identifiers.icon);"hidden"===o?Icons.getIcon("miscellaneous-placeholder",Icons.sizes.small,"overlay-hidden").then(e=>{d.append($(e).find(".icon-overlay"))}):d.find(".icon-overlay").remove(),e.fadeTo("fast",.4,()=>{e.fadeTo("fast",1)}),"pages"===a&&AjaxDataHandler.refreshPageTree()}deleteRecord(e){const t=e.data("params");let a=e.find(Identifiers.icon);this._showSpinnerIcon(a);const s=e.closest("table[data-table]"),n=s.data("table");let o=e.closest("tr[data-uid]");const i=o.data("uid"),r={component:"datahandler",action:"delete",table:n,uid:i};this.process(t,r).then(t=>{if(Icons.getIcon("actions-edit-delete",Icons.sizes.small).then(t=>{a=e.find(Identifiers.icon),a.replaceWith(t)}),!t.hasErrors){const t=e.closest(".panel"),a=t.find(".panel-heading"),r=s.find("[data-l10nparent="+i+"]").closest("tr[data-uid]");if(o=o.add(r),o.fadeTo("slow",.4,()=>{o.slideUp("slow",()=>{o.remove(),0===s.find("tbody tr").length&&t.slideUp("slow")})}),"0"===e.data("l10parent")||""===e.data("l10parent")){const e=Number(a.find(".t3js-table-total-items").html());a.find(".t3js-table-total-items").text(e-1)}"pages"===n&&AjaxDataHandler.refreshPageTree()}})}handleErrors(e){$.each(e.messages,(e,t)=>{Notification.error(t.title,t.message)})}_showSpinnerIcon(e){Icons.getIcon("spinner-circle-dark",Icons.sizes.small).then(t=>{e.replaceWith(t)})}}export default new AjaxDataHandler; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/MessageInterface.js b/typo3/sysext/backend/Resources/Public/JavaScript/ajax-data-handler/message-interface.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/MessageInterface.js rename to typo3/sysext/backend/Resources/Public/JavaScript/ajax-data-handler/message-interface.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/ResponseInterface.js b/typo3/sysext/backend/Resources/Public/JavaScript/ajax-data-handler/response-interface.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler/ResponseInterface.js rename to typo3/sysext/backend/Resources/Public/JavaScript/ajax-data-handler/response-interface.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/BackendException.js b/typo3/sysext/backend/Resources/Public/JavaScript/backend-exception.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/BackendException.js rename to typo3/sysext/backend/Resources/Public/JavaScript/backend-exception.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/BroadcastMessage.js b/typo3/sysext/backend/Resources/Public/JavaScript/broadcast-message.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/BroadcastMessage.js rename to typo3/sysext/backend/Resources/Public/JavaScript/broadcast-message.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/broadcast-service.js b/typo3/sysext/backend/Resources/Public/JavaScript/broadcast-service.js new file mode 100644 index 0000000000000000000000000000000000000000..f669005f78da8ce6d4d351bad89a4649acedfc14 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/broadcast-service.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"broadcastchannel.js";import{BroadcastMessage}from"@typo3/backend/broadcast-message.js";import{MessageUtility}from"@typo3/backend/utility/message-utility.js";class BroadcastService{constructor(){this.channel=new BroadcastChannel("typo3")}get isListening(){return"function"==typeof this.channel.onmessage}static onMessage(e){if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;const t=BroadcastMessage.fromData(e.data);document.dispatchEvent(t.createCustomEvent("typo3"))}listen(){this.isListening||(this.channel.onmessage=BroadcastService.onMessage)}post(e){this.channel.postMessage(e)}}export default new BroadcastService; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ClipboardPanel.js b/typo3/sysext/backend/Resources/Public/JavaScript/clipboard-panel.js similarity index 94% rename from typo3/sysext/backend/Resources/Public/JavaScript/ClipboardPanel.js rename to typo3/sysext/backend/Resources/Public/JavaScript/clipboard-panel.js index 76c1195e00d3133ed2ad047b85ec067c21ff976e..0c3ea17d850471a8c67b2a9baa7210a177f14d32 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ClipboardPanel.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/clipboard-panel.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var ClipboardPanel_1,CopyMode,__decorate=function(t,e,i,a){var o,n=arguments.length,l=n<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,i,a);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(l=(n<3?o(l):n>3?o(e,i,l):o(e,i))||l);return n>3&&l&&Object.defineProperty(e,i,l),l};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{until}from"lit/directives/until.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{classMap}from"lit/directives/class-map.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import"TYPO3/CMS/Backend/Element/SpinnerElement.js";import"TYPO3/CMS/Backend/Element/IconElement.js";!function(t){t.cut="cut",t.copy="copy"}(CopyMode||(CopyMode={}));let ClipboardPanel=ClipboardPanel_1=class extends LitElement{constructor(){super(...arguments),this.returnUrl="",this.table=""}static renderLoader(){return html` +var ClipboardPanel_1,CopyMode,__decorate=function(t,e,i,a){var o,n=arguments.length,l=n<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,i):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(t,e,i,a);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(l=(n<3?o(l):n>3?o(e,i,l):o(e,i))||l);return n>3&&l&&Object.defineProperty(e,i,l),l};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{until}from"lit/directives/until.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{classMap}from"lit/directives/class-map.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Notification from"@typo3/backend/notification.js";import"@typo3/backend/element/spinner-element.js";import"@typo3/backend/element/icon-element.js";!function(t){t.cut="cut",t.copy="copy"}(CopyMode||(CopyMode={}));let ClipboardPanel=ClipboardPanel_1=class extends LitElement{constructor(){super(...arguments),this.returnUrl="",this.table=""}static renderLoader(){return html` <div class="panel-loader"> <typo3-backend-spinner size="small" variant="dark"></typo3-backend-spinner> </div> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ColorPicker.js b/typo3/sysext/backend/Resources/Public/JavaScript/color-picker.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/ColorPicker.js rename to typo3/sysext/backend/Resources/Public/JavaScript/color-picker.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/column-selector-button.js b/typo3/sysext/backend/Resources/Public/JavaScript/column-selector-button.js new file mode 100644 index 0000000000000000000000000000000000000000..7c21619abf71f4d9c09697dd84e4ef192ea93bde --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/column-selector-button.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var ColumnSelectorButton_1,Selectors,SelectorActions,__decorate=function(e,t,o,l){var r,n=arguments.length,c=n<3?t:null===l?l=Object.getOwnPropertyDescriptor(t,o):l;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,l);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(c=(n<3?r(c):n>3?r(t,o,c):r(t,o))||c);return n>3&&c&&Object.defineProperty(t,o,c),c};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import Severity from"@typo3/backend/severity.js";import Modal from"@typo3/backend/modal.js";import{lll}from"@typo3/core/lit-helper.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Notification from"@typo3/backend/notification.js";!function(e){e.columnsSelector=".t3js-column-selector",e.columnsContainerSelector=".t3js-column-selector-container",e.columnsFilterSelector='input[name="columns-filter"]',e.columnsSelectorActionsSelector=".t3js-column-selector-actions"}(Selectors||(Selectors={})),function(e){e.toggle="select-toggle",e.all="select-all",e.none="select-none"}(SelectorActions||(SelectorActions={}));let ColumnSelectorButton=ColumnSelectorButton_1=class extends LitElement{constructor(){super(),this.title="Show columns",this.ok=lll("button.ok")||"Update",this.close=lll("button.close")||"Close",this.error="Could not update columns",this.addEventListener("click",e=>{e.preventDefault(),this.showColumnSelectorModal()})}static toggleSelectorActions(e,t,o,l=!1){t.classList.add("disabled");for(let o=0;o<e.length;o++)if(!e[o].disabled&&!e[o].checked&&(l||!ColumnSelectorButton_1.isColumnHidden(e[o]))){t.classList.remove("disabled");break}o.classList.add("disabled");for(let t=0;t<e.length;t++)if(!e[t].disabled&&e[t].checked&&(l||!ColumnSelectorButton_1.isColumnHidden(e[t]))){o.classList.remove("disabled");break}}static isColumnHidden(e){return e.closest(Selectors.columnsContainerSelector)?.classList.contains("hidden")}static filterColumns(e,t){t.forEach(t=>{const o=t.closest(Selectors.columnsContainerSelector);if(!t.disabled&&null!==o){const t=o.querySelector(".form-check-label-text")?.textContent;t&&t.length&&o.classList.toggle("hidden",""!==e.value&&!RegExp(e.value,"i").test(t.trim().replace(/\[\]/g,"").replace(/\s+/g," ")))}})}render(){return html`<slot></slot>`}showColumnSelectorModal(){this.url&&this.target&&Modal.advanced({content:this.url,title:this.title,severity:SeverityEnum.notice,size:Modal.sizes.medium,type:Modal.types.ajax,buttons:[{text:this.close,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>Modal.dismiss()},{text:this.ok,btnClass:"btn-"+Severity.getCssClass(SeverityEnum.info),name:"update",trigger:()=>this.proccessSelection(Modal.currentModal[0])}],ajaxCallback:()=>this.handleModalContentLoaded(Modal.currentModal[0])})}proccessSelection(e){const t=e.querySelector("form");null!==t?new AjaxRequest(TYPO3.settings.ajaxUrls.show_columns).post("",{body:new FormData(t)}).then(async e=>{const t=await e.resolve();!0===t.success?(this.ownerDocument.location.href=this.target,this.ownerDocument.location.reload()):Notification.error(t.message||"No update was performed"),Modal.dismiss()}).catch(()=>{this.abortSelection()}):this.abortSelection()}handleModalContentLoaded(e){const t=e.querySelector("form");if(null===t)return;t.addEventListener("submit",e=>{e.preventDefault()});const o=e.querySelectorAll(Selectors.columnsSelector),l=e.querySelector(Selectors.columnsFilterSelector),r=e.querySelector(Selectors.columnsSelectorActionsSelector),n=r.querySelector('button[data-action="'+SelectorActions.all+'"]'),c=r.querySelector('button[data-action="'+SelectorActions.none+'"]');o.length&&null!==l&&null!==n&&null!==c&&(ColumnSelectorButton_1.toggleSelectorActions(o,n,c,!0),o.forEach(e=>{e.addEventListener("change",()=>{ColumnSelectorButton_1.toggleSelectorActions(o,n,c)})}),l.addEventListener("keydown",e=>{const t=e.target;"Escape"===e.code&&(e.stopImmediatePropagation(),t.value="")}),l.addEventListener("keyup",e=>{ColumnSelectorButton_1.filterColumns(e.target,o),ColumnSelectorButton_1.toggleSelectorActions(o,n,c)}),l.addEventListener("search",e=>{ColumnSelectorButton_1.filterColumns(e.target,o),ColumnSelectorButton_1.toggleSelectorActions(o,n,c)}),r.querySelectorAll("button[data-action]").forEach(e=>{e.addEventListener("click",e=>{e.preventDefault();const t=e.currentTarget;if(t.dataset.action){switch(t.dataset.action){case SelectorActions.toggle:o.forEach(e=>{e.disabled||ColumnSelectorButton_1.isColumnHidden(e)||(e.checked=!e.checked)});break;case SelectorActions.all:o.forEach(e=>{e.disabled||ColumnSelectorButton_1.isColumnHidden(e)||(e.checked=!0)});break;case SelectorActions.none:o.forEach(e=>{e.disabled||ColumnSelectorButton_1.isColumnHidden(e)||(e.checked=!1)});break;default:Notification.warning("Unknown selector action")}ColumnSelectorButton_1.toggleSelectorActions(o,n,c)}})}))}abortSelection(){Notification.error(this.error),Modal.dismiss()}};__decorate([property({type:String})],ColumnSelectorButton.prototype,"url",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"target",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"title",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"ok",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"close",void 0),__decorate([property({type:String})],ColumnSelectorButton.prototype,"error",void 0),ColumnSelectorButton=ColumnSelectorButton_1=__decorate([customElement("typo3-backend-column-selector-button")],ColumnSelectorButton); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/context-help.js b/typo3/sysext/backend/Resources/Public/JavaScript/context-help.js new file mode 100644 index 0000000000000000000000000000000000000000..8aeabc192f460d224a0a3fe32bad70c6291886d9 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/context-help.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Popover from"@typo3/backend/popover.js";class ContextHelp{constructor(){this.ajaxUrl=TYPO3.settings.ajaxUrls.context_help,this.trigger="click",this.placement="auto",this.selector=".help-link",this.initialize()}static resolveBackend(){return void 0!==window.opener&&null!==window.opener?window.opener.top:top}initialize(){const t=ContextHelp.resolveBackend();void 0!==t.TYPO3.settings.ContextHelp&&(this.helpModuleUrl=t.TYPO3.settings.ContextHelp.moduleUrl),void 0===TYPO3.ShortcutMenu&&void 0===t.TYPO3.ShortcutMenu&&$(".icon-actions-system-shortcut-new").closest(".btn").hide();let e=" ";void 0!==t.TYPO3.lang&&(e=t.TYPO3.lang.csh_tooltip_loading);const o=$(this.selector);o.attr("data-loaded","false").attr("data-bs-html","true").attr("data-bs-original-title",e).attr("data-bs-placement",this.placement).attr("data-bs-trigger",this.trigger),Popover.popover(o),$(document).on("show.bs.popover",this.selector,t=>{const e=$(t.currentTarget),o=e.data("description");if(void 0!==o&&""!==o){const t={title:e.data("title")||"",content:o};Popover.setOptions(e,t)}else"false"===e.attr("data-loaded")&&e.data("table")&&this.loadHelp(e);e.closest(".t3js-module-docheader").length&&Popover.setOption(e,"placement","bottom")}).on("click",".help-has-link",t=>{$(".popover").each((e,o)=>{const a=$(o);a.has(t.target).length&&this.showHelpPopup($('[aria-describedby="'+a.attr("id")+'"]'))})}).on("click","body",t=>{$(this.selector).each((e,o)=>{const a=$(o);a.is(t.target)||0!==a.has(t.target).length||0!==$(".popover").has(t.target).length||Popover.hide(a)})})}showHelpPopup(t){try{const e=window.open(this.helpModuleUrl+"&table="+t.data("table")+"&field="+t.data("field")+"&action=detail","ContextHelpWindow","height=400,width=600,status=0,menubar=0,scrollbars=1");return e.focus(),Popover.hide(t),e}catch{}}loadHelp(t){const e=t.data("table"),o=t.data("field");e&&new AjaxRequest(this.ajaxUrl).withQueryArguments({params:{action:"getContextHelp",table:e,field:o}}).get().then(async e=>{const o=await e.resolve(),a={title:o.title||"",content:o.content||"<p></p>"};Popover.setOptions(t,a),Popover.update(t),t.attr("data-loaded","true")})}}export default new ContextHelp; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/context-menu-actions.js b/typo3/sysext/backend/Resources/Public/JavaScript/context-menu-actions.js new file mode 100644 index 0000000000000000000000000000000000000000..915e1e290f0962fb98a3577fe108d4792195ec9a --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/context-menu-actions.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{SeverityEnum}from"@typo3/backend/enum/severity.js";import $ from"jquery";import AjaxDataHandler from"@typo3/backend/ajax-data-handler.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import InfoWindow from"@typo3/backend/info-window.js";import Modal from"@typo3/backend/modal.js";import ModuleMenu from"@typo3/backend/module-menu.js";import Notification from"@typo3/backend/notification.js";import Viewport from"@typo3/backend/viewport.js";import{ModuleStateStorage}from"@typo3/backend/storage/module-state-storage.js";import{NewContentElementWizard}from"@typo3/backend/new-content-element-wizard.js";class ContextMenuActions{static getReturnUrl(){return encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search)}static editRecord(t,e){let n="",o=$(this).data("pages-language-uid");o&&(n="&overrideVals[pages][sys_language_uid]="+o),Viewport.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"]["+e+"]=edit"+n+"&returnUrl="+ContextMenuActions.getReturnUrl())}static viewRecord(){const t=$(this).data("preview-url");if(t){window.open(t,"newTYPO3frontendWindow").focus()}}static openInfoPopUp(t,e){InfoWindow.showItem(t,e)}static mountAsTreeRoot(t,e){if("pages"===t){const t=new CustomEvent("typo3:pagetree:mountPoint",{detail:{pageId:e}});top.document.dispatchEvent(t)}}static newPageWizard(t,e){const n=$(this).data("pages-new-wizard-url");Viewport.ContentContainer.setUrl(n+"&returnUrl="+ContextMenuActions.getReturnUrl())}static newContentWizard(){const t=$(this);let e=t.data("new-wizard-url");e&&(e+="&returnUrl="+ContextMenuActions.getReturnUrl(),Modal.advanced({title:t.data("title"),type:Modal.types.ajax,size:Modal.sizes.medium,content:e,severity:SeverityEnum.notice,ajaxCallback:()=>{const t=Modal.currentModal.get(0);t&&t.querySelector(".t3-new-content-element-wizard-inner")&&new NewContentElementWizard(t)}}))}static newRecord(t,e){Viewport.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"]["+("pages"!==t?"-":"")+e+"]=new&returnUrl="+ContextMenuActions.getReturnUrl())}static openHistoryPopUp(t,e){Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordHistory.moduleUrl+"&element="+t+":"+e+"&returnUrl="+ContextMenuActions.getReturnUrl())}static openListModule(t,e){const n="pages"===t?e:$(this).data("page-uid");ModuleMenu.App.showModule("web_list","id="+n)}static pagesSort(){const t=$(this).data("pages-sort-url");t&&Viewport.ContentContainer.setUrl(t)}static pagesNewMultiple(){const t=$(this).data("pages-new-multiple-url");t&&Viewport.ContentContainer.setUrl(t)}static disableRecord(t,e){const n=$(this).data("disable-field")||"hidden";Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+e+"]["+n+"]=1&redirect="+ContextMenuActions.getReturnUrl()).done(()=>{ContextMenuActions.refreshPageTree()})}static enableRecord(t,e){const n=$(this).data("disable-field")||"hidden";Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+e+"]["+n+"]=0&redirect="+ContextMenuActions.getReturnUrl()).done(()=>{ContextMenuActions.refreshPageTree()})}static showInMenus(t,e){Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+e+"][nav_hide]=0&redirect="+ContextMenuActions.getReturnUrl()).done(()=>{ContextMenuActions.refreshPageTree()})}static hideInMenus(t,e){Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+"&data["+t+"]["+e+"][nav_hide]=1&redirect="+ContextMenuActions.getReturnUrl()).done(()=>{ContextMenuActions.refreshPageTree()})}static deleteRecord(t,e){const n=$(this);Modal.confirm(n.data("title"),n.data("message"),SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",n=>{if("delete"===n.target.getAttribute("name")){const n={component:"contextmenu",action:"delete",table:t,uid:e};AjaxDataHandler.process("cmd["+t+"]["+e+"][delete]=1",n).then(()=>{"pages"===t?(ModuleStateStorage.current("web").identifier===e.toString()&&top.document.dispatchEvent(new CustomEvent("typo3:pagetree:selectFirstNode")),ContextMenuActions.refreshPageTree()):"tt_content"===t&&Viewport.ContentContainer.refresh()})}Modal.dismiss()})}static copy(t,e){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+e+"]=1&CB[setCopyMode]=1";new AjaxRequest(n).get().finally(()=>{ContextMenuActions.triggerRefresh(Viewport.ContentContainer.get().location.href)})}static clipboardRelease(t,e){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+e+"]=0";new AjaxRequest(n).get().finally(()=>{ContextMenuActions.triggerRefresh(Viewport.ContentContainer.get().location.href)})}static cut(t,e){const n=TYPO3.settings.ajaxUrls.contextmenu_clipboard+"&CB[el]["+t+"%7C"+e+"]=1&CB[setCopyMode]=0";new AjaxRequest(n).get().finally(()=>{ContextMenuActions.triggerRefresh(Viewport.ContentContainer.get().location.href)})}static triggerRefresh(t){t.includes("record%2Fedit")||Viewport.ContentContainer.refresh()}static clearCache(t,e){new AjaxRequest(TYPO3.settings.ajaxUrls.web_list_clearpagecache).withQueryArguments({id:e}).get({cache:"no-cache"}).then(async t=>{const e=await t.resolve();!0===e.success?Notification.success(e.title,e.message,1):Notification.error(e.title,e.message,1)},()=>{Notification.error("Clearing page caches went wrong on the server side.")})}static pasteAfter(t,e){ContextMenuActions.pasteInto.bind($(this))(t,-e)}static pasteInto(t,e){const n=$(this),o=()=>{const n="&CB[paste]="+t+"%7C"+e+"&CB[pad]=normal&redirect="+ContextMenuActions.getReturnUrl();Viewport.ContentContainer.setUrl(top.TYPO3.settings.RecordCommit.moduleUrl+n).done(()=>{"pages"===t&&ContextMenuActions.refreshPageTree()})};if(!n.data("title"))return void o();Modal.confirm(n.data("title"),n.data("message"),SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-warning",name:"ok"}]).on("button.clicked",t=>{"ok"===t.target.getAttribute("name")&&o(),Modal.dismiss()})}static refreshPageTree(){top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}}export default ContextMenuActions; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/context-menu.js b/typo3/sysext/backend/Resources/Public/JavaScript/context-menu.js new file mode 100644 index 0000000000000000000000000000000000000000..4051d6eed06ea408c220d69585b26f5c4fc5d0d9 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/context-menu.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import ContextMenuActions from"@typo3/backend/context-menu-actions.js";import DebounceEvent from"@typo3/core/event/debounce-event.js";import RegularEvent from"@typo3/core/event/regular-event.js";import ThrottleEvent from"@typo3/core/event/throttle-event.js";class ContextMenu{constructor(){this.mousePos={X:null,Y:null},this.record={uid:null,table:null},this.eventSources=[],this.storeMousePositionEvent=t=>{this.mousePos={X:t.pageX,Y:t.pageY}},$(document).on("click contextmenu",".t3js-contextmenutrigger",t=>{const e=$(t.currentTarget);e.prop("onclick")&&"click"===t.type||(t.preventDefault(),this.show(e.data("table"),e.data("uid"),e.data("context"),e.data("iteminfo"),e.data("parameters"),t.target))}),new ThrottleEvent("mousemove",this.storeMousePositionEvent.bind(this),50).bindTo(document)}static drawActionItem(t){const e=t.additionalAttributes||{};let n="";for(const t of Object.entries(e)){const[e,s]=t;n+=" "+e+'="'+s+'"'}return'<li role="menuitem" class="list-group-item" tabindex="-1" data-callback-action="'+t.callbackAction+'"'+n+'><span class="list-group-item-icon">'+t.icon+"</span> "+t.label+"</li>"}static within(t,e,n){const s=t.getBoundingClientRect(),o=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop,r=e>=s.left+o&&e<=s.left+o+s.width,a=n>=s.top+i&&n<=s.top+i+s.height;return r&&a}show(t,e,n,s,o,i=null){this.hideAll(),this.record={table:t,uid:e};const r=i.matches("a, button, [tabindex]")?i:i.closest("a, button, [tabindex]");this.eventSources.push(r);let a="";void 0!==t&&(a+="table="+encodeURIComponent(t)),void 0!==e&&(a+=(a.length>0?"&":"")+"uid="+e),void 0!==n&&(a+=(a.length>0?"&":"")+"context="+n),void 0!==s&&(a+=(a.length>0?"&":"")+"enDisItems="+s),void 0!==o&&(a+=(a.length>0?"&":"")+"addParams="+o),this.fetch(a)}initializeContextMenuContainer(){if(0===$("#contentMenu0").length){const t='<div id="contentMenu0" class="context-menu" style="display: none;"></div><div id="contentMenu1" class="context-menu" data-parent="#contentMenu0" style="display: none;"></div>';$("body").append(t),document.querySelectorAll(".context-menu").forEach(t=>{new RegularEvent("mouseenter",t=>{t.target;this.storeMousePositionEvent(t)}).bindTo(t),new DebounceEvent("mouseleave",t=>{const e=t.target,n=document.querySelector('[data-parent="#'+e.id+'"]');if(!ContextMenu.within(e,this.mousePos.X,this.mousePos.Y)&&(null===n||null===n.offsetParent)){let t;this.hide("#"+e.id),void 0!==e.dataset.parent&&null!==(t=document.querySelector(e.dataset.parent))&&(ContextMenu.within(t,this.mousePos.X,this.mousePos.Y)||this.hide(e.dataset.parent))}},500).bindTo(t)})}}fetch(t){const e=TYPO3.settings.ajaxUrls.contextmenu;new AjaxRequest(e).withQueryArguments(t).get().then(async t=>{const e=await t.resolve();void 0!==t&&Object.keys(t).length>0&&this.populateData(e,0)})}populateData(t,e){this.initializeContextMenuContainer();const n=$("#contentMenu"+e);if(n.length&&(0===e||$("#contentMenu"+(e-1)).is(":visible"))){const s=this.drawMenu(t,e);n.html('<ul class="list-group" role="menu">'+s+"</ul>"),$("li.list-group-item",n).on("click",t=>{t.preventDefault();const n=$(t.currentTarget);if(n.hasClass("list-group-item-submenu"))return void this.openSubmenu(e,n,!1);const s=n.data("callback-action"),o=n.data("callback-module");n.data("callback-module")?import(o+".js").then(({default:t})=>{t[s].bind(n)(this.record.table,this.record.uid)}):ContextMenuActions&&"function"==typeof ContextMenuActions[s]?ContextMenuActions[s].bind(n)(this.record.table,this.record.uid):console.log("action: "+s+" not found"),this.hideAll()}),$("li.list-group-item",n).on("keydown",t=>{const n=$(t.currentTarget);switch(t.key){case"Down":case"ArrowDown":this.setFocusToNextItem(n.get(0));break;case"Up":case"ArrowUp":this.setFocusToPreviousItem(n.get(0));break;case"Right":case"ArrowRight":if(!n.hasClass("list-group-item-submenu"))return;this.openSubmenu(e,n,!0);break;case"Home":this.setFocusToFirstItem(n.get(0));break;case"End":this.setFocusToLastItem(n.get(0));break;case"Enter":case"Space":n.click();break;case"Esc":case"Escape":case"Left":case"ArrowLeft":this.hide("#"+n.parents(".context-menu").first().attr("id"));break;case"Tab":this.hideAll();break;default:return}t.preventDefault()}),n.css(this.getPosition(n,!1)).show(),$("li.list-group-item[tabindex=-1]",n).first().focus()}}setFocusToPreviousItem(t){let e=this.getItemBackward(t.previousElementSibling);e||(e=this.getLastItem(t)),e.focus()}setFocusToNextItem(t){let e=this.getItemForward(t.nextElementSibling);e||(e=this.getFirstItem(t)),e.focus()}setFocusToFirstItem(t){let e=this.getFirstItem(t);e&&e.focus()}setFocusToLastItem(t){let e=this.getLastItem(t);e&&e.focus()}getItemBackward(t){for(;t&&(!t.classList.contains("list-group-item")||"-1"!==t.getAttribute("tabindex"));)t=t.previousElementSibling;return t}getItemForward(t){for(;t&&(!t.classList.contains("list-group-item")||"-1"!==t.getAttribute("tabindex"));)t=t.nextElementSibling;return t}getFirstItem(t){return this.getItemForward(t.parentElement.firstElementChild)}getLastItem(t){return this.getItemBackward(t.parentElement.lastElementChild)}openSubmenu(t,e,n){this.eventSources.push(e[0]);const s=$("#contentMenu"+(t+1)).html("");e.next().find(".list-group").clone(!0).appendTo(s),s.css(this.getPosition(s,n)).show(),$(".list-group-item[tabindex=-1]",s).first().focus()}getPosition(t,e){let n=0,s=0;if(this.eventSources.length&&(null===this.mousePos.X||e)){const t=this.eventSources[this.eventSources.length-1].getBoundingClientRect();n=this.eventSources.length>1?t.right:t.x,s=t.y}else n=this.mousePos.X-1,s=this.mousePos.Y-1;const o=$(window).width()-20,i=$(window).height(),r=t.width(),a=t.height(),l=n-$(document).scrollLeft(),c=s-$(document).scrollTop();return i-a<c&&(c>a?s-=a-10:s+=i-a-c),o-r<l&&(l>r?n-=r-10:o-r-l<$(document).scrollLeft()?n=$(document).scrollLeft():n+=o-r-l),{left:n+"px",top:s+"px"}}drawMenu(t,e){let n="";for(const s of Object.values(t))if("item"===s.type)n+=ContextMenu.drawActionItem(s);else if("divider"===s.type)n+='<li role="separator" class="list-group-item list-group-item-divider"></li>';else if("submenu"===s.type||s.childItems){n+='<li role="menuitem" aria-haspopup="true" class="list-group-item list-group-item-submenu" tabindex="-1"><span class="list-group-item-icon">'+s.icon+"</span> "+s.label+' <span class="fa fa-caret-right"></span></li>';n+='<div class="context-menu contentMenu'+(e+1)+'" style="display:none;"><ul role="menu" class="list-group">'+this.drawMenu(s.childItems,1)+"</ul></div>"}return n}hide(t){$(t).hide();const e=this.eventSources.pop();e&&$(e).focus()}hideAll(){this.hide("#contentMenu0"),this.hide("#contentMenu1")}}export default new ContextMenu; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/copy-to-clipboard.js b/typo3/sysext/backend/Resources/Public/JavaScript/copy-to-clipboard.js new file mode 100644 index 0000000000000000000000000000000000000000..a891afb21b8828cd08735ff81287946ff253c001 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/copy-to-clipboard.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var __decorate=function(o,t,e,r){var i,c=arguments.length,l=c<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,e):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(o,t,e,r);else for(var p=o.length-1;p>=0;p--)(i=o[p])&&(l=(c<3?i(l):c>3?i(t,e,l):i(t,e))||l);return c>3&&l&&Object.defineProperty(t,e,l),l};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import Notification from"@typo3/backend/notification.js";import{lll}from"@typo3/core/lit-helper.js";let CopyToClipboard=class extends LitElement{constructor(){super(),this.addEventListener("click",o=>{o.preventDefault(),this.copyToClipboard()})}render(){return html`<slot></slot>`}copyToClipboard(){if("string"!=typeof this.text||!this.text.length)return console.warn("No text for copy to clipboard given."),void Notification.error(lll("copyToClipboard.error"));if(navigator.clipboard)navigator.clipboard.writeText(this.text).then(()=>{Notification.success(lll("copyToClipboard.success"),"",1)}).catch(()=>{Notification.error(lll("copyToClipboard.error"))});else{const o=document.createElement("textarea");o.value=this.text,document.body.appendChild(o),o.focus(),o.select();try{document.execCommand("copy")?Notification.success(lll("copyToClipboard.success"),"",1):Notification.error(lll("copyToClipboard.error"))}catch(o){Notification.error(lll("copyToClipboard.error"))}document.body.removeChild(o)}}};__decorate([property({type:String})],CopyToClipboard.prototype,"text",void 0),CopyToClipboard=__decorate([customElement("typo3-copy-to-clipboard")],CopyToClipboard); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/date-time-picker.js b/typo3/sysext/backend/Resources/Public/JavaScript/date-time-picker.js new file mode 100644 index 0000000000000000000000000000000000000000..53e676f6b5b2fb3f378f5aaa67503d0599f13133 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/date-time-picker.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import flatpickr from"flatpickr/flatpickr.min.js";import moment from"moment";import PersistentStorage from"@typo3/backend/storage/persistent.js";import ThrottleEvent from"@typo3/core/event/throttle-event.js";class DateTimePicker{constructor(){this.format=(void 0!==opener?.top?.TYPO3?opener.top:top).TYPO3.settings.DateTimePicker.DateFormat}static formatDateForHiddenField(e,t){return"time"!==t&&"timesec"!==t||e.year(1970).month(0).date(1),e.format()}initialize(e){if(!(e instanceof HTMLInputElement)||void 0!==e.dataset.datepickerInitialized)return;let t=PersistentStorage.get("lang");""===t?t="default":"ch"===t&&(t="zh"),e.dataset.datepickerInitialized="1",import("flatpickr/locales.js").then(()=>{this.initializeField(e,t)})}initializeField(e,t){const a=this.getScrollEvent(),n=this.getDateOptions(e);n.locale=t,n.onOpen=[()=>{a.bindTo(document.querySelector(".t3js-module-body"))}],n.onClose=()=>{a.release()};const r=flatpickr(e,n);e.addEventListener("input",()=>{const e=r._input.value,t=r.parseDate(e);e===r.formatDate(t,r.config.dateFormat)&&r.setDate(e)}),e.addEventListener("change",t=>{t.stopImmediatePropagation();const a=t.target,n=e.parentElement.parentElement.querySelector('input[type="hidden"]');if(""!==a.value){const e=a.dataset.dateType,t=moment.utc(a.value,a._flatpickr.config.dateFormat);t.isValid()?n.value=DateTimePicker.formatDateForHiddenField(t,e):a.value=DateTimePicker.formatDateForHiddenField(moment.utc(n.value),e)}else n.value="";a.dispatchEvent(new Event("formengine.dp.change"))})}getScrollEvent(){return new ThrottleEvent("scroll",()=>{const e=document.querySelector(".flatpickr-input.active");if(null===e)return;const t=e.getBoundingClientRect(),a=e._flatpickr.calendarContainer.offsetHeight;let n,r;window.innerHeight-t.bottom<a&&t.top>a?(n=t.y-a-2,r="arrowBottom"):(n=t.y+t.height+2,r="arrowTop"),e._flatpickr.calendarContainer.style.top=n+"px",e._flatpickr.calendarContainer.classList.remove("arrowBottom","arrowTop"),e._flatpickr.calendarContainer.classList.add(r)},15)}getDateOptions(e){const t=this.format,a=e.dataset.dateType,n={allowInput:!0,dateFormat:"",defaultDate:e.value,enableSeconds:!1,enableTime:!1,formatDate:(e,t)=>moment(e).format(t),parseDate:(e,t)=>moment(e,t,!0).toDate(),maxDate:"",minDate:"",minuteIncrement:1,noCalendar:!1,weekNumbers:!0};switch(a){case"datetime":n.dateFormat=t[1],n.enableTime=!0;break;case"date":n.dateFormat=t[0];break;case"time":n.dateFormat="HH:mm",n.enableTime=!0,n.noCalendar=!0;break;case"timesec":n.dateFormat="HH:mm:ss",n.enableSeconds=!0,n.enableTime=!0,n.noCalendar=!0;break;case"year":n.dateFormat="Y"}return"undefined"!==e.dataset.dateMindate&&(n.minDate=e.dataset.dateMindate),"undefined"!==e.dataset.dateMaxdate&&(n.maxDate=e.dataset.dateMaxdate),n}}export default new DateTimePicker; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/DebugConsole.js b/typo3/sysext/backend/Resources/Public/JavaScript/debug-console.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/DebugConsole.js rename to typo3/sysext/backend/Resources/Public/JavaScript/debug-console.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/document-header.js b/typo3/sysext/backend/Resources/Public/JavaScript/document-header.js new file mode 100644 index 0000000000000000000000000000000000000000..023ec8a435b1833bf28e855cee337ef11bbbdcc8 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/document-header.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import ThrottleEvent from"@typo3/core/event/throttle-event.js";class DocumentHeader{constructor(){this.documentHeader=null,this.direction="down",this.reactionRange=300,this.lastPosition=0,this.currentPosition=0,this.changedPosition=0,this.settings={margin:24,offset:100,selectors:{moduleDocumentHeader:".t3js-module-docheader",moduleSearchBar:".t3js-module-docheader-bar-search"}},this.scroll=t=>{this.currentPosition=t.target.scrollTop,this.currentPosition>this.lastPosition?"down"!==this.direction&&(this.direction="down",this.changedPosition=this.currentPosition):this.currentPosition<this.lastPosition&&"up"!==this.direction&&(this.direction="up",this.changedPosition=this.currentPosition),"up"===this.direction&&this.changedPosition-this.reactionRange<this.currentPosition&&this.documentHeader.classList.remove("module-docheader-folded"),"down"===this.direction&&this.changedPosition+this.reactionRange<this.currentPosition&&this.documentHeader.classList.add("module-docheader-folded"),this.lastPosition=this.currentPosition},DocumentService.ready().then(()=>{if(this.documentHeader=document.querySelector(this.settings.selectors.moduleDocumentHeader),null===this.documentHeader)return;const t=this.documentHeader.parentElement;new ThrottleEvent("scroll",this.scroll,100).bindTo(t)})}}export default new DocumentHeader; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/document-save-actions.js b/typo3/sysext/backend/Resources/Public/JavaScript/document-save-actions.js new file mode 100644 index 0000000000000000000000000000000000000000..e1d36840cb6f24247aee29876f87a10d44cca03b --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/document-save-actions.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Icons from"@typo3/backend/icons.js";class DocumentSaveActions{constructor(){this.preSubmitCallbacks=[],$(()=>{this.initializeSaveHandling()})}static getInstance(){return null===DocumentSaveActions.instance&&(DocumentSaveActions.instance=new DocumentSaveActions),DocumentSaveActions.instance}addPreSubmitCallback(t){if("function"!=typeof t)throw"callback must be a function.";this.preSubmitCallbacks.push(t)}initializeSaveHandling(){let t=!1;const e=["button[form]",'button[name^="_save"]','a[data-name^="_save"]','button[name="CMD"][value^="save"]','a[data-name="CMD"][data-value^="save"]'].join(",");$(".t3js-module-docheader").on("click",e,e=>{if(!t){t=!0;const a=$(e.currentTarget),n=a.attr("form")||a.attr("data-form")||null,r=n?$("#"+n):a.closest("form"),i=a.data("name")||e.currentTarget.getAttribute("name"),o=a.data("value")||e.currentTarget.getAttribute("value"),s=$("<input />").attr("type","hidden").attr("name",i).attr("value",o);for(let a of this.preSubmitCallbacks)if(a(e),e.isPropagationStopped())return t=!1,!1;r.append(s),r.on("submit",()=>{if(r.find(".has-error").length>0)return t=!1,!1;let e;const n=a.closest(".t3js-splitbutton");return n.length>0?(n.find("button").prop("disabled",!0),e=n.children().first()):(a.prop("disabled",!0),e=a),Icons.getIcon("spinner-circle-dark",Icons.sizes.small).then(t=>{e.find(".t3js-icon").replaceWith(t)}).catch(t=>{}),!0}),"A"!==e.currentTarget.tagName&&!a.attr("form")||e.isDefaultPrevented()||(r.find('[name="doSave"]').val("1"),r.trigger("submit"),e.preventDefault())}return!0})}}DocumentSaveActions.instance=null;export default DocumentSaveActions; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/drag-uploader.js b/typo3/sysext/backend/Resources/Public/JavaScript/drag-uploader.js new file mode 100644 index 0000000000000000000000000000000000000000..28e34e1ec609d5861152768c2a6e544834f5f92a --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/drag-uploader.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import moment from"moment";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import{MessageUtility}from"@typo3/backend/utility/message-utility.js";import NProgress from"nprogress";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import ImmediateAction from"@typo3/backend/action-button/immediate-action.js";import Md5 from"@typo3/backend/hashing/md5.js";var Action;!function(e){e.OVERRIDE="replace",e.RENAME="rename",e.SKIP="cancel",e.USE_EXISTING="useExisting"}(Action||(Action={}));class DragUploaderPlugin{constructor(e){this.askForOverride=[],this.percentagePerFile=1,this.hideDropzone=e=>{e.stopPropagation(),e.preventDefault(),this.$dropzone.hide(),this.$dropzone.removeClass("drop-status-ok"),this.manuallyTriggered=!1},this.dragFileIntoDocument=e=>(e.stopPropagation(),e.preventDefault(),$(e.currentTarget).addClass("drop-in-progress"),this.$element.get(0)?.offsetParent&&this.showDropzone(),!1),this.dragAborted=e=>(e.stopPropagation(),e.preventDefault(),$(e.currentTarget).removeClass("drop-in-progress"),!1),this.ignoreDrop=e=>(e.stopPropagation(),e.preventDefault(),this.dragAborted(e),!1),this.handleDrop=e=>{this.ignoreDrop(e),this.hideDropzone(e),this.processFiles(e.originalEvent.dataTransfer.files)},this.fileInDropzone=()=>{this.$dropzone.addClass("drop-status-ok")},this.fileOutOfDropzone=()=>{this.$dropzone.removeClass("drop-status-ok"),this.manuallyTriggered||this.manualTable||this.$dropzone.hide()},this.$body=$("body"),this.$element=$(e);const t=void 0!==this.$element.data("dropzoneTrigger");this.$trigger=$(this.$element.data("dropzoneTrigger")),this.defaultAction=this.$element.data("defaultAction")||Action.SKIP,this.$dropzone=$("<div />").addClass("dropzone").hide(),this.irreObjectUid=this.$element.data("fileIrreObject");const i=this.$element.data("dropzoneTarget");this.irreObjectUid&&0!==this.$element.nextAll(i).length?(this.dropZoneInsertBefore=!0,this.$dropzone.insertBefore(i)):(this.dropZoneInsertBefore=!1,this.$dropzone.insertAfter(i)),this.$dropzoneMask=$("<div />").addClass("dropzone-mask").appendTo(this.$dropzone),this.fileInput=document.createElement("input"),this.fileInput.setAttribute("type","file"),this.fileInput.setAttribute("multiple","multiple"),this.fileInput.setAttribute("name","files[]"),this.fileInput.classList.add("upload-file-picker"),this.$body.append(this.fileInput),this.$fileList=$(this.$element.data("progress-container")),this.fileListColumnCount=$("thead tr:first th",this.$fileList).length+1,this.filesExtensionsAllowed=this.$element.data("file-allowed"),this.fileDenyPattern=this.$element.data("file-deny-pattern")?new RegExp(this.$element.data("file-deny-pattern"),"i"):null,this.maxFileSize=parseInt(this.$element.data("max-file-size"),10),this.target=this.$element.data("target-folder"),this.reloadUrl=this.$element.data("reload-url"),this.browserCapabilities={fileReader:"undefined"!=typeof FileReader,DnD:"draggable"in document.createElement("span"),Progress:"upload"in new XMLHttpRequest},this.browserCapabilities.DnD?(this.$body.on("dragover",this.dragFileIntoDocument),this.$body.on("dragend",this.dragAborted),this.$body.on("drop",this.ignoreDrop),this.$dropzone.on("dragenter",this.fileInDropzone),this.$dropzoneMask.on("dragenter",this.fileInDropzone),this.$dropzoneMask.on("dragleave",this.fileOutOfDropzone),this.$dropzoneMask.on("drop",e=>this.handleDrop(e)),this.$dropzone.prepend('<button type="button" class="dropzone-hint" aria-labelledby="dropzone-title"><div class="dropzone-hint-media"><div class="dropzone-hint-icon"></div></div><div class="dropzone-hint-body"><h3 id="dropzone-title" class="dropzone-hint-title">'+TYPO3.lang["file_upload.dropzonehint.title"]+'</h3><p class="dropzone-hint-message">'+TYPO3.lang["file_upload.dropzonehint.message"]+"</p></div></div>").on("click",()=>{this.fileInput.click()}),$('<button type="button" />').addClass("dropzone-close").attr("aria-label",TYPO3.lang["file_upload.dropzone.close"]).on("click",this.hideDropzone).appendTo(this.$dropzone),0===this.$fileList.length&&(this.$fileList=$("<table />").attr("id","typo3-filelist").addClass("table table-striped table-hover upload-queue").html("<tbody></tbody>").hide(),this.dropZoneInsertBefore?this.$fileList.insertAfter(this.$dropzone):this.$fileList.insertBefore(this.$dropzone),this.fileListColumnCount=8,this.manualTable=!0),this.fileInput.addEventListener("change",e=>{this.hideDropzone(e),this.processFiles(Array.apply(null,this.fileInput.files))}),document.addEventListener("keydown",e=>{"Escape"===e.code&&this.$dropzone.is(":visible")&&!this.manualTable&&this.hideDropzone(e)}),this.bindUploadButton(!0===t?this.$trigger:this.$element)):console.warn("Browser has no Drag and drop capabilities; cannot initialize DragUploader")}showDropzone(){this.$dropzone.show()}processFiles(e){this.queueLength=e.length,this.$fileList.is(":visible")||(this.$fileList.show(),this.$fileList.closest(".t3-filelist-table-container")?.removeClass("hidden"),this.$fileList.closest("form")?.find(".t3-filelist-info-container")?.hide()),NProgress.start(),this.percentagePerFile=1/e.length;const t=[];Array.from(e).forEach(e=>{const i=new AjaxRequest(TYPO3.settings.ajaxUrls.file_exists).withQueryArguments({fileName:e.name,fileTarget:this.target}).get({cache:"no-cache"}).then(async t=>{const i=await t.resolve();void 0!==i.uid?(this.askForOverride.push({original:i,uploaded:e,action:this.irreObjectUid?Action.USE_EXISTING:this.defaultAction}),NProgress.inc(this.percentagePerFile)):new FileQueueItem(this,e,Action.SKIP)});t.push(i)}),Promise.all(t).then(()=>{this.drawOverrideModal(),NProgress.done()}),this.fileInput.value=""}bindUploadButton(e){e.on("click",e=>{e.preventDefault(),this.fileInput.click(),this.showDropzone(),this.manuallyTriggered=!0})}decrementQueueLength(){this.queueLength>0&&(this.queueLength--,0===this.queueLength&&new AjaxRequest(TYPO3.settings.ajaxUrls.flashmessages_render).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();for(let e of t)Notification.showMessage(e.title,e.message,e.severity);this.reloadUrl&&!this.manualTable&&setTimeout(()=>{Notification.info(TYPO3.lang["file_upload.reload.filelist"],TYPO3.lang["file_upload.reload.filelist.message"],10,[{label:TYPO3.lang["file_upload.reload.filelist.actions.dismiss"]},{label:TYPO3.lang["file_upload.reload.filelist.actions.reload"],action:new ImmediateAction(()=>{top.list_frame.document.location.href=this.reloadUrl})}])},5e3)}))}drawOverrideModal(){const e=Object.keys(this.askForOverride).length;if(0===e)return;const t=$("<div/>").append($("<p/>").text(TYPO3.lang["file_upload.existingfiles.description"]),$("<table/>",{class:"table"}).append($("<thead/>").append($("<tr />").append($("<th/>"),$("<th/>").text(TYPO3.lang["file_upload.header.originalFile"]),$("<th/>").text(TYPO3.lang["file_upload.header.uploadedFile"]),$("<th/>").text(TYPO3.lang["file_upload.header.action"])))));for(let i=0;i<e;++i){const e=$("<tr />").append($("<td />").append(""!==this.askForOverride[i].original.thumbUrl?$("<img />",{src:this.askForOverride[i].original.thumbUrl,height:40}):$(this.askForOverride[i].original.icon)),$("<td />").html(this.askForOverride[i].original.name+" ("+DragUploader.fileSizeAsString(this.askForOverride[i].original.size)+")<br>"+moment(this.askForOverride[i].original.mtime).format("YYYY-MM-DD HH:mm")),$("<td />").html(this.askForOverride[i].uploaded.name+" ("+DragUploader.fileSizeAsString(this.askForOverride[i].uploaded.size)+")<br>"+moment(this.askForOverride[i].uploaded.lastModified?this.askForOverride[i].uploaded.lastModified:this.askForOverride[i].uploaded.lastModifiedDate).format("YYYY-MM-DD HH:mm")),$("<td />").append($("<select />",{class:"form-select t3js-actions","data-override":i}).append(this.irreObjectUid?$("<option/>").val(Action.USE_EXISTING).text(TYPO3.lang["file_upload.actions.use_existing"]):"",$("<option />",{selected:this.defaultAction===Action.SKIP}).val(Action.SKIP).text(TYPO3.lang["file_upload.actions.skip"]),$("<option />",{selected:this.defaultAction===Action.RENAME}).val(Action.RENAME).text(TYPO3.lang["file_upload.actions.rename"]),$("<option />",{selected:this.defaultAction===Action.OVERRIDE}).val(Action.OVERRIDE).text(TYPO3.lang["file_upload.actions.override"]))));t.find("table").append("<tbody />").append(e)}const i=Modal.confirm(TYPO3.lang["file_upload.existingfiles.title"],t,SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["file_upload.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["file_upload.button.continue"]||"Continue with selected actions",btnClass:"btn-warning",name:"continue"}],["modal-inner-scroll"]);i.find(".modal-dialog").addClass("modal-lg"),i.find(".modal-footer").prepend($("<span/>").addClass("form-inline").append($("<label/>").text(TYPO3.lang["file_upload.actions.all.label"]),$("<select/>",{class:"form-select t3js-actions-all"}).append($("<option/>").val("").text(TYPO3.lang["file_upload.actions.all.empty"]),this.irreObjectUid?$("<option/>").val(Action.USE_EXISTING).text(TYPO3.lang["file_upload.actions.all.use_existing"]):"",$("<option/>",{selected:this.defaultAction===Action.SKIP}).val(Action.SKIP).text(TYPO3.lang["file_upload.actions.all.skip"]),$("<option/>",{selected:this.defaultAction===Action.RENAME}).val(Action.RENAME).text(TYPO3.lang["file_upload.actions.all.rename"]),$("<option/>",{selected:this.defaultAction===Action.OVERRIDE}).val(Action.OVERRIDE).text(TYPO3.lang["file_upload.actions.all.override"]))));const s=this;i.on("change",".t3js-actions-all",(function(){const e=$(this).val();""!==e?i.find(".t3js-actions").each((t,i)=>{const o=$(i),a=parseInt(o.data("override"),10);o.val(e).prop("disabled","disabled"),s.askForOverride[a].action=o.val()}):i.find(".t3js-actions").removeProp("disabled")})).on("change",".t3js-actions",(function(){const e=$(this),t=parseInt(e.data("override"),10);s.askForOverride[t].action=e.val()})).on("button.clicked",(function(e){"cancel"===e.target.name?(s.askForOverride=[],Modal.dismiss()):"continue"===e.target.name&&($.each(s.askForOverride,(e,t)=>{t.action===Action.USE_EXISTING?DragUploader.addFileToIrre(s.irreObjectUid,t.original):t.action!==Action.SKIP&&new FileQueueItem(s,t.uploaded,t.action)}),s.askForOverride=[],Modal.dismiss())})).on("hidden.bs.modal",()=>{this.askForOverride=[]})}}class FileQueueItem{constructor(e,t,i){if(this.dragUploader=e,this.file=t,this.override=i,this.$row=$("<tr />").addClass("upload-queue-item uploading"),this.dragUploader.manualTable||(this.$selector=$("<td />").addClass("col-selector").appendTo(this.$row)),this.$iconCol=$("<td />").addClass("col-icon").appendTo(this.$row),this.$fileName=$("<td />").text(t.name).appendTo(this.$row),this.$progress=$("<td />").attr("colspan",this.dragUploader.fileListColumnCount-this.$row.find("td").length).appendTo(this.$row),this.$progressContainer=$("<div />").addClass("upload-queue-progress").appendTo(this.$progress),this.$progressBar=$("<div />").addClass("upload-queue-progress-bar").appendTo(this.$progressContainer),this.$progressPercentage=$("<span />").addClass("upload-queue-progress-percentage").appendTo(this.$progressContainer),this.$progressMessage=$("<span />").addClass("upload-queue-progress-message").appendTo(this.$progressContainer),0===$("tbody tr.upload-queue-item",this.dragUploader.$fileList).length?(this.$row.prependTo($("tbody",this.dragUploader.$fileList)),this.$row.addClass("last")):this.$row.insertBefore($("tbody tr.upload-queue-item:first",this.dragUploader.$fileList)),this.$selector&&this.$selector.html('<span class="form-check form-toggle"><input type="checkbox" class="form-check-input t3js-multi-record-selection-check" disabled/></span>'),this.$iconCol.html('<span class="t3-icon t3-icon-mimetypes t3-icon-other-other"> </span>'),this.dragUploader.maxFileSize>0&&this.file.size>this.dragUploader.maxFileSize)this.updateMessage(TYPO3.lang["file_upload.maxFileSizeExceeded"].replace(/\{0\}/g,this.file.name).replace(/\{1\}/g,DragUploader.fileSizeAsString(this.dragUploader.maxFileSize))),this.$row.addClass("error");else if(this.dragUploader.fileDenyPattern&&this.file.name.match(this.dragUploader.fileDenyPattern))this.updateMessage(TYPO3.lang["file_upload.fileNotAllowed"].replace(/\{0\}/g,this.file.name)),this.$row.addClass("error");else if(this.checkAllowedExtensions()){this.updateMessage("- "+DragUploader.fileSizeAsString(this.file.size));const e=new FormData;e.append("data[upload][1][target]",this.dragUploader.target),e.append("data[upload][1][data]","1"),e.append("overwriteExistingFiles",this.override),e.append("redirect",""),e.append("upload_1",this.file);const t=new XMLHttpRequest;t.onreadystatechange=()=>{if(t.readyState===XMLHttpRequest.DONE)if(200===t.status)try{this.uploadSuccess(JSON.parse(t.responseText))}catch(e){this.uploadError(t)}else this.uploadError(t)},t.upload.addEventListener("progress",e=>this.updateProgress(e)),t.open("POST",TYPO3.settings.ajaxUrls.file_process),t.send(e)}else this.updateMessage(TYPO3.lang["file_upload.fileExtensionExpected"].replace(/\{0\}/g,this.dragUploader.filesExtensionsAllowed)),this.$row.addClass("error")}updateMessage(e){this.$progressMessage.text(e)}removeProgress(){this.$progress&&this.$progress.remove()}uploadStart(){this.$progressPercentage.text("(0%)"),this.$progressBar.width("1%"),this.dragUploader.$trigger.trigger("uploadStart",[this])}uploadError(e){this.updateMessage(TYPO3.lang["file_upload.uploadFailed"].replace(/\{0\}/g,this.file.name));const t=$(e.responseText);t.is("t3err")?this.$progressPercentage.text(t.text()):e.statusText?this.$progressPercentage.text("("+e.statusText+") "):this.$progressPercentage.text(""),this.$row.addClass("error"),this.dragUploader.decrementQueueLength(),this.dragUploader.$trigger.trigger("uploadError",[this,e])}updateProgress(e){const t=Math.round(e.loaded/e.total*100)+"%";this.$progressBar.outerWidth(t),this.$progressPercentage.text(t),this.dragUploader.$trigger.trigger("updateProgress",[this,t,e])}uploadSuccess(e){if(e.upload){this.dragUploader.decrementQueueLength(),this.$row.removeClass("uploading"),this.$row.prop("data-type","file"),this.$row.prop("data-file-uid",e.upload[0].uid),this.$fileName.text(e.upload[0].name),this.$progressPercentage.text(""),this.$progressMessage.text("100%"),this.$progressBar.outerWidth("100%");const t=String(e.upload[0].id);if(this.$selector){const e=this.$selector.find("input")?.get(0);e&&(e.removeAttribute("disabled"),e.setAttribute("name","CBC[_FILE|"+Md5.hash(t)+"]"),e.setAttribute("value",t))}e.upload[0].icon&&this.$iconCol.html('<a href="#" class="t3js-contextmenutrigger" data-uid="'+t+'" data-table="sys_file">'+e.upload[0].icon+" </span></a>"),this.dragUploader.irreObjectUid?(DragUploader.addFileToIrre(this.dragUploader.irreObjectUid,e.upload[0]),setTimeout(()=>{this.$row.remove(),0===$("tr",this.dragUploader.$fileList).length&&(this.dragUploader.$fileList.hide(),this.dragUploader.$fileList.closest(".t3-filelist-table-container")?.addClass("hidden"),this.dragUploader.$trigger.trigger("uploadSuccess",[this,e]))},3e3)):setTimeout(()=>{this.showFileInfo(e.upload[0]),this.dragUploader.$trigger.trigger("uploadSuccess",[this,e])},3e3)}}showFileInfo(e){this.removeProgress(),document.querySelector("#search_field")?.value&&$("<td />").text(e.path).appendTo(this.$row),$("<td />").text("").appendTo(this.$row),$("<td />").text(TYPO3.lang["type.file"]+" ("+e.extension.toUpperCase()+")").appendTo(this.$row),$("<td />").text(DragUploader.fileSizeAsString(e.size)).appendTo(this.$row);let t="";e.permissions.read&&(t+='<strong class="text-danger">'+TYPO3.lang["permissions.read"]+"</strong>"),e.permissions.write&&(t+='<strong class="text-danger">'+TYPO3.lang["permissions.write"]+"</strong>"),$("<td />").html(t).appendTo(this.$row),$("<td />").text("-").appendTo(this.$row);for(let e=this.$row.find("td").length;e<this.dragUploader.fileListColumnCount;e++)$("<td />").text("").appendTo(this.$row)}checkAllowedExtensions(){if(!this.dragUploader.filesExtensionsAllowed)return!0;const e=this.file.name.split(".").pop(),t=this.dragUploader.filesExtensionsAllowed.split(",");return-1!==$.inArray(e.toLowerCase(),t)}}class DragUploader{static fileSizeAsString(e){const t=e/1024;let i="";return i=t>1024?(t/1024).toFixed(1)+" MB":t.toFixed(1)+" KB",i}static addFileToIrre(e,t){const i={actionName:"typo3:foreignRelation:insert",objectGroup:e,table:"sys_file",uid:t.uid};MessageUtility.send(i)}static init(){const e=this.options;$.fn.extend({dragUploader:function(e){return this.each((t,i)=>{const s=$(i);let o=s.data("DragUploaderPlugin");o||s.data("DragUploaderPlugin",o=new DragUploaderPlugin(i)),"string"==typeof e&&o[e]()})}}),$(()=>{$(".t3js-drag-uploader").dragUploader(e)})}}export const initialize=function(){DragUploader.init(),void 0!==TYPO3.settings&&void 0!==TYPO3.settings.RequireJS&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"]&&$.each(TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"],(e,t)=>{window.require([t])})};DragUploader.init(),void 0!==TYPO3.settings&&void 0!==TYPO3.settings.RequireJS&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"]&&$.each(TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/DragUploader"],(e,t)=>{window.require([t])}); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Element/IconElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/element/icon-element.js similarity index 95% rename from typo3/sysext/backend/Resources/Public/JavaScript/Element/IconElement.js rename to typo3/sysext/backend/Resources/Public/JavaScript/element/icon-element.js index f25cdefd4fda293c25a6ec59051bbc2baadc18a6..01bb2db1f51d82e2bb643ea623b29fd0de626625 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Element/IconElement.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/element/icon-element.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(e,t,i,o){var n,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(r<3?n(s):r>3?n(t,i,s):n(t,i))||s);return r>3&&s&&Object.defineProperty(t,i,s),s};import{html,css,unsafeCSS,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{until}from"lit/directives/until.js";import{Sizes,States,MarkupIdentifiers}from"TYPO3/CMS/Backend/Enum/IconTypes.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import"TYPO3/CMS/Backend/Element/SpinnerElement.js";const iconUnifyModifier=.86,iconSize=(e,t)=>css` +var __decorate=function(e,t,i,o){var n,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(s=(r<3?n(s):r>3?n(t,i,s):n(t,i))||s);return r>3&&s&&Object.defineProperty(t,i,s),s};import{html,css,unsafeCSS,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{until}from"lit/directives/until.js";import{Sizes,States,MarkupIdentifiers}from"@typo3/backend/enum/icon-types.js";import Icons from"@typo3/backend/icons.js";import"@typo3/backend/element/spinner-element.js";const iconUnifyModifier=.86,iconSize=(e,t)=>css` :host([size=${e}]), :host([raw]) .icon-size-${e} { font-size: ${t}px; diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/element/immediate-action-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/element/immediate-action-element.js new file mode 100644 index 0000000000000000000000000000000000000000..9fb55a325a6b1e5c2635c8699708f73add8fdd1a --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/element/immediate-action-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Utility from"@typo3/backend/utility.js";import{EventDispatcher}from"@typo3/backend/event/event-dispatcher.js";export class ImmediateActionElement extends HTMLElement{constructor(){super(...arguments),this.args=[]}static async getDelegate(t){switch(t){case"TYPO3.ModuleMenu.App.refreshMenu":const{default:e}=await import("@typo3/backend/module-menu.js");return e.App.refreshMenu.bind(e.App);case"TYPO3.Backend.Topbar.refresh":const{default:a}=await import("@typo3/backend/viewport.js");return a.Topbar.refresh.bind(a.Topbar);case"TYPO3.WindowManager.localOpen":const{default:r}=await import("@typo3/backend/window-manager.js");return r.localOpen.bind(r);case"TYPO3.Backend.Storage.ModuleStateStorage.update":return(await import("@typo3/backend/storage/module-state-storage.js")).ModuleStateStorage.update;case"TYPO3.Backend.Storage.ModuleStateStorage.updateWithCurrentMount":return(await import("@typo3/backend/storage/module-state-storage.js")).ModuleStateStorage.updateWithCurrentMount;case"TYPO3.Backend.Event.EventDispatcher.dispatchCustomEvent":return EventDispatcher.dispatchCustomEvent;default:throw Error('Unknown action "'+t+'"')}}static get observedAttributes(){return["action","args","args-list"]}attributeChangedCallback(t,e,a){if("action"===t)this.action=a;else if("args"===t){const t=a.replace(/"/g,'"'),e=JSON.parse(t);this.args=e instanceof Array?Utility.trimItems(e):[]}else if("args-list"===t){const t=a.split(",");this.args=Utility.trimItems(t)}}connectedCallback(){if(!this.action)throw new Error("Missing mandatory action attribute");ImmediateActionElement.getDelegate(this.action).then(t=>t.apply(null,this.args))}}window.customElements.define("typo3-immediate-action",ImmediateActionElement); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Element/SpinnerElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/element/spinner-element.js similarity index 90% rename from typo3/sysext/backend/Resources/Public/JavaScript/Element/SpinnerElement.js rename to typo3/sysext/backend/Resources/Public/JavaScript/element/spinner-element.js index b64c17ace81c0de214e759c978585ca3f9fcbd27..e0c39f4d8a392fb9ff46363047e500ff2f1c0add 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Element/SpinnerElement.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/element/spinner-element.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var Variant,__decorate=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};import{html,css,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{Sizes}from"TYPO3/CMS/Backend/Enum/IconTypes.js";!function(e){e.light="light",e.dark="dark"}(Variant||(Variant={}));let SpinnerElement=class extends LitElement{constructor(){super(...arguments),this.size=Sizes.default,this.variant=Variant.dark}render(){return html` +var Variant,__decorate=function(e,t,i,r){var n,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,i,a):n(t,i))||a);return o>3&&a&&Object.defineProperty(t,i,a),a};import{html,css,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{Sizes}from"@typo3/backend/enum/icon-types.js";!function(e){e.light="light",e.dark="dark"}(Variant||(Variant={}));let SpinnerElement=class extends LitElement{constructor(){super(...arguments),this.size=Sizes.default,this.variant=Variant.dark}render(){return html` <div class="icon"> <svg viewBox="0 0 16 16"> <path d="M8 15c-3.86 0-7-3.141-7-7 0-3.86 3.14-7 7-7 3.859 0 7 3.14 7 7 0 3.859-3.141 7-7 7zM8 3C5.243 3 3 5.243 3 8s2.243 5 5 5 5-2.243 5-5 -2.243-5-5-5z" opacity=".3"/> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Element/TableWizardElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/element/table-wizard-element.js similarity index 79% rename from typo3/sysext/backend/Resources/Public/JavaScript/Element/TableWizardElement.js rename to typo3/sysext/backend/Resources/Public/JavaScript/element/table-wizard-element.js index cffa02a43c15065abbb4c7c543ec0f25b4e921e8..f1393056ce2b0cf246aa77db32c431fdb72d1482 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Element/TableWizardElement.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/element/table-wizard-element.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(t,e,l,a){var o,n=arguments.length,i=n<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,l):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,l,a);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(n<3?o(i):n>3?o(e,l,i):o(e,l))||i);return n>3&&i&&Object.defineProperty(e,l,i),i};import{html,LitElement,render}from"lit";import{customElement,property}from"lit/decorators.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";import"TYPO3/CMS/Backend/Element/IconElement.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";let TableWizardElement=class extends LitElement{constructor(){super(),this.type="textarea",this.selectorData="",this.appendRows=1,this.l10n={},this.table=[],this.selectorData=this.getAttribute("selector"),this.readTableFromTextarea()}get firstRow(){return this.table[0]||[]}createRenderRoot(){return this}render(){return this.renderTemplate()}provideMinimalTable(){0!==this.table.length&&0!==this.firstRow.length||(this.table=[[""]])}readTableFromTextarea(){let t=document.querySelector(this.selectorData),e=[];t.value.split("\n").forEach(t=>{if(""!==t){let l=t.split("|");e.push(l)}}),this.table=e}writeTableSyntaxToTextarea(){let t=document.querySelector(this.selectorData),e="";this.table.forEach(t=>{e+=t.join("|")+"\n"}),t.value=e}modifyTable(t,e,l){const a=t.target;this.table[e][l]=a.value,this.writeTableSyntaxToTextarea(),this.requestUpdate()}toggleType(t){this.type="input"===this.type?"textarea":"input"}moveColumn(t,e,l){this.table=this.table.map(t=>{const a=t.splice(e,1);return t.splice(l,0,...a),t}),this.writeTableSyntaxToTextarea(),this.requestUpdate()}appendColumn(t,e){this.table=this.table.map(t=>(t.splice(e+1,0,""),t)),this.writeTableSyntaxToTextarea(),this.requestUpdate()}removeColumn(t,e){this.table=this.table.map(t=>(t.splice(e,1),t)),this.writeTableSyntaxToTextarea(),this.requestUpdate()}moveRow(t,e,l){const a=this.table.splice(e,1);this.table.splice(l,0,...a),this.writeTableSyntaxToTextarea(),this.requestUpdate()}appendRow(t,e){let l=this.firstRow.concat().fill(""),a=new Array(this.appendRows).fill(l);this.table.splice(e+1,0,...a),this.writeTableSyntaxToTextarea(),this.requestUpdate()}removeRow(t,e){this.table.splice(e,1),this.writeTableSyntaxToTextarea(),this.requestUpdate()}renderTemplate(){this.provideMinimalTable();const t=Object.keys(this.firstRow).map(t=>parseInt(t,10)),e=t[t.length-1],l=this.table.length-1;return html` +var __decorate=function(t,e,l,a){var o,n=arguments.length,i=n<3?e:null===a?a=Object.getOwnPropertyDescriptor(e,l):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,l,a);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(i=(n<3?o(i):n>3?o(e,l,i):o(e,l))||i);return n>3&&i&&Object.defineProperty(e,l,i),i};import{html,LitElement,render}from"lit";import{customElement,property}from"lit/decorators.js";import{lll}from"@typo3/core/lit-helper.js";import"@typo3/backend/element/icon-element.js";import Severity from"@typo3/backend/severity.js";import Modal from"@typo3/backend/modal.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";let TableWizardElement=class extends LitElement{constructor(){super(),this.type="textarea",this.selectorData="",this.appendRows=1,this.l10n={},this.table=[],this.selectorData=this.getAttribute("selector"),this.readTableFromTextarea()}get firstRow(){return this.table[0]||[]}createRenderRoot(){return this}render(){return this.renderTemplate()}provideMinimalTable(){0!==this.table.length&&0!==this.firstRow.length||(this.table=[[""]])}readTableFromTextarea(){let t=document.querySelector(this.selectorData),e=[];t.value.split("\n").forEach(t=>{if(""!==t){let l=t.split("|");e.push(l)}}),this.table=e}writeTableSyntaxToTextarea(){let t=document.querySelector(this.selectorData),e="";this.table.forEach(t=>{e+=t.join("|")+"\n"}),t.value=e}modifyTable(t,e,l){const a=t.target;this.table[e][l]=a.value,this.writeTableSyntaxToTextarea(),this.requestUpdate()}toggleType(t){this.type="input"===this.type?"textarea":"input"}moveColumn(t,e,l){this.table=this.table.map(t=>{const a=t.splice(e,1);return t.splice(l,0,...a),t}),this.writeTableSyntaxToTextarea(),this.requestUpdate()}appendColumn(t,e){this.table=this.table.map(t=>(t.splice(e+1,0,""),t)),this.writeTableSyntaxToTextarea(),this.requestUpdate()}removeColumn(t,e){this.table=this.table.map(t=>(t.splice(e,1),t)),this.writeTableSyntaxToTextarea(),this.requestUpdate()}moveRow(t,e,l){const a=this.table.splice(e,1);this.table.splice(l,0,...a),this.writeTableSyntaxToTextarea(),this.requestUpdate()}appendRow(t,e){let l=this.firstRow.concat().fill(""),a=new Array(this.appendRows).fill(l);this.table.splice(e+1,0,...a),this.writeTableSyntaxToTextarea(),this.requestUpdate()}removeRow(t,e){this.table.splice(e,1),this.writeTableSyntaxToTextarea(),this.requestUpdate()}renderTemplate(){this.provideMinimalTable();const t=Object.keys(this.firstRow).map(t=>parseInt(t,10)),e=t[t.length-1],l=this.table.length-1;return html` <style> :host, typo3-backend-table-wizard { display: inline-block; } </style> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Enum/IconTypes.js b/typo3/sysext/backend/Resources/Public/JavaScript/enum/icon-types.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Enum/IconTypes.js rename to typo3/sysext/backend/Resources/Public/JavaScript/enum/icon-types.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Enum/KeyTypes.js b/typo3/sysext/backend/Resources/Public/JavaScript/enum/key-types.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Enum/KeyTypes.js rename to typo3/sysext/backend/Resources/Public/JavaScript/enum/key-types.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Enum/Severity.js b/typo3/sysext/backend/Resources/Public/JavaScript/enum/severity.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Enum/Severity.js rename to typo3/sysext/backend/Resources/Public/JavaScript/enum/severity.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Enum/Viewport/ScaffoldIdentifier.js b/typo3/sysext/backend/Resources/Public/JavaScript/enum/viewport/scaffold-identifier.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Enum/Viewport/ScaffoldIdentifier.js rename to typo3/sysext/backend/Resources/Public/JavaScript/enum/viewport/scaffold-identifier.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/AbstractContainer.js b/typo3/sysext/backend/Resources/Public/JavaScript/event/client-request.js similarity index 67% rename from typo3/sysext/backend/Resources/Public/JavaScript/Viewport/AbstractContainer.js rename to typo3/sysext/backend/Resources/Public/JavaScript/event/client-request.js index 5faeab0652e8bdb802c41f1baf65f4c3cf2eed7f..01e7e8b04aa7d4716c927bd128914637e59007f8 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/AbstractContainer.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/event/client-request.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -import ConsumerScope from"TYPO3/CMS/Backend/Event/ConsumerScope.js";export class AbstractContainer{constructor(o){this.consumerScope=ConsumerScope,this.consumerScope=o}} \ No newline at end of file +import InteractionRequest from"@typo3/backend/event/interaction-request.js";class ClientRequest extends InteractionRequest{constructor(e,t=null){super(e),this.clientEvent=t}}export default ClientRequest; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Event/Consumable.js b/typo3/sysext/backend/Resources/Public/JavaScript/event/consumable.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Event/Consumable.js rename to typo3/sysext/backend/Resources/Public/JavaScript/event/consumable.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Event/ConsumerScope.js b/typo3/sysext/backend/Resources/Public/JavaScript/event/consumer-scope.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Event/ConsumerScope.js rename to typo3/sysext/backend/Resources/Public/JavaScript/event/consumer-scope.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Event/EventDispatcher.js b/typo3/sysext/backend/Resources/Public/JavaScript/event/event-dispatcher.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Event/EventDispatcher.js rename to typo3/sysext/backend/Resources/Public/JavaScript/event/event-dispatcher.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Event/InteractionRequestAssignment.js b/typo3/sysext/backend/Resources/Public/JavaScript/event/interaction-request-assignment.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Event/InteractionRequestAssignment.js rename to typo3/sysext/backend/Resources/Public/JavaScript/event/interaction-request-assignment.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Event/InteractionRequestMap.js b/typo3/sysext/backend/Resources/Public/JavaScript/event/interaction-request-map.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Event/InteractionRequestMap.js rename to typo3/sysext/backend/Resources/Public/JavaScript/event/interaction-request-map.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Event/InteractionRequest.js b/typo3/sysext/backend/Resources/Public/JavaScript/event/interaction-request.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Event/InteractionRequest.js rename to typo3/sysext/backend/Resources/Public/JavaScript/event/interaction-request.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/event/trigger-request.js b/typo3/sysext/backend/Resources/Public/JavaScript/event/trigger-request.js new file mode 100644 index 0000000000000000000000000000000000000000..76ca93808501f18e155f8c4682ad1c563144d3e1 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/event/trigger-request.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import InteractionRequest from"@typo3/backend/event/interaction-request.js";class TriggerRequest extends InteractionRequest{constructor(e,t=null){super(e,t)}concerns(e){if(this===e)return!0;let t=this;for(;t.parentRequest instanceof InteractionRequest;)if(t=t.parentRequest,t===e)return!0;return!1}concernsTypes(e){if(e.includes(this.type))return!0;let t=this;for(;t.parentRequest instanceof InteractionRequest;)if(t=t.parentRequest,e.includes(t.type))return!0;return!1}}export default TriggerRequest; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-link-browser-adapter.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-link-browser-adapter.js new file mode 100644 index 0000000000000000000000000000000000000000..0489b40e0226351e9b721de62844a8a9331aeb49 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-link-browser-adapter.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import LinkBrowser from"@typo3/recordlist/link-browser.js";import Modal from"@typo3/backend/modal.js";export default(function(){const e={onFieldChangeItems:null,setOnFieldChangeItems:function(n){e.onFieldChangeItems=n},checkReference:function(){const n='form[name="'+LinkBrowser.parameters.formName+'"] [data-formengine-input-name="'+LinkBrowser.parameters.itemName+'"]',t=e.getParent();if(t&&t.document&&t.document.querySelector(n))return t.document.querySelector(n);Modal.dismiss()}};return LinkBrowser.finalizeFunction=function(n){const t=e.checkReference();if(t){const r=LinkBrowser.getLinkAttributeValues();r.url=n,$.ajax({url:TYPO3.settings.ajaxUrls.link_browser_encodetypolink,data:r,method:"GET"}).done((function(n){n.typoLink&&(t.value=n.typoLink,t.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})),e.onFieldChangeItems instanceof Array&&e.getParent().TYPO3.FormEngine.processOnFieldChange(e.onFieldChangeItems),Modal.dismiss())}))}},e.getParent=function(){let e;return void 0!==window.parent&&void 0!==window.parent.document.list_frame&&null!==window.parent.document.list_frame.parent.document.querySelector(".t3js-modal-iframe")?e=window.parent.document.list_frame:void 0!==window.parent&&void 0!==window.parent.frames.list_frame&&null!==window.parent.frames.list_frame.parent.document.querySelector(".t3js-modal-iframe")?e=window.parent.frames.list_frame:void 0!==window.frames&&void 0!==window.frames.frameElement&&null!==window.frames.frameElement&&window.frames.frameElement.classList.contains("t3js-modal-iframe")?e=window.frames.frameElement.contentWindow.parent:window.opener&&(e=window.opener),e},e}()); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-review.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-review.js new file mode 100644 index 0000000000000000000000000000000000000000..8bd058155769d74f95bf891638a953347e3b4a65 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-review.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import FormEngine from"@typo3/backend/form-engine.js";class FormEngineReview{constructor(){this.checkForReviewableField=()=>{const t=this,e=FormEngineReview.findInvalidField(),i=$("."+this.toggleButtonClass);if(e.length>0){const n=$("<div />",{class:"list-group"});e.each((function(){const e=$(this),i=e.find("[data-formengine-validation-rules]");let o=i.attr("id");void 0===o&&(o=i.parent().children("[id]").first().attr("id")),n.append($("<a />",{class:"list-group-item "+t.fieldListItemClass,"data-field-id":o,href:"#"}).text(e.find(t.labelSelector).text()))})),i.removeClass("hidden");const o=i.data("bs.popover");o&&(o.options.html=!0,o.options.content=n.wrapAll("<div>").parent().html(),o.setContent(o.$tip),o.$tip.addClass(o.options.placement))}else i.addClass("hidden").popover("hide")},this.switchToField=t=>{t.preventDefault();const e=$(t.currentTarget).data("fieldId"),i=$("#"+e);i.parents('[id][role="tabpanel"]').each((function(){$('[aria-controls="'+$(this).attr("id")+'"]').tab("show")})),i.focus()},this.toggleButtonClass="t3js-toggle-review-panel",this.fieldListItemClass="t3js-field-item",this.labelSelector=".t3js-formengine-label",this.initialize()}static findInvalidField(){return $(document).find(".tab-content ."+FormEngine.Validation.errorClass)}static attachButtonToModuleHeader(t){const e=$(".t3js-module-docheader-bar-buttons").children().last().find('[role="toolbar"]'),i=$("<a />",{class:"btn btn-danger btn-sm hidden "+t.toggleButtonClass,href:"#",title:TYPO3.lang["buttons.reviewFailedValidationFields"]}).append($("<span />",{class:"fa fa-fw fa-info"}));i.popover({container:"body",html:!0,placement:"bottom"}),e.prepend(i)}initialize(){const t=this,e=$(document);$(()=>{FormEngineReview.attachButtonToModuleHeader(t)}),e.on("click","."+this.fieldListItemClass,this.switchToField),e.on("t3-formengine-postfieldvalidation",this.checkForReviewableField)}}export default new FormEngineReview; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-suggest.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-suggest.js new file mode 100644 index 0000000000000000000000000000000000000000..a65ce37326ce62c406e8bd4abdffd57b56275b1b --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-suggest.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import"jquery/autocomplete.js";import FormEngine from"@typo3/backend/form-engine.js";class FormEngineSuggest{constructor(e){$(()=>{this.initialize(e)})}initialize(e){const t=e.closest(".t3-form-suggest-container"),a=e.dataset.tablename,o=e.dataset.fieldname,n=e.dataset.field,s=parseInt(e.dataset.uid,10),i=parseInt(e.dataset.pid,10),r=e.dataset.datastructureidentifier,l=e.dataset.flexformsheetname,d=e.dataset.flexformfieldname,m=e.dataset.flexformcontainername,u=e.dataset.flexformcontainerfieldname,c=parseInt(e.dataset.minchars,10),p=TYPO3.settings.ajaxUrls.record_suggest,f={tableName:a,fieldName:o,uid:s,pid:i,dataStructureIdentifier:r,flexFormSheetName:l,flexFormFieldName:d,flexFormContainerName:m,flexFormContainerFieldName:u};$(e).autocomplete({serviceUrl:p,params:f,type:"POST",paramName:"value",dataType:"json",minChars:c,groupBy:"typeLabel",containerClass:"autocomplete-results",appendTo:t,forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,noSuggestionNotice:'<div class="autocomplete-info">No results</div>',minLength:c,preventBadQueries:!1,transformResult:e=>({suggestions:e.map(e=>({value:e.text,data:e}))}),formatResult:e=>$("<div>").append($('<a class="autocomplete-suggestion-link" href="#">'+e.data.sprite+e.data.text+"</a></div>").attr({"data-label":e.data.label,"data-table":e.data.table,"data-uid":e.data.uid})).html(),onSearchComplete:function(){t.classList.add("open")},beforeRender:function(e){e.attr("style",""),t.classList.add("open")},onHide:function(){t.classList.remove("open")},onSelect:function(){!function(t){let a="";a="select"===e.dataset.fieldtype?t.dataset.uid:t.dataset.table+"_"+t.dataset.uid,FormEngine.setSelectOptionFromExternalSource(n,a,t.dataset.label,t.dataset.label),FormEngine.Validation.markFieldAsChanged($(document.querySelector('input[name="'+n+'"]')))}(t.querySelector(".autocomplete-selected a"))}})}}export default FormEngineSuggest; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-validation.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-validation.js new file mode 100644 index 0000000000000000000000000000000000000000..c99cc756beff4734d4822d6ba216b7aefd7381c6 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine-validation.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import moment from"moment";import Md5 from"@typo3/backend/hashing/md5.js";import DocumentSaveActions from"@typo3/backend/document-save-actions.js";import Modal from"@typo3/backend/modal.js";import Severity from"@typo3/backend/severity.js";export default(function(){const FormEngineValidation={rulesSelector:"[data-formengine-validation-rules]",inputSelector:"[data-formengine-input-params]",markerSelector:".t3js-formengine-validation-marker",groupFieldHiddenElement:".t3js-formengine-field-group input[type=hidden]",relatedFieldSelector:"[data-relatedfieldname]",errorClass:"has-error",lastYear:0,lastDate:0,lastTime:0,passwordDummy:"********"},customEvaluations=new Map;return FormEngineValidation.initialize=function(){$(document).find("."+FormEngineValidation.errorClass).removeClass(FormEngineValidation.errorClass),FormEngineValidation.initializeInputFields().promise().done((function(){$(document).on("change",FormEngineValidation.rulesSelector,e=>{FormEngineValidation.validateField(e.currentTarget),FormEngineValidation.markFieldAsChanged(e.currentTarget)}),FormEngineValidation.registerSubmitCallback()}));const e=new Date;FormEngineValidation.lastYear=FormEngineValidation.getYear(e),FormEngineValidation.lastDate=FormEngineValidation.getDate(e),FormEngineValidation.lastTime=0,FormEngineValidation.validate()},FormEngineValidation.initializeInputFields=function(){return $(document).find(FormEngineValidation.inputSelector).each((function(e,n){const t=$(n).data("formengine-input-params"),a=t.field,i=$('[name="'+a+'"]');void 0===i.data("main-field")&&(i.data("main-field",a),i.data("config",t),FormEngineValidation.initializeInputField(a))}))},FormEngineValidation.initializeInputField=function(e){const n=$('[name="'+e+'"]'),t=$('[data-formengine-input-name="'+e+'"]');let a=$('[name="'+n.data("main-field")+'"]');0===a.length&&(a=n);const i=a.data("config");if(void 0!==i){const e=FormEngineValidation.trimExplode(",",i.evalList);let a=n.val();for(let n=0;n<e.length;n++)a=FormEngineValidation.formatValue(e[n],a,i);a.length&&"password"!==t.attr("type")&&t.val(a)}t.data("main-field",e),t.data("config",i),t.on("change",(function(){FormEngineValidation.updateInputField(t.attr("data-formengine-input-name"))})),t.attr("data-formengine-input-initialized","true")},FormEngineValidation.registerCustomEvaluation=function(e,n){customEvaluations.has(e)||customEvaluations.set(e,n)},FormEngineValidation.formatValue=function(e,n,t){let a,i,o="";switch(e){case"date":if(n.toString().indexOf("-")>0){o=moment.utc(n).format("DD-MM-YYYY")}else{if(a=1*n,!a)return"";i=new Date(1e3*a);o=i.getUTCDate().toString(10).padStart(2,"0")+"-"+(i.getUTCMonth()+1).toString(10).padStart(2,"0")+"-"+this.getYear(i)}break;case"datetime":if(n.toString().indexOf("-")<=0&&!("number"==typeof n?n:parseInt(n)))return"";o=FormEngineValidation.formatValue("time",n,t)+" "+FormEngineValidation.formatValue("date",n,t);break;case"time":case"timesec":let r;if(n.toString().indexOf("-")>0)r=moment.utc(n);else{if(a="number"==typeof n?n:parseInt(n),!a&&"0"!==n.toString())return"";r=moment.unix(a).utc()}o="timesec"===e?r.format("HH:mm:ss"):r.format("HH:mm");break;case"password":o=n?FormEngineValidation.passwordDummy:"";break;default:o=n}return o},FormEngineValidation.updateInputField=function(e){const n=$('[name="'+e+'"]');let t=$('[name="'+n.data("main-field")+'"]');0===t.length&&(t=n);const a=$('[data-formengine-input-name="'+t.attr("name")+'"]'),i=t.data("config");if(void 0!==i){const e=FormEngineValidation.trimExplode(",",i.evalList);let n=a.val();for(let t=0;t<e.length;t++)n=FormEngineValidation.processValue(e[t],n,i);let o=n;for(let n=0;n<e.length;n++)o=FormEngineValidation.formatValue(e[n],o,i);t.val(n),t.get(0).dispatchEvent(new Event("change")),a.val(o)}},FormEngineValidation.validateField=function(e,n){const t=e instanceof $?e.get(0):e;if(n=n||t.value||"",void 0===t.dataset.formengineValidationRules)return n;const a=JSON.parse(t.dataset.formengineValidationRules);let i,o,r,l=!1,s=0,m=n;$.isArray(n)||(n=FormEngineValidation.ltrim(n)),$.each(a,(function(e,a){if(l)return!1;switch(a.type){case"required":""===n&&(l=!0,t.closest(FormEngineValidation.markerSelector).classList.add(FormEngineValidation.errorClass));break;case"range":if(""!==n){if((a.minItems||a.maxItems)&&(i=$(document).find('[name="'+t.dataset.relatedfieldname+'"]'),s=i.length?FormEngineValidation.trimExplode(",",i.val()).length:t.value,void 0!==a.minItems&&(o=1*a.minItems,!isNaN(o)&&s<o&&(l=!0)),void 0!==a.maxItems&&(r=1*a.maxItems,!isNaN(r)&&s>r&&(l=!0))),void 0!==a.lower){const e=1*a.lower;!isNaN(e)&&n<e&&(l=!0)}if(void 0!==a.upper){const e=1*a.upper;!isNaN(e)&&n>e&&(l=!0)}}break;case"select":case"category":(a.minItems||a.maxItems)&&(i=$(document).find('[name="'+t.dataset.relatedfieldname+'"]'),s=i.length?FormEngineValidation.trimExplode(",",i.val()).length:t instanceof HTMLSelectElement?t.querySelectorAll("option:checked").length:t.querySelectorAll("input[value]:checked").length,void 0!==a.minItems&&(o=1*a.minItems,!isNaN(o)&&s<o&&(l=!0)),void 0!==a.maxItems&&(r=1*a.maxItems,!isNaN(r)&&s>r&&(l=!0)));break;case"group":case"inline":(a.minItems||a.maxItems)&&(s=FormEngineValidation.trimExplode(",",t.value).length,void 0!==a.minItems&&(o=1*a.minItems,!isNaN(o)&&s<o&&(l=!0)),void 0!==a.maxItems&&(r=1*a.maxItems,!isNaN(r)&&s>r&&(l=!0)))}}));const d=!l;return t.closest(FormEngineValidation.markerSelector).classList.toggle(FormEngineValidation.errorClass,!d),FormEngineValidation.markParentTab($(t),d),$(document).trigger("t3-formengine-postfieldvalidation"),m},FormEngineValidation.processValue=function(e,n,t){let a="",i="",o="",r=0,l=n;switch(e){case"alpha":case"num":case"alphanum":case"alphanum_x":for(a="",r=0;r<n.length;r++){const t=n.substr(r,1);let i="_"===t||"-"===t,o=t>="a"&&t<="z"||t>="A"&&t<="Z",l=t>="0"&&t<="9";switch(e){case"alphanum":i=!1;break;case"alpha":l=!1,i=!1;break;case"num":o=!1,i=!1}(o||l||i)&&(a+=t)}a!==n&&(l=a);break;case"is_in":if(t.is_in){i=""+n,t.is_in=t.is_in.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");const e=new RegExp("[^"+t.is_in+"]+","g");a=i.replace(e,"")}else a=i;l=a;break;case"nospace":l=(""+n).replace(/ /g,"");break;case"md5":""!==n&&(l=Md5.hash(n));break;case"upper":l=n.toUpperCase();break;case"lower":l=n.toLowerCase();break;case"int":""!==n&&(l=FormEngineValidation.parseInt(n));break;case"double2":""!==n&&(l=FormEngineValidation.parseDouble(n));break;case"trim":l=String(n).trim();break;case"datetime":""!==n&&(o=n.substr(0,1),l=FormEngineValidation.parseDateTime(n));break;case"date":""!==n&&(o=n.substr(0,1),l=FormEngineValidation.parseDate(n));break;case"time":case"timesec":""!==n&&(o=n.substr(0,1),l=FormEngineValidation.parseTime(n,e));break;case"year":""!==n&&(o=n.substr(0,1),l=FormEngineValidation.parseYear(n));break;case"null":case"password":break;default:customEvaluations.has(e)?l=customEvaluations.get(e).call(null,n):"object"==typeof TBE_EDITOR&&void 0!==TBE_EDITOR.customEvalFunctions&&"function"==typeof TBE_EDITOR.customEvalFunctions[e]&&(l=TBE_EDITOR.customEvalFunctions[e](n))}return l},FormEngineValidation.validate=function(e){(void 0===e||e instanceof Document)&&$(document).find(FormEngineValidation.markerSelector+", .t3js-tabmenu-item").removeClass(FormEngineValidation.errorClass).removeClass("has-validation-error");const n=e||document;$(n).find(FormEngineValidation.rulesSelector).each((e,n)=>{const t=$(n);if(!t.closest(".t3js-flex-section-deleted, .t3js-inline-record-deleted").length){let e=!1;const n=t.val(),a=FormEngineValidation.validateField(t,n);if($.isArray(a)&&$.isArray(n)){if(a.length!==n.length)e=!0;else for(let t=0;t<a.length;t++)if(a[t]!==n[t]){e=!0;break}}else a.length&&n!==a&&(e=!0);e&&t.val(a)}})},FormEngineValidation.markFieldAsChanged=function(e){if(e instanceof $&&(e=e.get(0)),!(e instanceof HTMLElement))return;e.closest(".t3js-formengine-palette-field").classList.add("has-change")},FormEngineValidation.trimExplode=function(e,n){const t=[],a=n.split(e);for(let e=0;e<a.length;e++){const n=a[e].trim();n.length>0&&t.push(n)}return t},FormEngineValidation.parseInt=function(e){let n;return e?(n=parseInt(""+e,10),isNaN(n)?0:n):0},FormEngineValidation.parseDouble=function(e){let n=""+e;n=n.replace(/[^0-9,\.-]/g,"");const t="-"===n.substring(0,1);n=n.replace(/-/g,""),n=n.replace(/,/g,"."),-1===n.indexOf(".")&&(n+=".0");const a=n.split("."),i=a.pop();let o=Number(a.join("")+"."+i);return t&&(o*=-1),n=o.toFixed(2),n},FormEngineValidation.ltrim=function(e){return e?(""+e).replace(/^\s+/,""):""},FormEngineValidation.btrim=function(e){return e?(""+e).replace(/\s+$/,""):""},FormEngineValidation.parseDateTime=function(e){const n=e.indexOf(" ");if(-1!==n){const t=FormEngineValidation.parseDate(e.substr(n,e.length));FormEngineValidation.lastTime=t+FormEngineValidation.parseTime(e.substr(0,n),"time")}else FormEngineValidation.lastTime=FormEngineValidation.parseDate(e);return FormEngineValidation.lastTime},FormEngineValidation.parseDate=function(e){const n=new Date;let t=FormEngineValidation.split(e);if(t.values[1]&&t.values[1].length>2){const e=t.values[1];t=FormEngineValidation.splitSingle(e)}const a=t.values[3]?FormEngineValidation.parseInt(t.values[3]):FormEngineValidation.getYear(n),i=t.values[2]?FormEngineValidation.parseInt(t.values[2]):n.getUTCMonth()+1,o=t.values[1]?FormEngineValidation.parseInt(t.values[1]):n.getUTCDate(),r=moment.utc();return r.year(parseInt(a)).month(parseInt(i)-1).date(parseInt(o)).hour(0).minute(0).second(0),FormEngineValidation.lastDate=r.unix(),FormEngineValidation.lastDate},FormEngineValidation.parseTime=function(e,n){const t=new Date;let a=FormEngineValidation.split(e);if(a.values[1]&&a.values[1].length>2){const e=a.values[1];a=FormEngineValidation.splitSingle(e)}const i=a.values[3]?FormEngineValidation.parseInt(a.values[3]):t.getUTCSeconds(),o=a.values[2]?FormEngineValidation.parseInt(a.values[2]):t.getUTCMinutes(),r=a.values[1]?FormEngineValidation.parseInt(a.values[1]):t.getUTCHours(),l=moment.utc();return l.year(1970).month(0).date(1).hour(r).minute(o).second("timesec"===n?i:0),FormEngineValidation.lastTime=l.unix(),FormEngineValidation.lastTime<0&&(FormEngineValidation.lastTime+=86400),FormEngineValidation.lastTime},FormEngineValidation.parseYear=function(e){const n=new Date,t=FormEngineValidation.split(e);return FormEngineValidation.lastYear=t.values[1]?FormEngineValidation.parseInt(t.values[1]):FormEngineValidation.getYear(n),FormEngineValidation.lastYear},FormEngineValidation.getYear=function(e){return null===e?null:e.getUTCFullYear()},FormEngineValidation.getDate=function(e){const n=new Date(FormEngineValidation.getYear(e),e.getUTCMonth(),e.getUTCDate());return FormEngineValidation.getTimestamp(n)},FormEngineValidation.pol=function(foreign,value){return eval(("-"==foreign?"-":"")+value)},FormEngineValidation.convertClientTimestampToUTC=function(e,n){const t=new Date(1e3*e);return t.setTime(1e3*(e-60*t.getTimezoneOffset())),n?FormEngineValidation.getTime(t):FormEngineValidation.getTimestamp(t)},FormEngineValidation.getTimestamp=function(e){return Date.parse(e instanceof Date?e.toISOString():e)/1e3},FormEngineValidation.getTime=function(e){return 60*e.getUTCHours()*60+60*e.getUTCMinutes()+FormEngineValidation.getSecs(e)},FormEngineValidation.getSecs=function(e){return e.getUTCSeconds()},FormEngineValidation.getTimeSecs=function(e){return 60*e.getHours()*60+60*e.getMinutes()+e.getSeconds()},FormEngineValidation.markParentTab=function(e,n){e.parents(".tab-pane").each((function(e,t){const a=$(t);n&&(n=0===a.find(".has-error").length);const i=a.attr("id");$(document).find('a[href="#'+i+'"]').closest(".t3js-tabmenu-item").toggleClass("has-validation-error",!n)}))},FormEngineValidation.splitSingle=function(e){const n=""+e,t={values:[],pointer:3};return t.values[1]=n.substr(0,2),t.values[2]=n.substr(2,2),t.values[3]=n.substr(4,10),t},FormEngineValidation.splitStr=function(e,n,t){const a=""+e,i=n.length;let o=-i;t<1&&(t=1);for(let e=1;e<t;e++)if(o=a.indexOf(n,o+i),-1==o)return null;let r=a.indexOf(n,o+i);return-1==r&&(r=a.length),a.substring(o+i,r)},FormEngineValidation.split=function(e){const n={values:[],valPol:[],pointer:0,numberMode:0,theVal:""};e+=" ";for(let t=0;t<e.length;t++){const a=e.substr(t,1);a<"0"||a>"9"?(n.numberMode&&(n.pointer++,n.values[n.pointer]=n.theVal,n.theVal="",n.numberMode=0),"+"!=a&&"-"!=a||(n.valPol[n.pointer+1]=a)):(n.theVal+=a,n.numberMode=1)}return n},FormEngineValidation.registerSubmitCallback=function(){DocumentSaveActions.getInstance().addPreSubmitCallback((function(e){$("."+FormEngineValidation.errorClass).length>0&&(Modal.confirm(TYPO3.lang.alert||"Alert",TYPO3.lang["FormEngine.fieldsMissing"],Severity.error,[{text:TYPO3.lang["button.ok"]||"OK",active:!0,btnClass:"btn-default",name:"ok"}]).on("button.clicked",(function(){Modal.dismiss()})),e.stopImmediatePropagation())}))},FormEngineValidation}()); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine.js new file mode 100644 index 0000000000000000000000000000000000000000..a09dc148a8b60b028cdf71309fca22139a0be1c5 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import FormEngineValidation from"@typo3/backend/form-engine-validation.js";import DocumentSaveActions from"@typo3/backend/document-save-actions.js";import Icons from"@typo3/backend/icons.js";import Modal from"@typo3/backend/modal.js";import*as MessageUtility from"@typo3/backend/utility/message-utility.js";import Severity from"@typo3/backend/severity.js";import*as BackendExceptionModule from"@typo3/backend/backend-exception.js";import InteractionRequestMap from"@typo3/backend/event/interaction-request-map.js";export default(function(){function e(e,t){t?n.interactionRequestMap.resolveFor(e):n.interactionRequestMap.rejectFor(e)}const t=new Map;t.set("typo3-backend-form-update-value",(e,t)=>{const n=document.querySelector('[name="'+CSS.escape(e.elementName)+'"]'),a=document.querySelector('[data-formengine-input-name="'+CSS.escape(e.elementName)+'"]');FormEngineValidation.updateInputField(e.elementName),null!==n&&(FormEngineValidation.markFieldAsChanged(n),FormEngineValidation.validateField(n)),null!==a&&a!==n&&FormEngineValidation.validateField(a)}),t.set("typo3-backend-form-reload",(e,t)=>{e.confirm?Modal.confirm(TYPO3.lang["FormEngine.refreshRequiredTitle"],TYPO3.lang["FormEngine.refreshRequiredContent"]).on("button.clicked",e=>{"ok"==e.target.name&&n.saveDocument(),Modal.dismiss()}):n.saveDocument()}),t.set("typo3-backend-form-update-bitmask",(e,t)=>{const n=t.target,a=document.editform[e.elementName],o=n.checked!==e.invert,i=Math.pow(2,e.position),r=Math.pow(2,e.total)-i-1;a.value=o?a.value|i:a.value&r,a.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))});const n={consumeTypes:["typo3.setUrl","typo3.beforeSetUrl","typo3.refresh"],Validation:FormEngineValidation,interactionRequestMap:InteractionRequestMap,formName:TYPO3.settings.FormEngine.formName,openedPopupWindow:null,legacyFieldChangedCb:function(){!$.isFunction(TYPO3.settings.FormEngine.legacyFieldChangedCb)||TYPO3.settings.FormEngine.legacyFieldChangedCb()},browserUrl:"",openPopupWindow:function(e,t,a){return Modal.advanced({type:Modal.types.iframe,content:n.browserUrl+"&mode="+e+"&bparams="+t+(a?"&"+("db"===e?"expandPage":"expandFolder")+"="+a:""),size:Modal.sizes.large})},setSelectOptionFromExternalSource:function(e,t,a,o,i,r){i=String(i);let l,c,s=!1,d=!1;if(l=n.getFieldElement(e),c=l.get(0),null===c||"--div--"===t||c instanceof HTMLOptGroupElement)return;const u=n.getFieldElement(e,"_list",!0);if(u.length>0&&(l=u,s=l.prop("multiple")&&"1"!=l.prop("size"),d=!0),s||d){const d=n.getFieldElement(e,"_avail");if(s||(l.find("option").each((e,t)=>{const a=d.find('option[value="'+$.escapeSelector($(t).attr("value"))+'"]');a&&(a.removeClass("hidden").prop("disabled",!1),n.enableOptGroup(a.get(0)))}),l.empty()),i){let e=!1,a=new RegExp("(^|,)"+t+"($|,)");i.match(a)?(l.empty(),e=!0):1==l.find("option").length&&(a=new RegExp("(^|,)"+l.find("option").prop("value")+"($|,)"),i.match(a)&&(l.empty(),e=!0)),e&&void 0!==r&&r.closest("select").querySelectorAll("[disabled]").forEach((function(e){e.classList.remove("hidden"),e.disabled=!1,n.enableOptGroup(e)}))}let u=!0;const m=n.getFieldElement(e,"_mul",!0);if((0==m.length||0==m.val())&&(l.find("option").each((function(e,n){if($(n).prop("value")==t)return u=!1,!1})),u&&void 0!==r)){r.classList.add("hidden"),r.disabled=!0;const e=r.parentElement;e instanceof HTMLOptGroupElement&&0===e.querySelectorAll("option:not([disabled]):not([hidden]):not(.hidden)").length&&(e.disabled=!0,e.classList.add("hidden"))}if(u){const e=$("<option></option>");e.attr({value:t,title:o}).text(a),e.appendTo(l),n.updateHiddenFieldValueFromSelect(l,c),n.legacyFieldChangedCb(),FormEngineValidation.markFieldAsChanged(c),n.Validation.validateField(l),n.Validation.validateField(d)}}else{const e=/_(\d+)$/,a=t.toString().match(e);null!=a&&(t=a[1]),l.val(t),n.Validation.validateField(l)}},updateHiddenFieldValueFromSelect:function(e,t){const n=[];$(e).find("option").each((e,t)=>{n.push($(t).prop("value"))}),t.value=n.join(","),t.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},getFormElement:function(e){const t=$('form[name="'+n.formName+'"]:first');if(!e)return t;{const a=n.getFieldElement(e),o=n.getFieldElement(e,"_list");if(a.length>0&&("select-one"===a.prop("type")||o.length>0&&o.prop("type").match(/select-(one|multiple)/)))return t;console.error("Form fields missing: form: "+n.formName+", field name: "+e),alert("Form field is invalid")}},getFieldElement:function(e,t,a){const o=$('form[name="'+n.formName+'"]:first');if(t){let n;switch(t){case"_list":n=$(':input[data-formengine-input-name="'+e+'"]:not([type=hidden])',o);break;case"_avail":n=$(':input[data-relatedfieldname="'+e+'"]',o);break;case"_mul":case"_hr":n=$(':input[type=hidden][data-formengine-input-name="'+e+'"]',o);break;default:n=null}if(n&&n.length>0||!0===a)return n}return $(':input[name="'+e+'"]',o)},initializeEvents:function(){top.TYPO3&&void 0!==top.TYPO3.Backend&&(top.TYPO3.Backend.consumerScope.attach(n),$(window).on("unload",(function(){top.TYPO3.Backend.consumerScope.detach(n)}))),$(document).on("click",".t3js-editform-close",e=>{e.preventDefault(),n.preventExitIfNotSaved(n.preventExitIfNotSavedCallback)}).on("click",".t3js-editform-view",e=>{e.preventDefault(),n.previewAction(e,n.previewActionCallback)}).on("click",".t3js-editform-new",e=>{e.preventDefault(),n.newAction(e,n.newActionCallback)}).on("click",".t3js-editform-duplicate",e=>{e.preventDefault(),n.duplicateAction(e,n.duplicateActionCallback)}).on("click",".t3js-editform-delete-record",e=>{e.preventDefault(),n.deleteAction(e,n.deleteActionCallback)}).on("click",".t3js-editform-submitButton",e=>{const t=$(e.currentTarget),n=t.data("name")||e.currentTarget.name,a=$("<input />").attr("type","hidden").attr("name",n).attr("value","1");t.parents("form").append(a)}).on("change",'.t3-form-field-eval-null-checkbox input[type="checkbox"]',e=>{$(e.currentTarget).closest(".t3js-formengine-field-item").toggleClass("disabled")}).on("change",'.t3js-form-field-eval-null-placeholder-checkbox input[type="checkbox"]',e=>{n.toggleCheckboxField($(e.currentTarget)),FormEngineValidation.markFieldAsChanged($(e.currentTarget))}).on("change",(function(e){$(".module-docheader-bar .btn").removeClass("disabled").prop("disabled",!1)})).on("click",".t3js-element-browser",(function(e){e.preventDefault(),e.stopPropagation();const t=$(e.currentTarget),a=t.data("mode"),o=t.data("params"),i=t.data("entryPoint");n.openPopupWindow(a,o,i)})).on("click",'[data-formengine-field-change-event="click"]',e=>{const t=JSON.parse(e.currentTarget.dataset.formengineFieldChangeItems);n.processOnFieldChange(t,e)}).on("change",'[data-formengine-field-change-event="change"]',e=>{const t=JSON.parse(e.currentTarget.dataset.formengineFieldChangeItems);n.processOnFieldChange(t,e)}),document.editform.addEventListener("submit",(function(){if(document.editform.closeDoc.value)return;const e=["button[form]",'button[name^="_save"]','a[data-name^="_save"]','button[name="CMD"][value^="save"]','a[data-name="CMD"][data-value^="save"]'].join(","),t=document.querySelector(e);null!==t&&(t.disabled=!0,Icons.getIcon("spinner-circle-dark",Icons.sizes.small).then((function(e){t.querySelector(".t3js-icon").outerHTML=e})))})),window.addEventListener("message",n.handlePostMessage)},consume:function(t){if(!t)throw new BackendExceptionModule.BackendException("No interaction request given",1496589980);const a=$.Deferred();if(t.concernsTypes(n.consumeTypes)){const o=t.outerMostRequest;n.interactionRequestMap.attachFor(o,a),o.isProcessed()?e(o,o.getProcessedData().response):n.hasChange()?n.preventExitIfNotSaved((function(t){o.setProcessedData({response:t}),e(o,t)})):n.interactionRequestMap.resolveFor(o)}return a},handlePostMessage:function(e){if(!MessageUtility.MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:elementBrowser:elementAdded"===e.data.actionName){if(void 0===e.data.fieldName)throw"fieldName not defined in message";if(void 0===e.data.value)throw"value not defined in message";const t=e.data.label||e.data.value,a=e.data.title||t,o=e.data.exclusiveValues||"";n.setSelectOptionFromExternalSource(e.data.fieldName,e.data.value,t,a,o)}},initializeRemainingCharacterViews:function(){const e=$("[maxlength]").not(".t3js-datetimepicker").not(".t3js-charcounter-initialized");e.on("focus",e=>{const t=$(e.currentTarget),a=t.parents(".t3js-formengine-field-item:first"),o=n.getCharacterCounterProperties(t);a.append($("<div />",{class:"t3js-charcounter"}).append($("<span />",{class:o.labelClass}).text(TYPO3.lang["FormEngine.remainingCharacters"].replace("{0}",o.remainingCharacters))))}).on("blur",e=>{$(e.currentTarget).parents(".t3js-formengine-field-item:first").find(".t3js-charcounter").remove()}).on("keyup",e=>{const t=$(e.currentTarget),a=t.parents(".t3js-formengine-field-item:first"),o=n.getCharacterCounterProperties(t);a.find(".t3js-charcounter span").removeClass().addClass(o.labelClass).text(TYPO3.lang["FormEngine.remainingCharacters"].replace("{0}",o.remainingCharacters))}),e.addClass("t3js-charcounter-initialized"),$(":password").on("focus",(function(e){$(e.currentTarget).attr({type:"text","data-active-password":"true"}).trigger("select")})).on("blur",(function(e){$(e.currentTarget).attr("type","password").removeAttr("data-active-password")}))},getCharacterCounterProperties:function(e){const t=e.val(),n=e.attr("maxlength")-t.length-(t.match(/\n/g)||[]).length;let a="";return a=n<15?"label-danger":n<30?"label-warning":"label-info",{remainingCharacters:n,labelClass:"label "+a}},initializeNullNoPlaceholderCheckboxes:function(){$(".t3-form-field-eval-null-checkbox").each((function(e,t){const n=$(t),a=n.find('input[type="checkbox"]'),o=n.closest(".t3js-formengine-field-item");a.attr("checked")||o.addClass("disabled")}))},initializeNullWithPlaceholderCheckboxes:function(){$(".t3js-form-field-eval-null-placeholder-checkbox").each((e,t)=>{n.toggleCheckboxField($(t).find('input[type="checkbox"]'))})},toggleCheckboxField:function(e){const t=e.closest(".t3js-formengine-field-item");e.prop("checked")?(t.find(".t3js-formengine-placeholder-placeholder").hide(),t.find(".t3js-formengine-placeholder-formfield").show(),t.find(".t3js-formengine-placeholder-formfield").find(":input").trigger("focus")):(t.find(".t3js-formengine-placeholder-placeholder").show(),t.find(".t3js-formengine-placeholder-formfield").hide())},reinitialize:function(){const e=Array.from(document.querySelectorAll(".t3js-clearable")).filter(e=>!e.classList.contains("t3js-color-picker"));e.length>0&&import("@typo3/backend/input/clearable.js").then((function(){e.forEach(e=>e.clearable())})),n.initializeNullNoPlaceholderCheckboxes(),n.initializeNullWithPlaceholderCheckboxes(),n.initializeLocalizationStateSelector(),n.initializeRemainingCharacterViews()},initializeLocalizationStateSelector:function(){$(".t3js-l10n-state-container").each((e,t)=>{const n=$(t),a=n.closest(".t3js-formengine-field-item").find("[data-formengine-input-name]"),o=n.find('input[type="radio"]:checked').val();"parent"!==o&&"source"!==o||a.attr("disabled","disabled")})},hasChange:function(){const e=$('form[name="'+n.formName+'"] .has-change').length>0,t=$('[name^="data["].has-change').length>0;return e||t},preventExitIfNotSavedCallback:function(e){n.closeDocument()},preventFollowLinkIfNotSaved:function(e){return n.preventExitIfNotSaved((function(){window.location.href=e})),!1},preventExitIfNotSaved:function(e){if(e=e||n.preventExitIfNotSavedCallback,n.hasChange()){const t=TYPO3.lang["label.confirm.close_without_save.title"]||"Do you want to close without saving?",a=TYPO3.lang["label.confirm.close_without_save.content"]||"You currently have unsaved changes. Are you sure you want to discard these changes?",o=$("<input />").attr("type","hidden").attr("name","_saveandclosedok").attr("value","1"),i=[{text:TYPO3.lang["buttons.confirm.close_without_save.no"]||"No, I will continue editing",btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.close_without_save.yes"]||"Yes, discard my changes",btnClass:"btn-default",name:"yes"}];0===$(".has-error").length&&i.push({text:TYPO3.lang["buttons.confirm.save_and_close"]||"Save and close",btnClass:"btn-warning",name:"save",active:!0});Modal.confirm(t,a,Severity.warning,i).on("button.clicked",(function(t){"no"===t.target.name?Modal.dismiss():"yes"===t.target.name?(Modal.dismiss(),e.call(null,!0)):"save"===t.target.name&&($("form[name="+n.formName+"]").append(o),Modal.dismiss(),n.saveDocument())}))}else e.call(null,!0)},preventSaveIfHasErrors:function(){if($(".has-error").length>0){const e=TYPO3.lang["label.alert.save_with_error.title"]||"You have errors in your form!",t=TYPO3.lang["label.alert.save_with_error.content"]||"Please check the form, there is at least one error in your form.";return Modal.confirm(e,t,Severity.error,[{text:TYPO3.lang["buttons.alert.save_with_error.ok"]||"OK",btnClass:"btn-danger",name:"ok"}]).on("button.clicked",(function(e){"ok"===e.target.name&&Modal.dismiss()})),!1}return!0},requestFormEngineUpdate:function(e){if(e){Modal.confirm(TYPO3.lang["FormEngine.refreshRequiredTitle"],TYPO3.lang["FormEngine.refreshRequiredContent"]).on("button.clicked",(function(e){"ok"===e.target.name?(n.closeModalsRecursive(),n.saveDocument()):Modal.dismiss()}))}else n.saveDocument()},processOnFieldChange:function(e,n){e.forEach(e=>{const a=t.get(e.name);a instanceof Function&&a.call(null,e.data||null,n)})},registerOnFieldChangeHandler:function(e,n){t.has(e)&&console.warn("Handler for onFieldChange name `"+e+"` has been overridden."),t.set(e,n)},closeModalsRecursive:function(){void 0!==Modal.currentModal&&null!==Modal.currentModal&&(Modal.currentModal.on("hidden.bs.modal",(function(){n.closeModalsRecursive(Modal.currentModal)})),Modal.currentModal.trigger("modal-dismiss"))},previewAction:function(e,t){t=t||n.previewActionCallback;const a=e.target.href,o=e.target.dataset.hasOwnProperty("isNew"),i=$("<input />").attr("type","hidden").attr("name","_savedokview").attr("value","1");n.hasChange()?n.showPreviewModal(a,o,i,t):($("form[name="+n.formName+"]").append(i),window.open("","newTYPO3frontendWindow"),document.editform.submit())},previewActionCallback:function(e,t,a){switch(Modal.dismiss(),e){case"discard":const e=window.open(t,"newTYPO3frontendWindow");e.focus(),e.location.href===t&&e.location.reload();break;case"save":$("form[name="+n.formName+"]").append(a),window.open("","newTYPO3frontendWindow"),n.saveDocument()}},showPreviewModal:function(e,t,n,a){const o=TYPO3.lang["label.confirm.view_record_changed.title"]||"Do you want to save before viewing?",i={text:TYPO3.lang["buttons.confirm.view_record_changed.cancel"]||"Cancel",btnClass:"btn-default",name:"cancel"},r={text:TYPO3.lang["buttons.confirm.view_record_changed.no-save"]||"View without changes",btnClass:"btn-info",name:"discard"},l={text:TYPO3.lang["buttons.confirm.view_record_changed.save"]||"Save changes and view",btnClass:"btn-info",name:"save",active:!0};let c=[],s="";t?(c=[i,l],s=TYPO3.lang["label.confirm.view_record_changed.content.is-new-page"]||"You need to save your changes before viewing the page. Do you want to save and view them now?"):(c=[i,r,l],s=TYPO3.lang["label.confirm.view_record_changed.content"]||"You currently have unsaved changes. You can either discard these changes or save and view them.");const d=Modal.confirm(o,s,Severity.info,c);d.on("button.clicked",(function(t){a(t.target.name,e,n,d)}))},newAction:function(e,t){t=t||n.newActionCallback;const a=$("<input />").attr("type","hidden").attr("name","_savedoknew").attr("value","1"),o=e.target.dataset.hasOwnProperty("isNew");n.hasChange()?n.showNewModal(o,a,t):($("form[name="+n.formName+"]").append(a),document.editform.submit())},newActionCallback:function(e,t){const a=$("form[name="+n.formName+"]");switch(Modal.dismiss(),e){case"no":a.append(t),document.editform.submit();break;case"yes":a.append(t),n.saveDocument()}},showNewModal:function(e,t,n){const a=TYPO3.lang["label.confirm.new_record_changed.title"]||"Do you want to save before adding?",o=TYPO3.lang["label.confirm.new_record_changed.content"]||"You need to save your changes before creating a new record. Do you want to save and create now?";let i=[];const r={text:TYPO3.lang["buttons.confirm.new_record_changed.cancel"]||"Cancel",btnClass:"btn-default",name:"cancel"},l={text:TYPO3.lang["buttons.confirm.new_record_changed.no"]||"No, just add",btnClass:"btn-default",name:"no"},c={text:TYPO3.lang["buttons.confirm.new_record_changed.yes"]||"Yes, save and create now",btnClass:"btn-info",name:"yes",active:!0};i=e?[r,c]:[r,l,c];Modal.confirm(a,o,Severity.info,i).on("button.clicked",(function(e){n(e.target.name,t)}))},duplicateAction:function(e,t){t=t||n.duplicateActionCallback;const a=$("<input />").attr("type","hidden").attr("name","_duplicatedoc").attr("value","1"),o=e.target.dataset.hasOwnProperty("isNew");n.hasChange()?n.showDuplicateModal(o,a,t):($("form[name="+n.formName+"]").append(a),document.editform.submit())},duplicateActionCallback:function(e,t){const a=$("form[name="+n.formName+"]");switch(Modal.dismiss(),e){case"no":a.append(t),document.editform.submit();break;case"yes":a.append(t),n.saveDocument()}},showDuplicateModal:function(e,t,n){const a=TYPO3.lang["label.confirm.duplicate_record_changed.title"]||"Do you want to save before duplicating this record?",o=TYPO3.lang["label.confirm.duplicate_record_changed.content"]||"You currently have unsaved changes. Do you want to save your changes before duplicating this record?";let i=[];const r={text:TYPO3.lang["buttons.confirm.duplicate_record_changed.cancel"]||"Cancel",btnClass:"btn-default",name:"cancel"},l={text:TYPO3.lang["buttons.confirm.duplicate_record_changed.no"]||"No, just duplicate the original",btnClass:"btn-default",name:"no"},c={text:TYPO3.lang["buttons.confirm.duplicate_record_changed.yes"]||"Yes, save and duplicate this record",btnClass:"btn-info",name:"yes",active:!0};i=e?[r,c]:[r,l,c];Modal.confirm(a,o,Severity.info,i).on("button.clicked",(function(e){n(e.target.name,t)}))},deleteAction:function(e,t){t=t||n.deleteActionCallback;const a=$(e.target);n.showDeleteModal(a,t)},deleteActionCallback:function(e,t){Modal.dismiss(),"yes"===e&&n.invokeRecordDeletion(t)},showDeleteModal:function(e,t){const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?";let a=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";e.data("reference-count-message")&&(a+=" "+e.data("reference-count-message")),e.data("translation-count-message")&&(a+=" "+e.data("translation-count-message"));Modal.confirm(n,a,Severity.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes",active:!0}]).on("button.clicked",(function(n){t(n.target.name,e)}))},enableOptGroup:function(e){const t=e.parentElement;t instanceof HTMLOptGroupElement&&t.querySelectorAll("option:not([hidden]):not([disabled]):not(.hidden)").length&&(t.hidden=!1,t.disabled=!1,t.classList.remove("hidden"))},closeDocument:function(){document.editform.closeDoc.value=1,n.dispatchSubmitEvent(),document.editform.submit()},saveDocument:function(){document.editform.doSave.value=1,n.dispatchSubmitEvent(),document.editform.submit()},dispatchSubmitEvent:function(){const e=document.createEvent("Event");e.initEvent("submit",!1,!0),document.editform.dispatchEvent(e)},initialize:function(e){DocumentSaveActions.getInstance().addPreSubmitCallback((function(){$('[data-active-password]:not([type="password"])').each((function(e,t){t.setAttribute("type","password"),t.blur()}))})),n.browserUrl=e,$((function(){n.initializeEvents(),n.Validation.initialize(),n.reinitialize(),$("#t3js-ui-block").remove()}))},invokeRecordDeletion:function(e){window.location.href=e.attr("href")}};return void 0!==TYPO3.settings.RequireJS&&void 0!==TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/FormEngine"]&&$.each(TYPO3.settings.RequireJS.PostInitializationModules["TYPO3/CMS/Backend/FormEngine"],(function(e,t){window.require([t])})),TYPO3.FormEngine=n,n}()); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/flex-form-container-container.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/flex-form-container-container.js new file mode 100644 index 0000000000000000000000000000000000000000..0127f306cd84ca9f7d37065e4f7f02febf7e44eb --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/flex-form-container-container.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{Collapse}from"bootstrap";import SecurityUtility from"@typo3/core/security-utility.js";import Modal from"@typo3/backend/modal.js";import RegularEvent from"@typo3/core/event/regular-event.js";import Severity from"@typo3/backend/severity.js";var Selectors;!function(e){e.toggleSelector='[data-bs-toggle="flexform-inline"]',e.actionFieldSelector=".t3js-flex-control-action",e.toggleFieldSelector=".t3js-flex-control-toggle",e.controlSectionSelector=".t3js-formengine-irre-control",e.sectionContentContainerSelector=".t3js-flex-section-content",e.deleteContainerButtonSelector=".t3js-delete",e.contentPreviewSelector=".content-preview"}(Selectors||(Selectors={}));class FlexFormContainerContainer{constructor(e,t){this.securityUtility=new SecurityUtility,this.parentContainer=e,this.container=t,this.containerContent=t.querySelector(Selectors.sectionContentContainerSelector),this.containerId=t.dataset.flexformContainerId,this.panelHeading=t.querySelector('[data-bs-target="#flexform-container-'+this.containerId+'"]'),this.panelButton=this.panelHeading.querySelector('[aria-controls="flexform-container-'+this.containerId+'"]'),this.toggleField=t.querySelector(Selectors.toggleFieldSelector),this.registerEvents(),this.generatePreview()}static getCollapseInstance(e){return Collapse.getInstance(e)??new Collapse(e,{toggle:!1})}getStatus(){return{id:this.containerId,collapsed:"false"===this.panelButton.getAttribute("aria-expanded")}}registerEvents(){this.parentContainer.isRestructuringAllowed()&&this.registerDelete(),this.registerToggle(),this.registerPanelToggle()}registerDelete(){new RegularEvent("click",()=>{const e=TYPO3.lang["flexform.section.delete.title"]||"Delete this container?",t=TYPO3.lang["flexform.section.delete.message"]||"Are you sure you want to delete this container?";Modal.confirm(e,t,Severity.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this container",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",e=>{if("yes"===e.target.name){const e=this.container.querySelector(Selectors.actionFieldSelector);e.value="DELETE",this.container.appendChild(e),this.container.classList.add("t3-flex-section--deleted"),new RegularEvent("transitionend",()=>{this.container.classList.add("hidden");const e=new CustomEvent("formengine:flexform:container-deleted",{detail:{containerId:this.containerId}});this.parentContainer.getContainer().dispatchEvent(e)}).bindTo(this.container)}Modal.dismiss()})}).bindTo(this.container.querySelector(Selectors.deleteContainerButtonSelector))}registerToggle(){new RegularEvent("click",()=>{FlexFormContainerContainer.getCollapseInstance(this.containerContent).toggle(),this.generatePreview()}).delegateTo(this.container,`${Selectors.toggleSelector} .form-irre-header-cell:not(${Selectors.controlSectionSelector}`)}registerPanelToggle(){["hide.bs.collapse","show.bs.collapse"].forEach(e=>{new RegularEvent(e,e=>{const t="hide.bs.collapse"===e.type;this.toggleField.value=t?"1":"0",this.panelButton.setAttribute("aria-expanded",t?"false":"true"),this.panelButton.parentElement.classList.toggle("collapsed",t)}).bindTo(this.containerContent)})}generatePreview(){let e="";if(this.getStatus().collapsed){const t=this.containerContent.querySelectorAll('input[type="text"], textarea');for(let n of t){let t=this.securityUtility.stripHtml(n.value);t.length>50&&(t=t.substring(0,50)+"..."),e+=(e?" / ":"")+t}}this.panelHeading.querySelector(Selectors.contentPreviewSelector).textContent=e}}export default FlexFormContainerContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/flex-form-section-container.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/flex-form-section-container.js new file mode 100644 index 0000000000000000000000000000000000000000..eaf96bc43768f791c38b48b369b8746e83ec6454 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/flex-form-section-container.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{Collapse}from"bootstrap";import $ from"jquery";import Sortable from"sortablejs";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import DocumentService from"@typo3/core/document-service.js";import FlexFormContainerContainer from"@typo3/backend/form-engine/container/flex-form-container-container.js";import FormEngine from"@typo3/backend/form-engine.js";import RegularEvent from"@typo3/core/event/regular-event.js";import{JavaScriptItemProcessor}from"@typo3/core/java-script-item-processor.js";var Selectors;!function(e){e.toggleAllSelector=".t3-form-flexsection-toggle",e.addContainerSelector=".t3js-flex-container-add",e.actionFieldSelector=".t3js-flex-control-action",e.sectionContainerSelector=".t3js-flex-section",e.sectionContentContainerSelector=".t3js-flex-section-content",e.sortContainerButtonSelector=".t3js-sortable-handle"}(Selectors||(Selectors={}));class FlexFormSectionContainer{constructor(e){this.allowRestructure=!1,this.flexformContainerContainers=[],this.updateSorting=e=>{this.container.querySelectorAll(Selectors.actionFieldSelector).forEach((e,t)=>{e.value=t.toString()}),this.updateToggleAllState(),this.flexformContainerContainers.splice(e.newIndex,0,this.flexformContainerContainers.splice(e.oldIndex,1)[0]),document.dispatchEvent(new Event("formengine:flexform:sorting-changed"))},this.sectionContainerId=e,DocumentService.ready().then(t=>{this.container=t.getElementById(e),this.sectionContainer=this.container.querySelector(this.container.dataset.section),this.allowRestructure="1"===this.sectionContainer.dataset.t3FlexAllowRestructure,this.registerEvents(),this.registerContainers()})}static getCollapseInstance(e){return Collapse.getInstance(e)??new Collapse(e,{toggle:!1})}getContainer(){return this.container}isRestructuringAllowed(){return this.allowRestructure}registerEvents(){this.allowRestructure&&(this.registerSortable(),this.registerContainerDeleted()),this.registerToggleAll(),this.registerCreateNewContainer(),this.registerPanelToggle()}registerContainers(){const e=this.container.querySelectorAll(Selectors.sectionContainerSelector);for(let t of e)this.flexformContainerContainers.push(new FlexFormContainerContainer(this,t));this.updateToggleAllState()}getToggleAllButton(){return this.container.querySelector(Selectors.toggleAllSelector)}registerSortable(){new Sortable(this.sectionContainer,{group:this.sectionContainer.id,handle:Selectors.sortContainerButtonSelector,onSort:this.updateSorting})}registerToggleAll(){new RegularEvent("click",e=>{const t="true"===e.target.dataset.expandAll,n=this.container.querySelectorAll(Selectors.sectionContentContainerSelector);for(let e of n)t?FlexFormSectionContainer.getCollapseInstance(e).show():FlexFormSectionContainer.getCollapseInstance(e).hide()}).bindTo(this.getToggleAllButton())}registerCreateNewContainer(){new RegularEvent("click",(e,t)=>{e.preventDefault(),this.createNewContainer(t.dataset)}).delegateTo(this.container,Selectors.addContainerSelector)}createNewContainer(dataset){new AjaxRequest(TYPO3.settings.ajaxUrls.record_flex_container_add).post({vanillaUid:dataset.vanillauid,databaseRowUid:dataset.databaserowuid,command:dataset.command,tableName:dataset.tablename,fieldName:dataset.fieldname,recordTypeValue:dataset.recordtypevalue,dataStructureIdentifier:JSON.parse(dataset.datastructureidentifier),flexFormSheetName:dataset.flexformsheetname,flexFormFieldName:dataset.flexformfieldname,flexFormContainerName:dataset.flexformcontainername}).then(async response=>{const data=await response.resolve(),createdContainer=(new DOMParser).parseFromString(data.html,"text/html").body.firstElementChild;this.flexformContainerContainers.push(new FlexFormContainerContainer(this,createdContainer));const sectionContainer=document.querySelector(dataset.target);if(sectionContainer.insertAdjacentElement("beforeend",createdContainer),data.scriptItems instanceof Array&&data.scriptItems.length>0){const e=new JavaScriptItemProcessor;e.processItems(data.scriptItems)}data.scriptCall&&data.scriptCall.length>0&&$.each(data.scriptCall,(function(index,value){eval(value)})),data.stylesheetFiles&&data.stylesheetFiles.length>0&&$.each(data.stylesheetFiles,(function(e,t){let n=document.createElement("link");n.rel="stylesheet",n.type="text/css",n.href=t,document.head.appendChild(n)})),this.updateToggleAllState(),FormEngine.reinitialize(),FormEngine.Validation.initializeInputFields(),FormEngine.Validation.validate(sectionContainer)})}registerContainerDeleted(){new RegularEvent("formengine:flexform:container-deleted",e=>{const t=e.detail.containerId;this.flexformContainerContainers=this.flexformContainerContainers.filter(e=>e.getStatus().id!==t),FormEngine.Validation.validate(this.container),this.updateToggleAllState()}).bindTo(this.container)}registerPanelToggle(){["hide.bs.collapse","show.bs.collapse"].forEach(e=>{new RegularEvent(e,()=>{this.updateToggleAllState()}).delegateTo(this.container,Selectors.sectionContentContainerSelector)})}updateToggleAllState(){if(this.flexformContainerContainers.length>0){const e=this.flexformContainerContainers.find(Boolean);this.getToggleAllButton().dataset.expandAll=!0===e.getStatus().collapsed?"true":"false"}}}export default FlexFormSectionContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/inline-control-container.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/inline-control-container.js new file mode 100644 index 0000000000000000000000000000000000000000..309586f4fe279a645c437601aa943b6c62e07e6a --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/inline-control-container.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{MessageUtility}from"@typo3/backend/utility/message-utility.js";import{AjaxDispatcher}from"@typo3/backend/form-engine/inline-relation/ajax-dispatcher.js";import DocumentService from"@typo3/core/document-service.js";import NProgress from"nprogress";import Sortable from"sortablejs";import FormEngine from"@typo3/backend/form-engine.js";import FormEngineValidation from"@typo3/backend/form-engine-validation.js";import Icons from"@typo3/backend/icons.js";import InfoWindow from"@typo3/backend/info-window.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import RegularEvent from"@typo3/core/event/regular-event.js";import Severity from"@typo3/backend/severity.js";import Utility from"@typo3/backend/utility.js";var Selectors,States,Separators,SortDirections;!function(e){e.toggleSelector='[data-bs-toggle="formengine-inline"]',e.controlSectionSelector=".t3js-formengine-irre-control",e.createNewRecordButtonSelector=".t3js-create-new-button",e.createNewRecordBySelectorSelector=".t3js-create-new-selector",e.deleteRecordButtonSelector=".t3js-editform-delete-inline-record",e.enableDisableRecordButtonSelector=".t3js-toggle-visibility-button",e.infoWindowButton='[data-action="infowindow"]',e.synchronizeLocalizeRecordButtonSelector=".t3js-synchronizelocalize-button",e.uniqueValueSelectors="select.t3js-inline-unique",e.revertUniqueness=".t3js-revert-unique",e.controlContainer=".t3js-inline-controls"}(Selectors||(Selectors={})),function(e){e.new="inlineIsNewRecord",e.visible="panel-visible",e.collapsed="panel-collapsed",e.notLoaded="t3js-not-loaded"}(States||(States={})),function(e){e.structureSeparator="-"}(Separators||(Separators={})),function(e){e.DOWN="down",e.UP="up"}(SortDirections||(SortDirections={}));class InlineControlContainer{constructor(e){this.container=null,this.ajaxDispatcher=null,this.appearance=null,this.requestQueue={},this.progessQueue={},this.noTitleString=TYPO3.lang?TYPO3.lang["FormEngine.noRecordTitle"]:"[No title]",this.handlePostMessage=e=>{if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:foreignRelation:insert"===e.data.actionName){if(void 0===e.data.objectGroup)throw"No object group defined for message";if(e.data.objectGroup!==this.container.dataset.objectGroup)return;if(this.isUniqueElementUsed(parseInt(e.data.uid,10),e.data.table))return void Notification.error("There is already a relation to the selected element");this.importRecord([e.data.objectGroup,e.data.uid]).then(()=>{if(e.source){const t={actionName:"typo3:foreignRelation:inserted",objectGroup:e.data.objectId,table:e.data.table,uid:e.data.uid};MessageUtility.send(t,e.source)}})}},DocumentService.ready().then(t=>{this.container=t.getElementById(e),this.ajaxDispatcher=new AjaxDispatcher(this.container.dataset.objectGroup),this.registerEvents()})}static getInlineRecordContainer(e){return document.querySelector('[data-object-id="'+e+'"]')}static getCollapseButton(e){return document.querySelector('[aria-controls="'+e+'_fields"]')}static toggleElement(e){const t=InlineControlContainer.getInlineRecordContainer(e);t.classList.contains(States.collapsed)?InlineControlContainer.expandElement(t,e):InlineControlContainer.collapseElement(t,e)}static collapseElement(e,t){const n=InlineControlContainer.getCollapseButton(t);e.classList.remove(States.visible),e.classList.add(States.collapsed),n.setAttribute("aria-expanded","false")}static expandElement(e,t){const n=InlineControlContainer.getCollapseButton(t);e.classList.remove(States.collapsed),e.classList.add(States.visible),n.setAttribute("aria-expanded","true")}static isNewRecord(e){return InlineControlContainer.getInlineRecordContainer(e).classList.contains(States.new)}static updateExpandedCollapsedStateLocally(e,t){const n=InlineControlContainer.getInlineRecordContainer(e),o="uc[inlineView]["+n.dataset.topmostParentTable+"]["+n.dataset.topmostParentUid+"]"+n.dataset.fieldName,i=document.getElementsByName(o);i.length&&(i[0].value=t?"1":"0")}static getValuesFromHashMap(e){return Object.keys(e).map(t=>e[t])}static selectOptionValueExists(e,t){return null!==e.querySelector('option[value="'+t+'"]')}static removeSelectOptionByValue(e,t){const n=e.querySelector('option[value="'+t+'"]');null!==n&&n.remove()}static reAddSelectOption(e,t,n){if(InlineControlContainer.selectOptionValueExists(e,t))return;const o=e.querySelectorAll("option");let i=-1;for(let e of Object.keys(n.possible)){if(e===t)break;for(let t=0;t<o.length;++t){if(o[t].value===e){i=t;break}}}-1===i?i=0:i<o.length&&i++;const r=document.createElement("option");r.text=n.possible[t],r.value=t,e.insertBefore(r,e.options[i])}registerEvents(){if(this.registerInfoButton(),this.registerSort(),this.registerCreateRecordButton(),this.registerEnableDisableButton(),this.registerDeleteButton(),this.registerSynchronizeLocalize(),this.registerRevertUniquenessAction(),this.registerToggle(),this.registerCreateRecordBySelector(),this.registerUniqueSelectFieldChanged(),new RegularEvent("message",this.handlePostMessage).bindTo(window),this.getAppearance().useSortable){const e=document.getElementById(this.container.getAttribute("id")+"_records");new Sortable(e,{group:e.getAttribute("id"),handle:".sortableHandle",onSort:()=>{this.updateSorting()}})}}registerToggle(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.loadRecordDetails(this.closest(Selectors.toggleSelector).parentElement.dataset.objectId)})).delegateTo(this.container,`${Selectors.toggleSelector} .form-irre-header-cell:not(${Selectors.controlSectionSelector}`)}registerSort(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.changeSortingByButton(this.closest("[data-object-id]").dataset.objectId,this.dataset.direction)})).delegateTo(this.container,Selectors.controlSectionSelector+' [data-action="sort"]')}registerCreateRecordButton(){const e=this;new RegularEvent("click",(function(t){if(t.preventDefault(),t.stopImmediatePropagation(),e.isBelowMax()){let t=e.container.dataset.objectGroup;void 0!==this.dataset.recordUid&&(t+=Separators.structureSeparator+this.dataset.recordUid),e.importRecord([t,e.container.querySelector(Selectors.createNewRecordBySelectorSelector)?.value],this.dataset.recordUid??null)}})).delegateTo(this.container,Selectors.createNewRecordButtonSelector)}registerCreateRecordBySelector(){const e=this;new RegularEvent("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.options[this.selectedIndex].getAttribute("value");e.importRecord([e.container.dataset.objectGroup,n])})).delegateTo(this.container,Selectors.createNewRecordBySelectorSelector)}createRecord(e,t,n=null,o=null){let i=this.container.dataset.objectGroup;null!==n&&(i+=Separators.structureSeparator+n),null!==n?(InlineControlContainer.getInlineRecordContainer(i).insertAdjacentHTML("afterend",t),this.memorizeAddRecord(e,n,o)):(document.getElementById(this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t),this.memorizeAddRecord(e,null,o))}async importRecord(e,t){return this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_create")),e).then(async e=>{this.isBelowMax()&&this.createRecord(e.compilerInput.uid,e.data,void 0!==t?t:null,void 0!==e.compilerInput.childChildUid?e.compilerInput.childChildUid:null)})}registerEnableDisableButton(){new RegularEvent("click",(e,t)=>{e.preventDefault(),e.stopImmediatePropagation();const n=t.closest("[data-object-id]").dataset.objectId,o=InlineControlContainer.getInlineRecordContainer(n),i="data"+o.dataset.fieldName+"["+t.dataset.hiddenField+"]",r=document.querySelector('[data-formengine-input-name="'+i+'"'),a=document.querySelector('[name="'+i+'"');null!==r&&null!==a&&(r.checked=!r.checked,a.value=r.checked?"1":"0",FormEngineValidation.markFieldAsChanged(r));const s="t3-form-field-container-inline-hidden";let l;o.classList.contains(s)?(l="actions-edit-hide",o.classList.remove(s)):(l="actions-edit-unhide",o.classList.add(s)),Icons.getIcon(l,Icons.sizes.small).then(e=>{t.replaceChild(document.createRange().createContextualFragment(e),t.querySelector(".t3js-icon"))})}).delegateTo(this.container,Selectors.enableDisableRecordButtonSelector)}registerInfoButton(){new RegularEvent("click",(function(e){e.preventDefault(),e.stopImmediatePropagation(),InfoWindow.showItem(this.dataset.infoTable,this.dataset.infoUid)})).delegateTo(this.container,Selectors.infoWindowButton)}registerDeleteButton(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?",o=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";Modal.confirm(n,o,Severity.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",t=>{if("yes"===t.target.name){const t=this.closest("[data-object-id]").dataset.objectId;e.deleteRecord(t)}Modal.dismiss()})})).delegateTo(this.container,Selectors.deleteRecordButtonSelector)}registerSynchronizeLocalize(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.ajaxDispatcher.send(e.ajaxDispatcher.newRequest(e.ajaxDispatcher.getEndpoint("record_inline_synchronizelocalize")),[e.container.dataset.objectGroup,this.dataset.type]).then(async t=>{document.getElementById(e.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t.data);const n=e.container.dataset.objectGroup+Separators.structureSeparator;for(let o of t.compilerInput.delete)e.deleteRecord(n+o,!0);for(let o of Object.values(t.compilerInput.localize)){if(void 0!==o.remove){const e=InlineControlContainer.getInlineRecordContainer(n+o.remove);e.parentElement.removeChild(e)}e.memorizeAddRecord(o.uid,null,o.selectedValue)}})})).delegateTo(this.container,Selectors.synchronizeLocalizeRecordButtonSelector)}registerUniqueSelectFieldChanged(){const e=this;new RegularEvent("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.closest("[data-object-id]");if(null!==n){const t=n.dataset.objectId,o=n.dataset.objectUid;e.handleChangedField(this,t);const i=e.getFormFieldForElements();if(null===i)return;e.updateUnique(this,i,o)}})).delegateTo(this.container,Selectors.uniqueValueSelectors)}registerRevertUniquenessAction(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.revertUnique(this.dataset.uid)})).delegateTo(this.container,Selectors.revertUniqueness)}loadRecordDetails(e){const t=document.getElementById(e+"_fields"),n=InlineControlContainer.getInlineRecordContainer(e),o=void 0!==this.requestQueue[e];if(null!==t&&!n.classList.contains(States.notLoaded))this.collapseExpandRecord(e);else{const i=this.getProgress(e,n.dataset.objectIdHash);if(o)this.requestQueue[e].abort(),delete this.requestQueue[e],delete this.progessQueue[e],i.done();else{const o=this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_details"));this.ajaxDispatcher.send(o,[e]).then(async o=>{if(delete this.requestQueue[e],delete this.progessQueue[e],n.classList.remove(States.notLoaded),t.innerHTML=o.data,this.collapseExpandRecord(e),i.done(),FormEngine.reinitialize(),FormEngineValidation.initializeInputFields(),FormEngineValidation.validate(this.container),this.hasObjectGroupDefinedUniqueConstraints()){const t=InlineControlContainer.getInlineRecordContainer(e);this.removeUsed(t)}}),this.requestQueue[e]=o,i.start()}}}collapseExpandRecord(e){const t=InlineControlContainer.getInlineRecordContainer(e),n=!0===this.getAppearance().expandSingle,o=t.classList.contains(States.collapsed);let i=[];const r=[];n&&o&&(i=this.collapseAllRecords(t.dataset.objectUid)),InlineControlContainer.toggleElement(e),InlineControlContainer.isNewRecord(e)?InlineControlContainer.updateExpandedCollapsedStateLocally(e,o):o?r.push(t.dataset.objectUid):o||i.push(t.dataset.objectUid),this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("record_inline_expandcollapse")),[e,r.join(","),i.join(",")])}memorizeAddRecord(e,t=null,n=null){const o=this.getFormFieldForElements();if(null===o)return;let i=Utility.trimExplode(",",o.value);if(t){const n=[];for(let o=0;o<i.length;o++)i[o].length&&n.push(i[o]),t===i[o]&&n.push(e);i=n}else i.push(e);o.value=i.join(","),o.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,i),this.setUnique(e,n),this.isBelowMax()||this.toggleContainerControls(!1),FormEngine.reinitialize(),FormEngineValidation.initializeInputFields(),FormEngineValidation.validate(this.container)}memorizeRemoveRecord(e){const t=this.getFormFieldForElements();if(null===t)return[];let n=Utility.trimExplode(",",t.value);const o=n.indexOf(e);return o>-1&&(delete n[o],t.value=n.join(","),t.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,n)),n}changeSortingByButton(e,t){const n=InlineControlContainer.getInlineRecordContainer(e),o=n.dataset.objectUid,i=document.getElementById(this.container.getAttribute("id")+"_records"),r=Array.from(i.children).map(e=>e.dataset.objectUid);let a=r.indexOf(o),s=!1;if(t===SortDirections.UP&&a>0?(r[a]=r[a-1],r[a-1]=o,s=!0):t===SortDirections.DOWN&&a<r.length-1&&(r[a]=r[a+1],r[a+1]=o,s=!0),s){const e=this.container.dataset.objectGroup+Separators.structureSeparator,o=t===SortDirections.UP?1:0;n.parentElement.insertBefore(InlineControlContainer.getInlineRecordContainer(e+r[a-o]),InlineControlContainer.getInlineRecordContainer(e+r[a+1-o])),this.updateSorting()}}updateSorting(){const e=this.getFormFieldForElements();if(null===e)return;const t=document.getElementById(this.container.getAttribute("id")+"_records"),n=Array.from(t.querySelectorAll('[data-object-parent-group="'+this.container.dataset.objectGroup+'"][data-placeholder-record="0"]')).map(e=>e.dataset.objectUid);e.value=n.join(","),e.classList.add("has-change"),document.dispatchEvent(new Event("inline:sorting-changed")),document.dispatchEvent(new Event("change")),this.redrawSortingButtons(this.container.dataset.objectGroup,n)}deleteRecord(e,t=!1){const n=InlineControlContainer.getInlineRecordContainer(e),o=n.dataset.objectUid;if(n.classList.add("t3js-inline-record-deleted"),!InlineControlContainer.isNewRecord(e)&&!t){const e=this.container.querySelector('[name="cmd'+n.dataset.fieldName+'[delete]"]');e.removeAttribute("disabled"),n.parentElement.insertAdjacentElement("afterbegin",e)}new RegularEvent("transitionend",()=>{n.parentElement.removeChild(n),FormEngineValidation.validate(this.container)}).bindTo(n),this.revertUnique(o),this.memorizeRemoveRecord(o),n.classList.add("form-irre-object--deleted"),this.isBelowMax()&&this.toggleContainerControls(!0)}toggleContainerControls(e){const t=this.container.querySelector(Selectors.controlContainer);if(null===t)return;t.querySelectorAll("button, a").forEach(t=>{t.style.display=e?null:"none"})}getProgress(e,t){const n="#"+t+"_header";let o;return void 0!==this.progessQueue[e]?o=this.progessQueue[e]:(o=NProgress,o.configure({parent:n,showSpinner:!1}),this.progessQueue[e]=o),o}collapseAllRecords(e){const t=this.getFormFieldForElements(),n=[];if(null!==t){const o=Utility.trimExplode(",",t.value);for(let t of o){if(t===e)continue;const o=this.container.dataset.objectGroup+Separators.structureSeparator+t,i=InlineControlContainer.getInlineRecordContainer(o);i.classList.contains(States.visible)&&(InlineControlContainer.collapseElement(i,o),InlineControlContainer.isNewRecord(o)?InlineControlContainer.updateExpandedCollapsedStateLocally(o,!1):n.push(t))}}return n}getFormFieldForElements(){const e=document.getElementsByName(this.container.dataset.formField);return e.length>0?e[0]:null}redrawSortingButtons(e,t=[]){if(0===t.length){const e=this.getFormFieldForElements();null!==e&&(t=Utility.trimExplode(",",e.value))}0!==t.length&&t.forEach((n,o)=>{const i=InlineControlContainer.getInlineRecordContainer(e+Separators.structureSeparator+n).dataset.objectIdHash+"_header",r=document.getElementById(i),a=r.querySelector('[data-action="sort"][data-direction="'+SortDirections.UP+'"]');if(null!==a){let e="actions-move-up";0===o?(a.classList.add("disabled"),e="empty-empty"):a.classList.remove("disabled"),Icons.getIcon(e,Icons.sizes.small).then(e=>{a.replaceChild(document.createRange().createContextualFragment(e),a.querySelector(".t3js-icon"))})}const s=r.querySelector('[data-action="sort"][data-direction="'+SortDirections.DOWN+'"]');if(null!==s){let e="actions-move-down";o===t.length-1?(s.classList.add("disabled"),e="empty-empty"):s.classList.remove("disabled"),Icons.getIcon(e,Icons.sizes.small).then(e=>{s.replaceChild(document.createRange().createContextualFragment(e),s.querySelector(".t3js-icon"))})}})}isBelowMax(){const e=this.getFormFieldForElements();if(null===e)return!0;if(void 0!==TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup]){if(Utility.trimExplode(",",e.value).length>=TYPO3.settings.FormEngineInline.config[this.container.dataset.objectGroup].max)return!1;if(this.hasObjectGroupDefinedUniqueConstraints()){const e=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if(e.used.length>=e.max&&e.max>=0)return!1}}return!0}isUniqueElementUsed(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return!1;const n=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],o=InlineControlContainer.getValuesFromHashMap(n.used);if("select"===n.type&&-1!==o.indexOf(e))return!0;if("groupdb"===n.type)for(let n=o.length-1;n>=0;n--)if(o[n].table===t&&o[n].uid===e)return!0;return!1}removeUsed(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"!==t.type)return;let n=e.querySelector('[name="data['+t.table+"]["+e.dataset.objectUid+"]["+t.field+']"]');const o=InlineControlContainer.getValuesFromHashMap(t.used);if(null!==n){const e=n.options[n.selectedIndex].value;for(let t of o)t!==e&&InlineControlContainer.removeSelectOptionByValue(n,t)}}setUnique(e,t){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const n=document.getElementById(this.container.dataset.objectGroup+"_selector"),o=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];if("select"===o.type){if(!o.selector||-1!==o.max){const i=this.getFormFieldForElements(),r=this.container.dataset.objectGroup+Separators.structureSeparator+e;let a=InlineControlContainer.getInlineRecordContainer(r).querySelector('[name="data['+o.table+"]["+e+"]["+o.field+']"]');const s=InlineControlContainer.getValuesFromHashMap(o.used);if(null!==n){if(null!==a){for(let e of s)InlineControlContainer.removeSelectOptionByValue(a,e);o.selector||(t=a.options[0].value,a.options[0].selected=!0,this.updateUnique(a,i,e),this.handleChangedField(a,this.container.dataset.objectGroup+"["+e+"]"))}for(let e of s)InlineControlContainer.removeSelectOptionByValue(a,e);void 0!==o.used.length&&(o.used={}),o.used[e]={table:o.elTable,uid:t}}if(null!==i&&InlineControlContainer.selectOptionValueExists(n,t)){const n=Utility.trimExplode(",",i.value);for(let i of n)a=document.querySelector('[name="data['+o.table+"]["+i+"]["+o.field+']"]'),null!==a&&i!==e&&InlineControlContainer.removeSelectOptionByValue(a,t)}}}else"groupdb"===o.type&&(o.used[e]={table:o.elTable,uid:t});"select"===o.selector&&InlineControlContainer.selectOptionValueExists(n,t)&&(InlineControlContainer.removeSelectOptionByValue(n,t),o.used[e]={table:o.elTable,uid:t})}updateUnique(e,t,n){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const o=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],i=o.used[n];if("select"===o.selector){const t=document.getElementById(this.container.dataset.objectGroup+"_selector");InlineControlContainer.removeSelectOptionByValue(t,e.value),void 0!==i&&InlineControlContainer.reAddSelectOption(t,i,o)}if(o.selector&&-1===o.max)return;if(!o||null===t)return;const r=Utility.trimExplode(",",t.value);let a;for(let t of r)a=document.querySelector('[name="data['+o.table+"]["+t+"]["+o.field+']"]'),null!==a&&a!==e&&(InlineControlContainer.removeSelectOptionByValue(a,e.value),void 0!==i&&InlineControlContainer.reAddSelectOption(a,i,o));o.used[n]=e.value}revertUnique(e){if(!this.hasObjectGroupDefinedUniqueConstraints())return;const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],n=this.container.dataset.objectGroup+Separators.structureSeparator+e,o=InlineControlContainer.getInlineRecordContainer(n);let i=o.querySelector('[name="data['+t.table+"]["+o.dataset.objectUid+"]["+t.field+']"]');if("select"===t.type){let n;if(null!==i)n=i.value;else{if(""===o.dataset.tableUniqueOriginalValue)return;n=o.dataset.tableUniqueOriginalValue}if("select"===t.selector&&!isNaN(parseInt(n,10))){const e=document.getElementById(this.container.dataset.objectGroup+"_selector");InlineControlContainer.reAddSelectOption(e,n,t)}if(t.selector&&-1===t.max)return;const r=this.getFormFieldForElements();if(null===r)return;const a=Utility.trimExplode(",",r.value);let s;for(let e=0;e<a.length;e++)s=document.querySelector('[name="data['+t.table+"]["+a[e]+"]["+t.field+']"]'),null!==s&&InlineControlContainer.reAddSelectOption(s,n,t);delete t.used[e]}else"groupdb"===t.type&&delete t.used[e]}hasObjectGroupDefinedUniqueConstraints(){return void 0!==TYPO3.settings.FormEngineInline.unique&&void 0!==TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup]}handleChangedField(e,t){let n;n=e instanceof HTMLSelectElement?e.options[e.selectedIndex].text:e.value,document.getElementById(t+"_label").textContent=n.length?n:this.noTitleString}getAppearance(){if(null===this.appearance&&(this.appearance={},"string"==typeof this.container.dataset.appearance))try{this.appearance=JSON.parse(this.container.dataset.appearance)}catch(e){console.error(e)}return this.appearance}}export default InlineControlContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/site-language-container.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/site-language-container.js new file mode 100644 index 0000000000000000000000000000000000000000..24fa84e00afea2237820bda9a423f7dd6f741c74 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/container/site-language-container.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{MessageUtility}from"@typo3/backend/utility/message-utility.js";import{AjaxDispatcher}from"@typo3/backend/form-engine/inline-relation/ajax-dispatcher.js";import NProgress from"nprogress";import FormEngine from"@typo3/backend/form-engine.js";import FormEngineValidation from"@typo3/backend/form-engine-validation.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import RegularEvent from"@typo3/core/event/regular-event.js";import Severity from"@typo3/backend/severity.js";import Utility from"@typo3/backend/utility.js";var Selectors,States,Separators;!function(e){e.toggleSelector='[data-bs-toggle="formengine-inline"]',e.controlSectionSelector=".t3js-formengine-irre-control",e.createNewRecordButtonSelector=".t3js-create-new-button",e.createNewRecordBySelectorSelector=".t3js-create-new-selector",e.deleteRecordButtonSelector=".t3js-editform-delete-inline-record"}(Selectors||(Selectors={})),function(e){e.new="inlineIsNewRecord",e.visible="panel-visible",e.collapsed="panel-collapsed",e.notLoaded="t3js-not-loaded"}(States||(States={})),function(e){e.structureSeparator="-"}(Separators||(Separators={}));class SiteLanguageContainer extends HTMLElement{constructor(){super(...arguments),this.container=null,this.ajaxDispatcher=null,this.requestQueue={},this.progessQueue={},this.handlePostMessage=e=>{if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:foreignRelation:insert"===e.data.actionName){if(void 0===e.data.objectGroup)throw"No object group defined for message";if(e.data.objectGroup!==this.container.dataset.objectGroup)return;if(this.isUniqueElementUsed(parseInt(e.data.uid,10)))return void Notification.error("There is already a relation to the selected element");this.importRecord([e.data.objectGroup,e.data.uid]).then(()=>{if(e.source){const t={actionName:"typo3:foreignRelation:inserted",objectGroup:e.data.objectId,table:e.data.table,uid:e.data.uid};MessageUtility.send(t,e.source)}})}}}static getInlineRecordContainer(e){return document.querySelector('[data-object-id="'+e+'"]')}static getValuesFromHashMap(e){return Object.keys(e).map(t=>e[t])}static selectOptionValueExists(e,t){return null!==e.querySelector('option[value="'+t+'"]')}static removeSelectOptionByValue(e,t){const n=e.querySelector('option[value="'+t+'"]');null!==n&&n.remove()}static reAddSelectOption(e,t,n){if(SiteLanguageContainer.selectOptionValueExists(e,t))return;const i=e.querySelectorAll("option");let o=-1;for(let e of Object.keys(n.possible)){if(e===t)break;for(let t=0;t<i.length;++t){if(i[t].value===e){o=t;break}}}-1===o?o=0:o<i.length&&o++;const r=document.createElement("option");r.text=n.possible[t],r.value=t,e.insertBefore(r,e.options[o])}static collapseExpandRecord(e){const t=SiteLanguageContainer.getInlineRecordContainer(e),n=document.querySelector('[aria-controls="'+e+'_fields"]');t.classList.contains(States.collapsed)?(t.classList.remove(States.collapsed),t.classList.add(States.visible),n.setAttribute("aria-expanded","true")):(t.classList.remove(States.visible),t.classList.add(States.collapsed),n.setAttribute("aria-expanded","false"))}connectedCallback(){const e=this.getAttribute("identifier")||"";this.container=this.querySelector("#"+e),null!==this.container&&(this.ajaxDispatcher=new AjaxDispatcher(this.container.dataset.objectGroup),this.registerEvents())}registerEvents(){this.registerCreateRecordButton(),this.registerCreateRecordBySelector(),this.registerRecordToggle(),this.registerDeleteButton(),new RegularEvent("message",this.handlePostMessage).bindTo(window)}registerCreateRecordButton(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation();let n=e.container.dataset.objectGroup;void 0!==this.dataset.recordUid&&(n+=Separators.structureSeparator+this.dataset.recordUid),e.importRecord([n,e.container.querySelector(Selectors.createNewRecordBySelectorSelector)?.value],this.dataset.recordUid??null)})).delegateTo(this.container,Selectors.createNewRecordButtonSelector)}registerCreateRecordBySelector(){const e=this;new RegularEvent("change",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=this.options[this.selectedIndex].getAttribute("value");e.importRecord([e.container.dataset.objectGroup,n])})).delegateTo(this.container,Selectors.createNewRecordBySelectorSelector)}registerRecordToggle(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation(),e.loadRecordDetails(this.closest(Selectors.toggleSelector).parentElement.dataset.objectId)})).delegateTo(this.container,`${Selectors.toggleSelector} .form-irre-header-cell:not(${Selectors.controlSectionSelector}`)}registerDeleteButton(){const e=this;new RegularEvent("click",(function(t){t.preventDefault(),t.stopImmediatePropagation();const n=TYPO3.lang["label.confirm.delete_record.title"]||"Delete this record?",i=TYPO3.lang["label.confirm.delete_record.content"]||"Are you sure you want to delete this record?";Modal.confirm(n,i,Severity.warning,[{text:TYPO3.lang["buttons.confirm.delete_record.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["buttons.confirm.delete_record.yes"]||"Yes, delete this record",btnClass:"btn-warning",name:"yes",trigger:()=>{e.deleteRecord(this.closest("[data-object-id]").dataset.objectId),Modal.currentModal.trigger("modal-dismiss")}}])})).delegateTo(this.container,Selectors.deleteRecordButtonSelector)}createRecord(e,t,n=null,i=null){let o=this.container.dataset.objectGroup;null!==n?(o+=Separators.structureSeparator+n,SiteLanguageContainer.getInlineRecordContainer(o).insertAdjacentHTML("afterend",t),this.memorizeAddRecord(e,n,i)):(document.getElementById(this.container.getAttribute("id")+"_records").insertAdjacentHTML("beforeend",t),this.memorizeAddRecord(e,null,i))}async importRecord(e,t){return this.ajaxDispatcher.send(this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("site_configuration_inline_create")),e).then(async e=>{this.createRecord(e.compilerInput.uid,e.data,void 0!==t?t:null,void 0!==e.compilerInput.childChildUid?e.compilerInput.childChildUid:null)})}loadRecordDetails(e){const t=document.getElementById(e+"_fields"),n=SiteLanguageContainer.getInlineRecordContainer(e),i=void 0!==this.requestQueue[e];if(null!==t&&!n.classList.contains(States.notLoaded))SiteLanguageContainer.collapseExpandRecord(e);else{const o=this.getProgress(e,n.dataset.objectIdHash);if(i)this.requestQueue[e].abort(),delete this.requestQueue[e],delete this.progessQueue[e],o.done();else{const i=this.ajaxDispatcher.newRequest(this.ajaxDispatcher.getEndpoint("site_configuration_inline_details"));this.ajaxDispatcher.send(i,[e]).then(async i=>{delete this.requestQueue[e],delete this.progessQueue[e],n.classList.remove(States.notLoaded),t.innerHTML=i.data,SiteLanguageContainer.collapseExpandRecord(e),o.done(),FormEngine.reinitialize(),FormEngineValidation.initializeInputFields(),FormEngineValidation.validate(this.container),this.removeUsed(SiteLanguageContainer.getInlineRecordContainer(e))}),this.requestQueue[e]=i,o.start()}}}memorizeAddRecord(e,t=null,n=null){const i=this.getFormFieldForElements();if(null===i)return;let o=Utility.trimExplode(",",i.value);if(t){const n=[];for(let i=0;i<o.length;i++)o[i].length&&n.push(o[i]),t===o[i]&&n.push(e);o=n}else o.push(e);i.value=o.join(","),i.classList.add("has-change"),document.dispatchEvent(new Event("change")),this.setUnique(e,n),FormEngine.reinitialize(),FormEngineValidation.initializeInputFields(),FormEngineValidation.validate(this.container)}memorizeRemoveRecord(e){const t=this.getFormFieldForElements();if(null===t)return[];let n=Utility.trimExplode(",",t.value);const i=n.indexOf(e);return i>-1&&(delete n[i],t.value=n.join(","),t.classList.add("has-change"),document.dispatchEvent(new Event("change"))),n}deleteRecord(e,t=!1){const n=SiteLanguageContainer.getInlineRecordContainer(e),i=n.dataset.objectUid;if(n.classList.add("t3js-inline-record-deleted"),!n.classList.contains(States.new)&&!t){const e=this.container.querySelector('[name="cmd'+n.dataset.fieldName+'[delete]"]');e.removeAttribute("disabled"),n.parentElement.insertAdjacentElement("afterbegin",e)}new RegularEvent("transitionend",()=>{n.parentElement.removeChild(n),FormEngineValidation.validate(this.container)}).bindTo(n),this.revertUnique(i),this.memorizeRemoveRecord(i),n.classList.add("form-irre-object--deleted")}getProgress(e,t){const n="#"+t+"_header";let i;return void 0!==this.progessQueue[e]?i=this.progessQueue[e]:(i=NProgress,i.configure({parent:n,showSpinner:!1}),this.progessQueue[e]=i),i}getFormFieldForElements(){const e=document.getElementsByName(this.container.dataset.formField);return e.length>0?e[0]:null}isUniqueElementUsed(e){const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup];return-1!==SiteLanguageContainer.getValuesFromHashMap(t.used).indexOf(e)}removeUsed(e){const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],n=SiteLanguageContainer.getValuesFromHashMap(t.used);let i=e.querySelector('[name="data['+t.table+"]["+e.dataset.objectUid+"]["+t.field+']"]');if(null!==i){const e=i.options[i.selectedIndex].value;for(let t of n)t!==e&&SiteLanguageContainer.removeSelectOptionByValue(i,t)}}setUnique(e,t){const n=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],i=document.getElementById(this.container.dataset.objectGroup+"_selector");if(-1!==n.max){const o=this.getFormFieldForElements(),r=this.container.dataset.objectGroup+Separators.structureSeparator+e;let a=SiteLanguageContainer.getInlineRecordContainer(r).querySelector('[name="data['+n.table+"]["+e+"]["+n.field+']"]');const s=SiteLanguageContainer.getValuesFromHashMap(n.used);if(null!==i){if(null!==a)for(let e of s)SiteLanguageContainer.removeSelectOptionByValue(a,e);for(let e of s)SiteLanguageContainer.removeSelectOptionByValue(a,e);void 0!==n.used.length&&(n.used={}),n.used[e]={table:n.elTable,uid:t}}if(null!==o&&SiteLanguageContainer.selectOptionValueExists(i,t)){const i=Utility.trimExplode(",",o.value);for(let o of i)a=document.querySelector('[name="data['+n.table+"]["+o+"]["+n.field+']"]'),null!==a&&o!==e&&SiteLanguageContainer.removeSelectOptionByValue(a,t)}}SiteLanguageContainer.selectOptionValueExists(i,t)&&(SiteLanguageContainer.removeSelectOptionByValue(i,t),n.used[e]={table:n.elTable,uid:t})}revertUnique(e){const t=TYPO3.settings.FormEngineInline.unique[this.container.dataset.objectGroup],n=this.container.dataset.objectGroup+Separators.structureSeparator+e,i=SiteLanguageContainer.getInlineRecordContainer(n);let o,r=i.querySelector('[name="data['+t.table+"]["+i.dataset.objectUid+"]["+t.field+']"]');if(null!==r)o=r.value;else{if(""===i.dataset.tableUniqueOriginalValue)return;o=i.dataset.tableUniqueOriginalValue.replace(t.table+"_","")}if(!isNaN(parseInt(o,10))&&0x8000000000000000!==parseInt(o,10)){const e=document.getElementById(this.container.dataset.objectGroup+"_selector");SiteLanguageContainer.reAddSelectOption(e,o,t)}if(-1===t.max)return;const a=this.getFormFieldForElements();if(null===a)return;const s=Utility.trimExplode(",",a.value);let l;for(let e=0;e<s.length;e++)l=document.querySelector('[name="data['+t.table+"]["+s[e]+"]["+t.field+']"]'),null!==l&&SiteLanguageContainer.reAddSelectOption(l,o,t);delete t.used[e]}}window.customElements.define("typo3-formengine-container-sitelanguage",SiteLanguageContainer); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/abstract-sortable-select-items.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/abstract-sortable-select-items.js new file mode 100644 index 0000000000000000000000000000000000000000..b1189ef7e94a4038b9cbfa564db6b3e36c3dafb6 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/abstract-sortable-select-items.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import FormEngine from"@typo3/backend/form-engine.js";import FormEngineValidation from"@typo3/backend/form-engine-validation.js";export class AbstractSortableSelectItems{constructor(){this.registerSortableEventHandler=e=>{const t=e.closest(".form-wizards-wrap").querySelector(".form-wizards-items-aside");null!==t&&t.addEventListener("click",t=>{let o;if(null===(o=t.target.closest(".t3js-btn-option")))return void(t.target.matches(".t3js-btn-option")&&(o=t.target));t.preventDefault();const n=o.dataset.fieldname,r=FormEngine.getFieldElement(n).get(0),i=FormEngine.getFieldElement(n,"_avail").get(0);o.classList.contains("t3js-btn-moveoption-top")?AbstractSortableSelectItems.moveOptionToTop(e):o.classList.contains("t3js-btn-moveoption-up")?AbstractSortableSelectItems.moveOptionUp(e):o.classList.contains("t3js-btn-moveoption-down")?AbstractSortableSelectItems.moveOptionDown(e):o.classList.contains("t3js-btn-moveoption-bottom")?AbstractSortableSelectItems.moveOptionToBottom(e):o.classList.contains("t3js-btn-removeoption")&&AbstractSortableSelectItems.removeOption(e,i),FormEngine.updateHiddenFieldValueFromSelect(e,r),FormEngine.legacyFieldChangedCb(),FormEngineValidation.markFieldAsChanged(i),FormEngineValidation.validateField(i)})}}static moveOptionToTop(e){Array.from(e.querySelectorAll(":checked")).reverse().forEach(t=>{e.insertBefore(t,e.firstElementChild)})}static moveOptionToBottom(e){e.querySelectorAll(":checked").forEach(t=>{e.insertBefore(t,null)})}static moveOptionUp(e){const t=Array.from(e.children),o=Array.from(e.querySelectorAll(":checked"));for(let n of o){if(0===t.indexOf(n)&&null===n.previousElementSibling)break;e.insertBefore(n,n.previousElementSibling)}}static moveOptionDown(e){const t=Array.from(e.children).reverse(),o=Array.from(e.querySelectorAll(":checked")).reverse();for(let n of o){if(0===t.indexOf(n)&&null===n.nextElementSibling)break;e.insertBefore(n,n.nextElementSibling.nextElementSibling)}}static removeOption(e,t){e.querySelectorAll(":checked").forEach(o=>{const n=t.querySelector('option[value="'+o.value+'"]');null!==n&&(n.classList.remove("hidden"),n.disabled=!1,FormEngine.enableOptGroup(n)),e.removeChild(o)})}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/category-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/category-element.js new file mode 100644 index 0000000000000000000000000000000000000000..5016ea04d8b915552d979019db268945ce84da13 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/category-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"@typo3/backend/form-engine/element/select-tree.js";import"@typo3/backend/form-engine/element/select-tree-toolbar.js";import"@typo3/backend/element/icon-element.js";class CategoryElement extends HTMLElement{constructor(){super(...arguments),this.recordField=null,this.treeWrapper=null,this.tree=null,this.selectNode=e=>{const t=e.detail.node;this.updateAncestorsIndeterminateState(t),this.calculateIndeterminate(this.tree.nodes),this.saveCheckboxes(),this.tree.setup.input.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},this.loadDataAfter=()=>{this.tree.nodes=this.tree.nodes.map(e=>(e.indeterminate=!1,e)),this.calculateIndeterminate(this.tree.nodes)},this.saveCheckboxes=()=>{this.recordField.value=this.tree.getSelectedNodes().map(e=>e.identifier).join(",")}}connectedCallback(){this.recordField=this.querySelector("#"+(this.getAttribute("recordFieldId")||"")),this.treeWrapper=this.querySelector("#"+(this.getAttribute("treeWrapperId")||"")),this.recordField&&this.treeWrapper&&(this.tree=document.createElement("typo3-backend-form-selecttree"),this.tree.classList.add("svg-tree-wrapper"),this.tree.setup={id:this.treeWrapper.id,dataUrl:this.generateDataUrl(),readOnlyMode:this.recordField.dataset.readOnly,input:this.recordField,exclusiveNodesIdentifiers:this.recordField.dataset.treeExclusiveKeys,validation:JSON.parse(this.recordField.dataset.formengineValidationRules)[0],expandUpToLevel:this.recordField.dataset.treeExpandUpToLevel,unselectableElements:[]},this.treeWrapper.append(this.tree),this.registerTreeEventListeners())}registerTreeEventListeners(){this.tree.addEventListener("typo3:svg-tree:nodes-prepared",this.loadDataAfter),this.tree.addEventListener("typo3:svg-tree:node-selected",this.selectNode),this.tree.addEventListener("svg-tree:initialized",()=>{if(this.recordField.dataset.treeShowToolbar){const e=document.createElement("typo3-backend-form-selecttree-toolbar");e.tree=this.tree,this.tree.prepend(e)}}),this.listenForVisibleTree()}listenForVisibleTree(){if(!this.tree.offsetParent){const e=this.tree.closest(".tab-pane").getAttribute("id");if(e){document.querySelector('[aria-controls="'+e+'"]').addEventListener("shown.bs.tab",()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))})}}}generateDataUrl(){return TYPO3.settings.ajaxUrls.record_tree_data+"&"+new URLSearchParams({uid:this.recordField.dataset.uid,command:this.recordField.dataset.command,tableName:this.recordField.dataset.tablename,fieldName:this.recordField.dataset.fieldname,defaultValues:this.recordField.dataset.defaultvalues,overrideValues:this.recordField.dataset.overridevalues,recordTypeValue:this.recordField.dataset.recordtypevalue,flexFormSheetName:this.recordField.dataset.flexformsheetname,flexFormFieldName:this.recordField.dataset.flexformfieldname,flexFormContainerName:this.recordField.dataset.flexformcontainername,dataStructureIdentifier:this.recordField.dataset.datastructureidentifier,flexFormContainerFieldName:this.recordField.dataset.flexformcontainerfieldname,flexFormContainerIdentifier:this.recordField.dataset.flexformcontaineridentifier,flexFormSectionContainerIsNew:this.recordField.dataset.flexformsectioncontainerisnew})}updateAncestorsIndeterminateState(e){let t=!1;e.parents.forEach(e=>{const r=this.tree.nodes[e];r.indeterminate=r.checked||r.indeterminate||t,t=r.checked||r.indeterminate||r.checked||r.indeterminate})}calculateIndeterminate(e){e.forEach(t=>{(t.checked||t.indeterminate)&&t.parents&&t.parents.length>0&&t.parents.forEach(t=>{e[t].indeterminate=!0})})}}window.customElements.define("typo3-formengine-element-category",CategoryElement); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/extra/select-box-filter.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/extra/select-box-filter.js new file mode 100644 index 0000000000000000000000000000000000000000..7464685a3b6201ccc0d3a1a43be9d86624be7a34 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/extra/select-box-filter.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import RegularEvent from"@typo3/core/event/regular-event.js";var Selectors;!function(e){e.fieldContainerSelector=".t3js-formengine-field-group",e.filterTextFieldSelector=".t3js-formengine-multiselect-filter-textfield",e.filterSelectFieldSelector=".t3js-formengine-multiselect-filter-dropdown"}(Selectors||(Selectors={}));class SelectBoxFilter{constructor(e){this.selectElement=null,this.filterText="",this.availableOptions=null,this.selectElement=e,this.initializeEvents()}static toggleOptGroup(e){const t=e.parentElement;t instanceof HTMLOptGroupElement&&(0===t.querySelectorAll("option:not([hidden]):not([disabled]):not(.hidden)").length?t.hidden=!0:(t.hidden=!1,t.disabled=!1,t.classList.remove("hidden")))}initializeEvents(){const e=this.selectElement.closest(".form-wizards-element");null!==e&&(new RegularEvent("input",e=>{this.filter(e.target.value)}).delegateTo(e,Selectors.filterTextFieldSelector),new RegularEvent("change",e=>{this.filter(e.target.value)}).delegateTo(e,Selectors.filterSelectFieldSelector))}filter(e){this.filterText=e,null===this.availableOptions&&(this.availableOptions=this.selectElement.querySelectorAll("option"));const t=new RegExp(e,"i");this.availableOptions.forEach(l=>{l.hidden=e.length>0&&null===l.textContent.match(t),SelectBoxFilter.toggleOptGroup(l)})}}export default SelectBoxFilter; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/group-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/group-element.js new file mode 100644 index 0000000000000000000000000000000000000000..21c2a836b0340df4998189a58cc9b555b9079e90 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/group-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{AbstractSortableSelectItems}from"@typo3/backend/form-engine/element/abstract-sortable-select-items.js";import DocumentService from"@typo3/core/document-service.js";import FormEngineSuggest from"@typo3/backend/form-engine-suggest.js";class GroupElement extends AbstractSortableSelectItems{constructor(e){super(),this.element=null,DocumentService.ready().then(()=>{this.element=document.getElementById(e),this.registerEventHandler(),this.registerSuggest()})}registerEventHandler(){this.registerSortableEventHandler(this.element)}registerSuggest(){let e;null!==(e=this.element.closest(".t3js-formengine-field-item").querySelector(".t3-form-suggest"))&&new FormEngineSuggest(e)}}export default GroupElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/input-date-time-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/input-date-time-element.js new file mode 100644 index 0000000000000000000000000000000000000000..14104104620499456b6359deccd0e14a7dd12eae --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/input-date-time-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import FormEngineValidation from"@typo3/backend/form-engine-validation.js";import RegularEvent from"@typo3/core/event/regular-event.js";class InputDateTimeElement{constructor(e){this.element=null,DocumentService.ready().then(()=>{this.element=document.getElementById(e),this.registerEventHandler(this.element),import("@typo3/backend/date-time-picker.js").then(({default:e})=>{e.initialize(this.element)})})}registerEventHandler(e){new RegularEvent("formengine.dp.change",e=>{FormEngineValidation.validateField(e.target),FormEngineValidation.markFieldAsChanged(e.target),document.querySelectorAll(".module-docheader-bar .btn").forEach(e=>{e.classList.remove("disabled"),e.disabled=!1})}).bindTo(e)}}export default InputDateTimeElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/input-link-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/input-link-element.js new file mode 100644 index 0000000000000000000000000000000000000000..dd5ddf9e1921591c4179125df2ae37fea4482cfc --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/input-link-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";var Selectors;!function(e){e.toggleSelector=".t3js-form-field-inputlink-explanation-toggle",e.inputFieldSelector=".t3js-form-field-inputlink-input",e.explanationSelector=".t3js-form-field-inputlink-explanation",e.iconSelector=".t3js-form-field-inputlink-icon"}(Selectors||(Selectors={}));class InputLinkElement{constructor(e){this.element=null,this.container=null,this.toggleSelector=null,this.explanationField=null,this.icon=null,DocumentService.ready().then(t=>{this.element=t.getElementById(e),this.container=this.element.closest(".t3js-form-field-inputlink"),this.toggleSelector=this.container.querySelector(Selectors.toggleSelector),this.explanationField=this.container.querySelector(Selectors.explanationSelector),this.icon=this.container.querySelector(Selectors.iconSelector),this.toggleVisibility(""===this.explanationField.value),this.registerEventHandler()})}toggleVisibility(e){this.explanationField.classList.toggle("hidden",e),this.element.classList.toggle("hidden",!e)}registerEventHandler(){this.toggleSelector.addEventListener("click",e=>{e.preventDefault();const t=!this.explanationField.classList.contains("hidden");this.toggleVisibility(t)}),this.container.querySelector(Selectors.inputFieldSelector).addEventListener("change",()=>{const e=!this.explanationField.classList.contains("hidden");e&&this.toggleVisibility(e),this.disableToggle(),this.clearIcon()})}disableToggle(){this.toggleSelector.classList.add("disabled"),this.toggleSelector.setAttribute("disabled","disabled")}clearIcon(){this.icon.innerHTML=""}}export default InputLinkElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/mfa-info-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/mfa-info-element.js new file mode 100644 index 0000000000000000000000000000000000000000..4bd1d228869dd351b0fb149220b1787c5272471d --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/mfa-info-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import DocumentService from"@typo3/core/document-service.js";import RegularEvent from"@typo3/core/event/regular-event.js";import Notification from"@typo3/backend/notification.js";import Modal from"@typo3/backend/modal.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";var Selectors;!function(t){t.deactivteProviderButton=".t3js-deactivate-provider-button",t.deactivteMfaButton=".t3js-deactivate-mfa-button",t.providerslist=".t3js-mfa-active-providers-list",t.mfaStatusLabel=".t3js-mfa-status-label"}(Selectors||(Selectors={}));class MfaInfoElement{constructor(t,e){this.options=null,this.fullElement=null,this.deactivteProviderButtons=null,this.deactivteMfaButton=null,this.providersList=null,this.mfaStatusLabel=null,this.request=null,this.options=e,DocumentService.ready().then(e=>{this.fullElement=e.querySelector(t),this.deactivteProviderButtons=this.fullElement.querySelectorAll(Selectors.deactivteProviderButton),this.deactivteMfaButton=this.fullElement.querySelector(Selectors.deactivteMfaButton),this.providersList=this.fullElement.querySelector(Selectors.providerslist),this.mfaStatusLabel=this.fullElement.parentElement.querySelector(Selectors.mfaStatusLabel),this.registerEvents()})}registerEvents(){new RegularEvent("click",t=>{t.preventDefault(),this.prepareDeactivateRequest(this.deactivteMfaButton)}).bindTo(this.deactivteMfaButton),this.deactivteProviderButtons.forEach(t=>{new RegularEvent("click",e=>{e.preventDefault(),this.prepareDeactivateRequest(t)}).bindTo(t)})}prepareDeactivateRequest(t){const e=Modal.show(t.dataset.confirmationTitle||t.getAttribute("title")||"Deactivate provider(s)",t.dataset.confirmationContent||"Are you sure you want to continue? This action cannot be undone and will be applied immediately!",SeverityEnum.warning,[{text:t.dataset.confirmationCancelText||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:t.dataset.confirmationDeactivateText||"Deactivate",btnClass:"btn-warning",name:"deactivate",trigger:()=>{this.sendDeactivateRequest(t.dataset.provider)}}]);e.on("button.clicked",()=>{e.modal("hide")})}sendDeactivateRequest(t){this.request instanceof AjaxRequest&&this.request.abort(),this.request=new AjaxRequest(TYPO3.settings.ajaxUrls.mfa),this.request.post({action:"deactivate",provider:t,userId:this.options.userId,tableName:this.options.tableName}).then(async e=>{const a=await e.resolve();if(a.status.length>0&&a.status.forEach(t=>{a.success?Notification.success(t.title,t.message):Notification.error(t.title,t.message)}),!a.success)return;if(void 0===t||0===a.remaining)return void this.deactivateMfa();if(null===this.providersList)return;const i=this.providersList.querySelector("li#provider-"+t);if(null===i)return;i.remove();0===this.providersList.querySelectorAll("li").length&&this.deactivateMfa()}).finally(()=>{this.request=null})}deactivateMfa(){this.deactivteMfaButton.classList.add("disabled"),this.deactivteMfaButton.setAttribute("disabled","disabled"),null!==this.providersList&&this.providersList.remove(),null!==this.mfaStatusLabel&&(this.mfaStatusLabel.innerText=this.mfaStatusLabel.dataset.alternativeLabel,this.mfaStatusLabel.classList.remove("label-success"),this.mfaStatusLabel.classList.add("label-danger"))}}export default MfaInfoElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/Modifier/Resizable.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/modifier/resizable.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/Modifier/Resizable.js rename to typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/modifier/resizable.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/Modifier/Tabbable.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/modifier/tabbable.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/Modifier/Tabbable.js rename to typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/modifier/tabbable.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-check-box-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-check-box-element.js new file mode 100644 index 0000000000000000000000000000000000000000..6406fb43707917b495b213ca7a18f04608c5367b --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-check-box-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import RegularEvent from"@typo3/core/event/regular-event.js";var Identifier;!function(e){e.toggleAll=".t3js-toggle-checkboxes",e.singleItem=".t3js-checkbox",e.revertSelection=".t3js-revert-selection"}(Identifier||(Identifier={}));class SelectCheckBoxElement{constructor(e){this.checkBoxId="",this.table=null,this.checkedBoxes=null,this.checkBoxId=e,DocumentService.ready().then(t=>{this.table=t.getElementById(e).closest("table"),this.checkedBoxes=this.table.querySelectorAll(Identifier.singleItem+":checked"),this.enableTriggerCheckBox(),this.registerEventHandler()})}static allCheckBoxesAreChecked(e){const t=Array.from(e);return e.length===t.filter(e=>e.checked).length}registerEventHandler(){new RegularEvent("change",(e,t)=>{const l=this.table.querySelectorAll(Identifier.singleItem),c=!SelectCheckBoxElement.allCheckBoxesAreChecked(l);l.forEach(e=>{e.checked=c}),t.checked=c}).delegateTo(this.table,Identifier.toggleAll),new RegularEvent("change",this.setToggleAllState.bind(this)).delegateTo(this.table,Identifier.singleItem),new RegularEvent("click",()=>{const e=this.table.querySelectorAll(Identifier.singleItem),t=Array.from(this.checkedBoxes);e.forEach(e=>{e.checked=t.includes(e)}),this.setToggleAllState()}).delegateTo(this.table,Identifier.revertSelection)}setToggleAllState(){const e=this.table.querySelectorAll(Identifier.singleItem);this.table.querySelector(Identifier.toggleAll).checked=SelectCheckBoxElement.allCheckBoxesAreChecked(e)}enableTriggerCheckBox(){const e=this.table.querySelectorAll(Identifier.singleItem);document.getElementById(this.checkBoxId).checked=SelectCheckBoxElement.allCheckBoxesAreChecked(e)}}export default SelectCheckBoxElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-multiple-side-by-side-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-multiple-side-by-side-element.js new file mode 100644 index 0000000000000000000000000000000000000000..071acc3abb591c9cf2b7a73dac428922989b863b --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-multiple-side-by-side-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{AbstractSortableSelectItems}from"@typo3/backend/form-engine/element/abstract-sortable-select-items.js";import DocumentService from"@typo3/core/document-service.js";import FormEngine from"@typo3/backend/form-engine.js";import SelectBoxFilter from"@typo3/backend/form-engine/element/extra/select-box-filter.js";class SelectMultipleSideBySideElement extends AbstractSortableSelectItems{constructor(e,t){super(),this.selectedOptionsElement=null,this.availableOptionsElement=null,DocumentService.ready().then(l=>{this.selectedOptionsElement=l.getElementById(e),this.availableOptionsElement=l.getElementById(t),this.registerEventHandler()})}registerEventHandler(){this.registerSortableEventHandler(this.selectedOptionsElement),this.availableOptionsElement.addEventListener("click",e=>{const t=e.currentTarget,l=t.dataset.relatedfieldname;if(l){const e=t.dataset.exclusivevalues,i=t.querySelectorAll("option:checked");i.length>0&&i.forEach(t=>{FormEngine.setSelectOptionFromExternalSource(l,t.value,t.textContent,t.getAttribute("title"),e,t)})}}),new SelectBoxFilter(this.availableOptionsElement)}}export default SelectMultipleSideBySideElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-single-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-single-element.js new file mode 100644 index 0000000000000000000000000000000000000000..d3dd41c0c22b010dc34a10cda8aa381e6ec379b8 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-single-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import RegularEvent from"@typo3/core/event/regular-event.js";import DocumentService from"@typo3/core/document-service.js";import FormEngine from"@typo3/backend/form-engine.js";class SelectSingleElement{constructor(){this.initialize=(e,t)=>{let n=document.querySelector(e);t=t||{},new RegularEvent("change",e=>{const t=e.target,n=t.parentElement.querySelector(".input-group-icon");null!==n&&(n.innerHTML=t.options[t.selectedIndex].dataset.icon);const c=t.closest(".t3js-formengine-field-item").querySelector(".t3js-forms-select-single-icons");if(null!==c){const e=c.querySelector(".item.active");null!==e&&e.classList.remove("active");const n=c.querySelector('[data-select-index="'+t.selectedIndex+'"]');null!==n&&n.closest(".item").classList.add("active")}}).bindTo(n),t.onChange instanceof Array&&new RegularEvent("change",()=>FormEngine.processOnFieldChange(t.onChange)).bindTo(n),new RegularEvent("click",(e,t)=>{const c=t.closest(".t3js-forms-select-single-icons").querySelector(".item.active");null!==c&&c.classList.remove("active"),n.selectedIndex=parseInt(t.dataset.selectIndex,10),n.dispatchEvent(new Event("change")),t.closest(".item").classList.add("active")}).delegateTo(n.closest(".form-control-wrap"),".t3js-forms-select-single-icons .item:not(.active) a")}}initializeOnReady(e,t){DocumentService.ready().then(()=>{this.initialize(e,t)})}}export default new SelectSingleElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-tree-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-tree-element.js new file mode 100644 index 0000000000000000000000000000000000000000..e5fae592b61d1b929c5ede17b2179932da92fd0d --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-tree-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"@typo3/backend/form-engine/element/select-tree.js";import"@typo3/backend/form-engine/element/select-tree-toolbar.js";import"@typo3/backend/element/icon-element.js";import FormEngine from"@typo3/backend/form-engine.js";export class SelectTreeElement{constructor(e,t,r,i){if(this.recordField=null,this.tree=null,this.selectNode=e=>{const t=e.detail.node;this.updateAncestorsIndeterminateState(t),this.calculateIndeterminate(this.tree.nodes),this.saveCheckboxes(),this.tree.setup.input.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))},this.loadDataAfter=()=>{this.tree.nodes=this.tree.nodes.map(e=>(e.indeterminate=!1,e)),this.calculateIndeterminate(this.tree.nodes)},this.saveCheckboxes=()=>{void 0!==this.recordField&&(this.recordField.value=this.tree.getSelectedNodes().map(e=>e.identifier).join(","))},r instanceof Function)throw new Error("Function `callback` is not supported anymore since TYPO3 v12.0");this.recordField=document.getElementById(t);const a=document.getElementById(e);this.tree=document.createElement("typo3-backend-form-selecttree"),this.tree.classList.add("svg-tree-wrapper"),this.tree.addEventListener("typo3:svg-tree:nodes-prepared",this.loadDataAfter),this.tree.addEventListener("typo3:svg-tree:node-selected",this.selectNode),i instanceof Array&&this.tree.addEventListener("typo3:svg-tree:node-selected",()=>{FormEngine.processOnFieldChange(i)});const s={id:e,dataUrl:this.generateRequestUrl(),readOnlyMode:1===parseInt(this.recordField.dataset.readOnly,10),input:this.recordField,exclusiveNodesIdentifiers:this.recordField.dataset.treeExclusiveKeys,validation:JSON.parse(this.recordField.dataset.formengineValidationRules)[0],expandUpToLevel:this.recordField.dataset.treeExpandUpToLevel,unselectableElements:[]};this.tree.addEventListener("svg-tree:initialized",()=>{if(this.recordField.dataset.treeShowToolbar){const e=document.createElement("typo3-backend-form-selecttree-toolbar");e.tree=this.tree,this.tree.prepend(e)}}),this.tree.setup=s,a.append(this.tree),this.listenForVisibleTree()}listenForVisibleTree(){if(!this.tree.offsetParent){let e=this.tree.closest(".tab-pane").getAttribute("id");if(e){document.querySelector('[aria-controls="'+e+'"]').addEventListener("shown.bs.tab",()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))})}}}generateRequestUrl(){const e={tableName:this.recordField.dataset.tablename,fieldName:this.recordField.dataset.fieldname,uid:this.recordField.dataset.uid,defaultValues:this.recordField.dataset.defaultvalues,overrideValues:this.recordField.dataset.overridevalues,recordTypeValue:this.recordField.dataset.recordtypevalue,dataStructureIdentifier:this.recordField.dataset.datastructureidentifier,flexFormSheetName:this.recordField.dataset.flexformsheetname,flexFormFieldName:this.recordField.dataset.flexformfieldname,flexFormContainerName:this.recordField.dataset.flexformcontainername,flexFormContainerIdentifier:this.recordField.dataset.flexformcontaineridentifier,flexFormContainerFieldName:this.recordField.dataset.flexformcontainerfieldname,flexFormSectionContainerIsNew:this.recordField.dataset.flexformsectioncontainerisnew,command:this.recordField.dataset.command};return TYPO3.settings.ajaxUrls.record_tree_data+"&"+new URLSearchParams(e)}updateAncestorsIndeterminateState(e){let t=!1;e.parents.forEach(e=>{const r=this.tree.nodes[e];r.indeterminate=r.checked||r.indeterminate||t,t=r.checked||r.indeterminate||r.checked||r.indeterminate})}calculateIndeterminate(e){e.forEach(t=>{(t.checked||t.indeterminate)&&t.parents&&t.parents.length>0&&t.parents.forEach(t=>{e[t].indeterminate=!0})})}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTreeToolbar.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-tree-toolbar.js similarity index 87% rename from typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTreeToolbar.js rename to typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-tree-toolbar.js index 4ac8e0c4e47d21fef02a0b2057847086b1797932..e64f4636384f30ca9ce11ff24c523468af41c6f3 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/Element/SelectTreeToolbar.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-tree-toolbar.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(e,t,l,o){var i,n=arguments.length,a=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,l):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,l,o);else for(var r=e.length-1;r>=0;r--)(i=e[r])&&(a=(n<3?i(a):n>3?i(t,l,a):i(t,l))||a);return n>3&&a&&Object.defineProperty(t,l,a),a};import{Tooltip}from"bootstrap";import{html,LitElement}from"lit";import{customElement}from"lit/decorators.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";let SelectTreeToolbar=class extends LitElement{constructor(){super(...arguments),this.settings={collapseAllBtn:"collapse-all-btn",expandAllBtn:"expand-all-btn",searchInput:"search-input",toggleHideUnchecked:"hide-unchecked-btn"},this.hideUncheckedState=!1}createRenderRoot(){return this}firstUpdated(){this.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(e=>new Tooltip(e))}render(){return html` +var __decorate=function(e,t,l,o){var i,n=arguments.length,a=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,l):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,l,o);else for(var r=e.length-1;r>=0;r--)(i=e[r])&&(a=(n<3?i(a):n>3?i(t,l,a):i(t,l))||a);return n>3&&a&&Object.defineProperty(t,l,a),a};import{Tooltip}from"bootstrap";import{html,LitElement}from"lit";import{customElement}from"lit/decorators.js";import{lll}from"@typo3/core/lit-helper.js";let SelectTreeToolbar=class extends LitElement{constructor(){super(...arguments),this.settings={collapseAllBtn:"collapse-all-btn",expandAllBtn:"expand-all-btn",searchInput:"search-input",toggleHideUnchecked:"hide-unchecked-btn"},this.hideUncheckedState=!1}createRenderRoot(){return this}firstUpdated(){this.querySelectorAll('[data-bs-toggle="tooltip"]').forEach(e=>new Tooltip(e))}render(){return html` <div class="tree-toolbar btn-toolbar"> <div class="input-group"> <span class="input-group-addon input-group-icon filter"> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-tree.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-tree.js new file mode 100644 index 0000000000000000000000000000000000000000..79279058dff398f93fa81c314a1a2a60fe36f285 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/select-tree.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var __decorate=function(e,t,i,s){var n,d=arguments.length,r=d<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(r=(d<3?n(r):d>3?n(t,i,r):n(t,i))||r);return d>3&&r&&Object.defineProperty(t,i,r),r};import*as d3selection from"d3-selection";import{SvgTree}from"@typo3/backend/svg-tree.js";import{customElement}from"lit/decorators.js";let SelectTree=class extends SvgTree{constructor(){super(),this.textPosition=30,this.settings={unselectableElements:[],exclusiveNodesIdentifiers:"",validation:{},readOnlyMode:!1,showIcons:!0,marginTop:15,nodeHeight:20,indentWidth:16,width:300,duration:400,dataUrl:"",defaultProperties:{},expandUpToLevel:null},this.exclusiveSelectedNode=null,this.addIcons(),this.addEventListener("typo3:svg-tree:nodes-prepared",this.prepareLoadedNodes)}expandAll(){this.nodes.forEach(e=>{this.showChildren(e)}),this.prepareDataForVisibleNodes(),this.updateVisibleNodes()}selectNode(e,t=!0){if(!this.isNodeSelectable(e))return;const i=e.checked;this.handleExclusiveNodeSelection(e),this.settings.validation&&this.settings.validation.maxItems&&!i&&this.getSelectedNodes().length>=this.settings.validation.maxItems||(e.checked=!i,this.dispatchEvent(new CustomEvent("typo3:svg-tree:node-selected",{detail:{node:e,propagate:t}})),this.updateVisibleNodes())}filter(e){this.searchTerm=e,this.nodes.length&&(this.nodes[0].expanded=!1);const t=new RegExp(e,"i");this.nodes.forEach(e=>{t.test(e.name)?(this.showParents(e),e.expanded=!0,e.hidden=!1):(e.hidden=!0,e.expanded=!1)}),this.prepareDataForVisibleNodes(),this.updateVisibleNodes()}showParents(e){if(0===e.parents.length)return;const t=this.nodes[e.parents[0]];t.hidden=!1,t.expanded=!0,this.showParents(t)}updateVisibleNodes(){super.updateVisibleNodes();const e=Math.ceil(this.viewportHeight/this.settings.nodeHeight+1),t=Math.floor(Math.max(this.scrollTop-2*this.settings.nodeHeight,0)/this.settings.nodeHeight),i=this.data.nodes.slice(t,t+e);this.nodesContainer.selectAll(".node").data(i,e=>e.stateIdentifier).selectAll(".tree-check use").attr("visibility",(function(e){const t=Boolean(e.checked),i=d3selection.select(this);return i.classed("icon-checked")&&t||i.classed("icon-indeterminate")&&e.indeterminate&&!t?"visible":!i.classed("icon-check")||e.indeterminate||t?"hidden":"visible"}))}isNodeSelectable(e){return!this.settings.readOnlyMode&&-1===this.settings.unselectableElements.indexOf(e.identifier)}appendTextElement(e){return this.renderCheckbox(e),super.appendTextElement(e)}renderCheckbox(e){const t=e.filter(e=>this.isNodeSelectable(e)||Boolean(e.checked)).append("g").attr("class","tree-check").on("click",(e,t)=>this.selectNode(t));t.append("use").attr("x",28).attr("y",-8).attr("visibility","hidden").attr("class","icon-check").attr("xlink:href","#icon-check"),t.append("use").attr("x",28).attr("y",-8).attr("visibility","hidden").attr("class","icon-checked").attr("xlink:href","#icon-checked"),t.append("use").attr("x",28).attr("y",-8).attr("visibility","hidden").attr("class","icon-indeterminate").attr("xlink:href","#icon-indeterminate")}prepareLoadedNodes(e){let t=e.detail.nodes;e.detail.nodes=t.map(e=>{if(!e.stateIdentifier){const t=e.parents.length?e.parents[e.parents.length-1]:e.identifier;e.stateIdentifier=t+"_"+e.identifier}return!1===e.selectable&&this.settings.unselectableElements.push(e.identifier),e})}handleExclusiveNodeSelection(e){const t=this.settings.exclusiveNodesIdentifiers.split(",");this.settings.exclusiveNodesIdentifiers.length&&!1===e.checked&&(t.indexOf(""+e.identifier)>-1?(this.disableSelectedNodes(),this.exclusiveSelectedNode=e):-1===t.indexOf(""+e.identifier)&&this.exclusiveSelectedNode&&(this.exclusiveSelectedNode.checked=!1,this.exclusiveSelectedNode=null))}addIcons(){this.icons={check:{identifier:"check",icon:'<g width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><rect height="16" width="16" fill="transparent"></rect><path transform="scale(0.01)" d="M1312 256h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113v-832q0-66-47-113t-113-47zm288 160v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"></path></g>'},checked:{identifier:"checked",icon:'<g width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><rect height="16" width="16" fill="transparent"></rect><path transform="scale(0.01)" d="M813 1299l614-614q19-19 19-45t-19-45l-102-102q-19-19-45-19t-45 19l-467 467-211-211q-19-19-45-19t-45 19l-102 102q-19 19-19 45t19 45l358 358q19 19 45 19t45-19zm851-883v960q0 119-84.5 203.5t-203.5 84.5h-960q-119 0-203.5-84.5t-84.5-203.5v-960q0-119 84.5-203.5t203.5-84.5h960q119 0 203.5 84.5t84.5 203.5z"></path></g>'},indeterminate:{identifier:"indeterminate",icon:'<g width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><rect height="16" width="16" fill="transparent"></rect><path transform="scale(0.01)" d="M1344 800v64q0 14-9 23t-23 9h-832q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h832q14 0 23 9t9 23zm128 448v-832q0-66-47-113t-113-47h-832q-66 0-113 47t-47 113v832q0 66 47 113t113 47h832q66 0 113-47t47-113zm128-832v832q0 119-84.5 203.5t-203.5 84.5h-832q-119 0-203.5-84.5t-84.5-203.5v-832q0-119 84.5-203.5t203.5-84.5h832q119 0 203.5 84.5t84.5 203.5z"></path></g>'}}}};SelectTree=__decorate([customElement("typo3-backend-form-selecttree")],SelectTree);export{SelectTree}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/slug-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/slug-element.js new file mode 100644 index 0000000000000000000000000000000000000000..25b08dfb2fa6cdcc0c8829673afa017ce1c2ded4 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/slug-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import DocumentService from"@typo3/core/document-service.js";import DebounceEvent from"@typo3/core/event/debounce-event.js";import RegularEvent from"@typo3/core/event/regular-event.js";var Selectors,ProposalModes;!function(e){e.toggleButton=".t3js-form-field-slug-toggle",e.recreateButton=".t3js-form-field-slug-recreate",e.inputField=".t3js-form-field-slug-input",e.readOnlyField=".t3js-form-field-slug-readonly",e.hiddenField=".t3js-form-field-slug-hidden"}(Selectors||(Selectors={})),function(e){e.AUTO="auto",e.RECREATE="recreate",e.MANUAL="manual"}(ProposalModes||(ProposalModes={}));class SlugElement{constructor(e,t){this.options=null,this.fullElement=null,this.manuallyChanged=!1,this.readOnlyField=null,this.inputField=null,this.hiddenField=null,this.request=null,this.fieldsToListenOn={},this.options=t,this.fieldsToListenOn=this.options.listenerFieldNames||{},DocumentService.ready().then(t=>{this.fullElement=t.querySelector(e),this.inputField=this.fullElement.querySelector(Selectors.inputField),this.readOnlyField=this.fullElement.querySelector(Selectors.readOnlyField),this.hiddenField=this.fullElement.querySelector(Selectors.hiddenField),this.registerEvents()})}registerEvents(){const e=Object.values(this.getAvailableFieldsForProposalGeneration()).map(e=>`[data-formengine-input-name="${e}"]`),t=this.fullElement.querySelector(Selectors.recreateButton);e.length>0&&"new"===this.options.command&&new DebounceEvent("input",()=>{this.manuallyChanged||this.sendSlugProposal(ProposalModes.AUTO)}).delegateTo(document,e.join(",")),e.length>0||this.hasPostModifiersDefined()?new RegularEvent("click",e=>{e.preventDefault(),this.readOnlyField.classList.contains("hidden")&&(this.readOnlyField.classList.toggle("hidden",!1),this.inputField.classList.toggle("hidden",!0)),this.sendSlugProposal(ProposalModes.RECREATE)}).bindTo(t):(t.classList.add("disabled"),t.disabled=!0),new DebounceEvent("input",()=>{this.manuallyChanged=!0,this.sendSlugProposal(ProposalModes.MANUAL)}).bindTo(this.inputField);const s=this.fullElement.querySelector(Selectors.toggleButton);new RegularEvent("click",e=>{e.preventDefault();const t=this.readOnlyField.classList.contains("hidden");this.readOnlyField.classList.toggle("hidden",!t),this.inputField.classList.toggle("hidden",t),t?(this.inputField.value!==this.readOnlyField.value?this.readOnlyField.value=this.inputField.value:(this.manuallyChanged=!1,this.fullElement.querySelector(".t3js-form-proposal-accepted").classList.add("hidden"),this.fullElement.querySelector(".t3js-form-proposal-different").classList.add("hidden")),this.hiddenField.value=this.readOnlyField.value):this.hiddenField.value=this.inputField.value}).bindTo(s)}sendSlugProposal(e){const t={};if(e===ProposalModes.AUTO||e===ProposalModes.RECREATE){for(const[e,s]of Object.entries(this.getAvailableFieldsForProposalGeneration()))t[e]=document.querySelector('[data-formengine-input-name="'+s+'"]').value;!0===this.options.includeUidInValues&&(t.uid=this.options.recordId.toString())}else t.manual=this.inputField.value;this.request instanceof AjaxRequest&&this.request.abort(),this.request=new AjaxRequest(TYPO3.settings.ajaxUrls.record_slug_suggest),this.request.post({values:t,mode:e,tableName:this.options.tableName,pageId:this.options.pageId,parentPageId:this.options.parentPageId,recordId:this.options.recordId,language:this.options.language,fieldName:this.options.fieldName,command:this.options.command,signature:this.options.signature}).then(async t=>{const s=await t.resolve(),l="/"+s.proposal.replace(/^\//,""),i=this.fullElement.querySelector(".t3js-form-proposal-accepted"),o=this.fullElement.querySelector(".t3js-form-proposal-different");i.classList.toggle("hidden",s.hasConflicts),o.classList.toggle("hidden",!s.hasConflicts),(s.hasConflicts?o:i).querySelector("span").innerText=l;this.hiddenField.value!==s.proposal&&this.fullElement.querySelector("input[data-formengine-input-name]").dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0})),e===ProposalModes.AUTO||e===ProposalModes.RECREATE?(this.readOnlyField.value=s.proposal,this.hiddenField.value=s.proposal,this.inputField.value=s.proposal):this.hiddenField.value=s.proposal}).finally(()=>{this.request=null})}getAvailableFieldsForProposalGeneration(){const e={};for(const[t,s]of Object.entries(this.fieldsToListenOn)){null!==document.querySelector('[data-formengine-input-name="'+s+'"]')&&(e[t]=s)}return e}hasPostModifiersDefined(){return Array.isArray(this.options.config.generatorOptions.postModifiers)&&this.options.config.generatorOptions.postModifiers.length>0}}export default SlugElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/text-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/text-element.js new file mode 100644 index 0000000000000000000000000000000000000000..a58e6e07cc9f7bc389e746bbff394993113f55e2 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/text-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{Resizable}from"@typo3/backend/form-engine/element/modifier/resizable.js";import{Tabbable}from"@typo3/backend/form-engine/element/modifier/tabbable.js";import DocumentService from"@typo3/core/document-service.js";class TextElement{constructor(e){this.element=null,DocumentService.ready().then(()=>{this.element=document.getElementById(e),Resizable.enable(this.element),Tabbable.enable(this.element)})}}export default TextElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/text-table-element.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/text-table-element.js new file mode 100644 index 0000000000000000000000000000000000000000..a0c6f9a6f420757a2bc9dfdaade215b14a47670f --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/element/text-table-element.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{Resizable}from"@typo3/backend/form-engine/element/modifier/resizable.js";import{Tabbable}from"@typo3/backend/form-engine/element/modifier/tabbable.js";import DocumentService from"@typo3/core/document-service.js";class TextTableElement{constructor(e){this.element=null,DocumentService.ready().then(()=>{this.element=document.getElementById(e),Resizable.enable(this.element),Tabbable.enable(this.element)})}}export default TextTableElement; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/add-record.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/add-record.js new file mode 100644 index 0000000000000000000000000000000000000000..195c60334298ac12c12c57e104d53e1c67b8b5f5 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/add-record.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import FormEngine from"@typo3/backend/form-engine.js";class AddRecord{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault(),FormEngine.preventFollowLinkIfNotSaved(this.controlElement.getAttribute("href"))},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default AddRecord; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/edit-popup.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/edit-popup.js new file mode 100644 index 0000000000000000000000000000000000000000..65e02134efcdc9f33ad8c38590aecc82f2b80e74 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/edit-popup.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";class EditPopup{constructor(e){this.controlElement=null,this.assignedFormField=null,this.registerChangeHandler=()=>{this.controlElement.classList.toggle("disabled",-1===this.assignedFormField.options.selectedIndex)},this.registerClickHandler=e=>{e.preventDefault();const t=[];for(let e=0;e<this.assignedFormField.selectedOptions.length;++e){const s=this.assignedFormField.selectedOptions.item(e);t.push(s.value)}const s=this.controlElement.getAttribute("href")+"&P[currentValue]="+encodeURIComponent(this.assignedFormField.value)+"&P[currentSelectedValues]="+t.join(",");window.open(s,"",this.controlElement.dataset.windowParameters).focus()},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.assignedFormField=document.querySelector('select[data-formengine-input-name="'+this.controlElement.dataset.element+'"]'),-1===this.assignedFormField.options.selectedIndex&&this.controlElement.classList.add("disabled"),this.assignedFormField.addEventListener("change",this.registerChangeHandler),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default EditPopup; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/insert-clipboard.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/insert-clipboard.js new file mode 100644 index 0000000000000000000000000000000000000000..619b7954ce3152b570990ec113a4ba8eb8d3125f --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/insert-clipboard.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import FormEngine from"@typo3/backend/form-engine.js";class InsertClipboard{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault();const t=this.controlElement.dataset.element,r=JSON.parse(this.controlElement.dataset.clipboardItems);for(let e of r)FormEngine.setSelectOptionFromExternalSource(t,e.value,e.title,e.title)},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default InsertClipboard; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/link-popup.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/link-popup.js new file mode 100644 index 0000000000000000000000000000000000000000..52e834cedb36cacad8e2ecc711adf35d48955551 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/link-popup.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import FormEngine from"@typo3/backend/form-engine.js";import Modal from"@typo3/backend/modal.js";class LinkPopup{constructor(e){this.controlElement=null,this.handleControlClick=e=>{e.preventDefault();const t=this.controlElement.dataset.itemName,o=this.controlElement.getAttribute("href")+"&P[currentValue]="+encodeURIComponent(document.forms.namedItem("editform")[t].value)+"&P[currentSelectedValues]="+encodeURIComponent(FormEngine.getFieldElement(t).val());Modal.advanced({type:Modal.types.iframe,content:o,size:Modal.sizes.large})},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.handleControlClick)})}}export default LinkPopup; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/list-module.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/list-module.js new file mode 100644 index 0000000000000000000000000000000000000000..5ec246c325bf90f2239be0cce4913485e8ef8ab0 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/list-module.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import FormEngine from"@typo3/backend/form-engine.js";class ListModule{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault(),FormEngine.preventFollowLinkIfNotSaved(this.controlElement.getAttribute("href"))},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default ListModule; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/reset-selection.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/reset-selection.js new file mode 100644 index 0000000000000000000000000000000000000000..e61bae2239e606c2f8e91dae398f81ff897f9c70 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/reset-selection.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";class ResetSelection{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault();const t=this.controlElement.dataset.itemName,o=JSON.parse(this.controlElement.dataset.selectedIndices),n=document.forms.namedItem("editform").querySelector('[name="'+t+'[]"]');n.selectedIndex=-1;for(let e of o)n.options[e].selected=!0},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),null!==this.controlElement&&this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default ResetSelection; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/table-wizard.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/table-wizard.js new file mode 100644 index 0000000000000000000000000000000000000000..33620da74449cdfd7519007e6cff00bef270712b --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-control/table-wizard.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import FormEngine from"@typo3/backend/form-engine.js";class TableWizard{constructor(e){this.controlElement=null,this.registerClickHandler=e=>{e.preventDefault(),FormEngine.preventFollowLinkIfNotSaved(this.controlElement.getAttribute("href"))},DocumentService.ready().then(()=>{this.controlElement=document.querySelector(e),this.controlElement.addEventListener("click",this.registerClickHandler)})}}export default TableWizard; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-wizard/localization-state-selector.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-wizard/localization-state-selector.js new file mode 100644 index 0000000000000000000000000000000000000000..7764d4725f1870fbabd9d231c7a92edc2d877e02 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-wizard/localization-state-selector.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import RegularEvent from"@typo3/core/event/regular-event.js";var States;!function(e){e.CUSTOM="custom"}(States||(States={}));class LocalizationStateSelector{constructor(e){DocumentService.ready().then(()=>{this.registerEventHandler(e)})}registerEventHandler(e){new RegularEvent("change",e=>{const t=e.target,a=t.closest(".t3js-formengine-field-item")?.querySelector("[data-formengine-input-name]");if(!a)return;const n=a.dataset.lastL10nState||!1,r=t.value;n&&r===n||(r===States.CUSTOM?(n&&(t.dataset.originalLanguageValue=a.value),a.disabled=!1):(n===States.CUSTOM&&(t.closest(".t3js-l10n-state-container").querySelector(".t3js-l10n-state-custom").dataset.originalLanguageValue=a.value),a.disabled=!0),a.value=t.dataset.originalLanguageValue,a.dispatchEvent(new Event("change")),a.dataset.lastL10nState=t.value)}).delegateTo(document,'.t3js-l10n-state-container input[type="radio"][name="'+e+'"]')}}export default LocalizationStateSelector; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldWizard/ValuePicker.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-wizard/value-picker.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/FieldWizard/ValuePicker.js rename to typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-wizard/value-picker.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-wizard/value-slider.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-wizard/value-slider.js new file mode 100644 index 0000000000000000000000000000000000000000..2664cd6b09d262771e3f5a7aac728ec4eb6cdb59 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/field-wizard/value-slider.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import ThrottleEvent from"@typo3/core/event/throttle-event.js";class ValueSlider{constructor(e){this.controlElement=null,this.handleRangeChange=e=>{const t=e.target;ValueSlider.updateValue(t),ValueSlider.updateTooltipValue(t)},this.controlElement=document.getElementById(e),new ThrottleEvent("input",this.handleRangeChange,25).bindTo(this.controlElement)}static updateValue(e){const t=document.querySelector(`[data-formengine-input-name="${e.dataset.sliderItemName}"]`);t.value=e.value,t.dispatchEvent(new Event("change",{bubbles:!0,cancelable:!0}))}static updateTooltipValue(e){let t;const a=e.value;switch(e.dataset.sliderValueType){case"double":t=parseFloat(a).toFixed(2);break;case"int":default:t=parseInt(a,10)}e.title=t.toString()}}export default ValueSlider; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/inline-relation/ajax-dispatcher.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/inline-relation/ajax-dispatcher.js new file mode 100644 index 0000000000000000000000000000000000000000..7729c09379d668d11c01f1d9f57776abcd8c0076 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/inline-relation/ajax-dispatcher.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{JavaScriptItemProcessor}from"@typo3/core/java-script-item-processor.js";import Notification from"@typo3/backend/notification.js";import Utility from"@typo3/backend/utility.js";export class AjaxDispatcher{constructor(e){this.objectGroup=null,this.objectGroup=e}newRequest(e){return new AjaxRequest(e)}getEndpoint(e){if(void 0!==TYPO3.settings.ajaxUrls[e])return TYPO3.settings.ajaxUrls[e];throw'Undefined endpoint for route "'+e+'"'}send(e,t){const s=e.post(this.createRequestBody(t)).then(async e=>this.processResponse(await e.resolve()));return s.catch(e=>{Notification.error("Error "+e.message)}),s}createRequestBody(e){const t={};for(let s=0;s<e.length;s++)t["ajax["+s+"]"]=e[s];return t["ajax[context]"]=JSON.stringify(this.getContext()),t}getContext(){let e;return void 0!==TYPO3.settings.FormEngineInline.config[this.objectGroup]&&void 0!==TYPO3.settings.FormEngineInline.config[this.objectGroup].context&&(e=TYPO3.settings.FormEngineInline.config[this.objectGroup].context),e}processResponse(json){if(json.hasErrors)for(const e of json.messages)Notification.error(e.title,e.message);if(json.stylesheetFiles)for(const[e,t]of json.stylesheetFiles.entries()){if(!t)break;const s=document.createElement("link");s.rel="stylesheet",s.type="text/css",s.href=t,document.querySelector("head").appendChild(s),delete json.stylesheetFiles[e]}if("object"==typeof json.inlineData&&(TYPO3.settings.FormEngineInline=Utility.mergeDeep(TYPO3.settings.FormEngineInline,json.inlineData)),json.scriptItems instanceof Array&&json.scriptItems.length>0){const e=new JavaScriptItemProcessor;e.processItems(json.scriptItems)}if("object"==typeof json.requireJsModules)for(let e of json.requireJsModules)new Function(e)();if(json.scriptCall&&json.scriptCall.length>0)for(const scriptCall of json.scriptCall)eval(scriptCall);return json}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/InlineRelation/InlineResponseInterface.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/inline-relation/inline-response-interface.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/FormEngine/InlineRelation/InlineResponseInterface.js rename to typo3/sysext/backend/Resources/Public/JavaScript/form-engine/inline-relation/inline-response-interface.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/request-update.js b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/request-update.js new file mode 100644 index 0000000000000000000000000000000000000000..d1ae5c0b623e514c473351de39bd1fdcef3ed294 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/form-engine/request-update.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var UpdateMode,__decorate=function(e,t,o,r){var n,d=arguments.length,c=d<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(c=(d<3?n(c):d>3?n(t,o,c):n(t,o))||c);return d>3&&c&&Object.defineProperty(t,o,c),c};import{LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import FormEngine from"@typo3/backend/form-engine.js";!function(e){e.ask="ask",e.enforce="enforce"}(UpdateMode||(UpdateMode={}));const selectorConverter={fromAttribute:e=>document.querySelectorAll(e)};let RequestUpdate=class extends LitElement{constructor(){super(...arguments),this.mode=UpdateMode.ask,this.requestFormEngineUpdate=()=>{const e=this.mode===UpdateMode.ask;FormEngine.requestFormEngineUpdate(e)}}connectedCallback(){super.connectedCallback();for(let e of this.fields)e.addEventListener("change",this.requestFormEngineUpdate)}disconnectedCallback(){super.disconnectedCallback();for(let e of this.fields)e.removeEventListener("change",this.requestFormEngineUpdate)}};__decorate([property({type:String,attribute:"mode"})],RequestUpdate.prototype,"mode",void 0),__decorate([property({attribute:"field",converter:selectorConverter})],RequestUpdate.prototype,"fields",void 0),RequestUpdate=__decorate([customElement("typo3-formengine-updater")],RequestUpdate); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/global-event-handler.js b/typo3/sysext/backend/Resources/Public/JavaScript/global-event-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..2faa61c8ee20ba576cdd1fa4fb0d352eb27bd246 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/global-event-handler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import documentService from"@typo3/core/document-service.js";import RegularEvent from"@typo3/core/event/regular-event.js";class GlobalEventHandler{constructor(){this.options={onChangeSelector:'[data-global-event="change"]',onClickSelector:'[data-global-event="click"]',onSubmitSelector:'form[data-global-event="submit"]'},documentService.ready().then(()=>this.registerEvents())}registerEvents(){new RegularEvent("change",this.handleChangeEvent.bind(this)).delegateTo(document,this.options.onChangeSelector),new RegularEvent("click",this.handleClickEvent.bind(this)).delegateTo(document,this.options.onClickSelector),new RegularEvent("submit",this.handleSubmitEvent.bind(this)).delegateTo(document,this.options.onSubmitSelector)}handleChangeEvent(e,t){e.preventDefault(),this.handleFormChildSubmitAction(e,t)||this.handleFormChildNavigateAction(e,t)}handleClickEvent(e,t){e.preventDefault()}handleSubmitEvent(e,t){e.preventDefault(),this.handleFormNavigateAction(e,t)}handleFormChildSubmitAction(e,t){const n=t.dataset.actionSubmit;if(!n)return!1;if("$form"===n&&this.isHTMLFormChildElement(t))return t.form.submit(),!0;const a=document.querySelector(n);return a instanceof HTMLFormElement&&(a.submit(),!0)}handleFormChildNavigateAction(e,t){const n=t.dataset.actionNavigate;if(!n)return!1;const a=this.resolveHTMLFormChildElementValue(t),l=t.dataset.navigateValue;return"$data=~s/$value/"===n&&l&&null!==a?(window.location.href=this.substituteValueVariable(l,a),!0):"$data"===n&&l?(window.location.href=l,!0):!("$value"!==n||!a)&&(window.location.href=a,!0)}handleFormNavigateAction(e,t){const n=t.action,a=t.dataset.actionNavigate;if(!n||!a)return!1;const l=t.dataset.navigateValue,o=t.dataset.valueSelector,i=this.resolveHTMLFormChildElementValue(t.querySelector(o));return"$form=~s/$value/"===a&&l&&null!==i?(window.location.href=this.substituteValueVariable(l,i),!0):"$form"===a&&(window.location.href=n,!0)}substituteValueVariable(e,t){return e.replace(/(\$\{value\}|%24%7Bvalue%7D|\$\[value\]|%24%5Bvalue%5D)/gi,t)}isHTMLFormChildElement(e){return e instanceof HTMLSelectElement||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement}resolveHTMLFormChildElementValue(e){const t=e.getAttribute("type");if(e instanceof HTMLSelectElement)return e.options[e.selectedIndex].value;if(e instanceof HTMLInputElement&&"checkbox"===t){const t=e.dataset.emptyValue;return e.checked?e.value:void 0!==t?t:""}return e instanceof HTMLInputElement?e.value:null}}export default new GlobalEventHandler; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/grid-editor.js b/typo3/sysext/backend/Resources/Public/JavaScript/grid-editor.js new file mode 100644 index 0000000000000000000000000000000000000000..34a4b287d3bfa0c189db1487d5ff82ec3a161493 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/grid-editor.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{SeverityEnum}from"@typo3/backend/enum/severity.js";import"bootstrap";import $ from"jquery";import Modal from"@typo3/backend/modal.js";import SecurityUtility from"@typo3/core/security-utility.js";export class GridEditor{constructor(t=null){this.colCount=1,this.rowCount=1,this.readOnly=!1,this.nameLabel="name",this.columnLabel="column label",this.defaultCell={spanned:0,rowspan:1,colspan:1,name:"",colpos:"",column:void 0},this.selectorEditor=".t3js-grideditor",this.selectorAddColumn=".t3js-grideditor-addcolumn",this.selectorRemoveColumn=".t3js-grideditor-removecolumn",this.selectorAddRowTop=".t3js-grideditor-addrow-top",this.selectorRemoveRowTop=".t3js-grideditor-removerow-top",this.selectorAddRowBottom=".t3js-grideditor-addrow-bottom",this.selectorRemoveRowBottom=".t3js-grideditor-removerow-bottom",this.selectorLinkEditor=".t3js-grideditor-link-editor",this.selectorLinkExpandRight=".t3js-grideditor-link-expand-right",this.selectorLinkShrinkLeft=".t3js-grideditor-link-shrink-left",this.selectorLinkExpandDown=".t3js-grideditor-link-expand-down",this.selectorLinkShrinkUp=".t3js-grideditor-link-shrink-up",this.selectorConfigPreview=".t3js-grideditor-preview-config",this.selectorPreviewArea=".t3js-tsconfig-preview-area",this.selectorCodeMirror=".t3js-grideditor-preview-config .CodeMirror",this.modalButtonClickHandler=t=>{const e=t.target;"cancel"===e.name?Modal.currentModal.trigger("modal-dismiss"):"ok"===e.name&&(this.setName(Modal.currentModal.find(".t3js-grideditor-field-name").val(),Modal.currentModal.data("col"),Modal.currentModal.data("row")),this.setColumn(Modal.currentModal.find(".t3js-grideditor-field-colpos").val(),Modal.currentModal.data("col"),Modal.currentModal.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord()),Modal.currentModal.trigger("modal-dismiss"))},this.addColumnHandler=t=>{t.preventDefault(),this.addColumn(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.removeColumnHandler=t=>{t.preventDefault(),this.removeColumn(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.addRowTopHandler=t=>{t.preventDefault(),this.addRowTop(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.addRowBottomHandler=t=>{t.preventDefault(),this.addRowBottom(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.removeRowTopHandler=t=>{t.preventDefault(),this.removeRowTop(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.removeRowBottomHandler=t=>{t.preventDefault(),this.removeRowBottom(),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.linkEditorHandler=t=>{t.preventDefault();const e=$(t.target);this.showOptions(e.data("col"),e.data("row"))},this.linkExpandRightHandler=t=>{t.preventDefault();const e=$(t.target);this.addColspan(e.data("col"),e.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.linkShrinkLeftHandler=t=>{t.preventDefault();const e=$(t.target);this.removeColspan(e.data("col"),e.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.linkExpandDownHandler=t=>{t.preventDefault();const e=$(t.target);this.addRowspan(e.data("col"),e.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord())},this.linkShrinkUpHandler=t=>{t.preventDefault();const e=$(t.target);this.removeRowspan(e.data("col"),e.data("row")),this.drawTable(),this.writeConfig(this.export2LayoutRecord())};const e=$(this.selectorEditor);this.colCount=e.data("colcount"),this.rowCount=e.data("rowcount"),this.readOnly=e.data("readonly"),this.field=$('input[name="'+e.data("field")+'"]'),this.data=e.data("data"),this.nameLabel=null!==t?t.nameLabel:"Name",this.columnLabel=null!==t?t.columnLabel:"Column",this.targetElement=$(this.selectorEditor),this.initializeEvents(),this.addVisibilityObserver(e.get(0)),this.drawTable(),this.writeConfig(this.export2LayoutRecord())}static stripMarkup(t){return(new SecurityUtility).stripHtml(t)}initializeEvents(){this.readOnly||($(document).on("click",this.selectorAddColumn,this.addColumnHandler),$(document).on("click",this.selectorRemoveColumn,this.removeColumnHandler),$(document).on("click",this.selectorAddRowTop,this.addRowTopHandler),$(document).on("click",this.selectorAddRowBottom,this.addRowBottomHandler),$(document).on("click",this.selectorRemoveRowTop,this.removeRowTopHandler),$(document).on("click",this.selectorRemoveRowBottom,this.removeRowBottomHandler),$(document).on("click",this.selectorLinkEditor,this.linkEditorHandler),$(document).on("click",this.selectorLinkExpandRight,this.linkExpandRightHandler),$(document).on("click",this.selectorLinkShrinkLeft,this.linkShrinkLeftHandler),$(document).on("click",this.selectorLinkExpandDown,this.linkExpandDownHandler),$(document).on("click",this.selectorLinkShrinkUp,this.linkShrinkUpHandler))}getNewCell(){return $.extend({},this.defaultCell)}writeConfig(t){this.field.val(t);const e=t.split("\n");let o="";for(const t of e)t&&(o+="\t\t\t"+t+"\n");let n="mod.web_layout.BackendLayouts {\n exampleKey {\n title = Example\n icon = EXT:example_extension/Resources/Public/Images/BackendLayouts/default.gif\n config {\n"+o.replace(new RegExp("\t","g")," ")+" }\n }\n}\n";$(this.selectorConfigPreview).find(this.selectorPreviewArea).empty().append(n);const i=document.querySelector(this.selectorCodeMirror);i&&i.CodeMirror.setValue(n)}addRowTop(){const t=[];for(let e=0;e<this.colCount;e++){const o=this.getNewCell();o.name=e+"x"+this.data.length,t[e]=o}this.data.unshift(t),this.rowCount++}addRowBottom(){const t=[];for(let e=0;e<this.colCount;e++){const o=this.getNewCell();o.name=e+"x"+this.data.length,t[e]=o}this.data.push(t),this.rowCount++}removeRowTop(){if(this.rowCount<=1)return!1;const t=[];for(let e=1;e<this.rowCount;e++)t.push(this.data[e]);for(let t=0;t<this.colCount;t++)1===this.data[0][t].spanned&&this.findUpperCellWidthRowspanAndDecreaseByOne(t,0);return this.data=t,this.rowCount--,!0}removeRowBottom(){if(this.rowCount<=1)return!1;const t=[];for(let e=0;e<this.rowCount-1;e++)t.push(this.data[e]);for(let t=0;t<this.colCount;t++)1===this.data[this.rowCount-1][t].spanned&&this.findUpperCellWidthRowspanAndDecreaseByOne(t,this.rowCount-1);return this.data=t,this.rowCount--,!0}findUpperCellWidthRowspanAndDecreaseByOne(t,e){const o=this.getCell(t,e-1);return!!o&&(1===o.spanned?this.findUpperCellWidthRowspanAndDecreaseByOne(t,e-1):o.rowspan>1&&this.removeRowspan(t,e-1),!0)}removeColumn(){if(this.colCount<=1)return!1;const t=[];for(let e=0;e<this.rowCount;e++){const o=[];for(let t=0;t<this.colCount-1;t++)o.push(this.data[e][t]);1===this.data[e][this.colCount-1].spanned&&this.findLeftCellWidthColspanAndDecreaseByOne(this.colCount-1,e),t.push(o)}return this.data=t,this.colCount--,!0}findLeftCellWidthColspanAndDecreaseByOne(t,e){const o=this.getCell(t-1,e);return!!o&&(1===o.spanned?this.findLeftCellWidthColspanAndDecreaseByOne(t-1,e):o.colspan>1&&this.removeColspan(t-1,e),!0)}addColumn(){for(let t=0;t<this.rowCount;t++){const e=this.getNewCell();e.name=this.colCount+"x"+t,this.data[t].push(e)}this.colCount++}drawTable(){const t=$("<colgroup>");for(let e=0;e<this.colCount;e++){const e=100/this.colCount;t.append($("<col>").css({width:parseInt(e.toString(),10)+"%"}))}const e=$('<table id="base" class="table editor">');e.append(t);for(let t=0;t<this.rowCount;t++){if(0===this.data[t].length)continue;const o=$("<tr>");for(let e=0;e<this.colCount;e++){const n=this.data[t][e];if(1===n.spanned)continue;const i=100/this.rowCount,r=100/this.colCount,s=$("<td>").css({height:parseInt(i.toString(),10)*n.rowspan+"%",width:parseInt(r.toString(),10)*n.colspan+"%"});if(!this.readOnly){const o=$('<div class="cell_container">');s.append(o);const n=$('<a href="#" data-col="'+e+'" data-row="'+t+'">');o.append(n.clone().attr("class","t3js-grideditor-link-editor link link_editor").attr("title",TYPO3.lang.grid_editCell)),this.cellCanSpanRight(e,t)&&o.append(n.clone().attr("class","t3js-grideditor-link-expand-right link link_expand_right").attr("title",TYPO3.lang.grid_mergeCell)),this.cellCanShrinkLeft(e,t)&&o.append(n.clone().attr("class","t3js-grideditor-link-shrink-left link link_shrink_left").attr("title",TYPO3.lang.grid_splitCell)),this.cellCanSpanDown(e,t)&&o.append(n.clone().attr("class","t3js-grideditor-link-expand-down link link_expand_down").attr("title",TYPO3.lang.grid_mergeCell)),this.cellCanShrinkUp(e,t)&&o.append(n.clone().attr("class","t3js-grideditor-link-shrink-up link link_shrink_up").attr("title",TYPO3.lang.grid_splitCell))}s.append($('<div class="cell_data">').html(TYPO3.lang.grid_name+": "+(n.name?GridEditor.stripMarkup(n.name):TYPO3.lang.grid_notSet)+"<br />"+TYPO3.lang.grid_column+": "+(void 0===n.column||isNaN(n.column)?TYPO3.lang.grid_notSet:parseInt(n.column,10)))),n.colspan>1&&s.attr("colspan",n.colspan),n.rowspan>1&&s.attr("rowspan",n.rowspan),o.append(s)}e.append(o)}$(this.targetElement).empty().append(e)}setName(t,e,o){const n=this.getCell(e,o);return!!n&&(n.name=GridEditor.stripMarkup(t),!0)}setColumn(t,e,o){const n=this.getCell(e,o);return!!n&&(n.column=parseInt(t.toString(),10),!0)}showOptions(t,e){const o=this.getCell(t,e);if(!o)return!1;let n;n=0===o.column?0:o.column?parseInt(o.column.toString(),10):"";const i=$("<div>"),r=$('<div class="form-group">'),s=$("<label>"),a=$("<input>");i.append([r.clone().append([s.clone().text(TYPO3.lang.grid_nameHelp),a.clone().attr("type","text").attr("class","t3js-grideditor-field-name form-control").attr("name","name").val(GridEditor.stripMarkup(o.name)||"")]),r.clone().append([s.clone().text(TYPO3.lang.grid_columnHelp),a.clone().attr("type","text").attr("class","t3js-grideditor-field-colpos form-control").attr("name","column").val(n)])]);const l=Modal.show(TYPO3.lang.grid_windowTitle,i,SeverityEnum.notice,[{active:!0,btnClass:"btn-default",name:"cancel",text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel"},{btnClass:"btn-primary",name:"ok",text:$(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK"}]);return l.data("col",t),l.data("row",e),l.on("button.clicked",this.modalButtonClickHandler),!0}getCell(t,e){return!(t>this.colCount-1)&&(!(e>this.rowCount-1)&&(this.data.length>e-1&&this.data[e].length>t-1?this.data[e][t]:null))}cellCanSpanRight(t,e){if(t===this.colCount-1)return!1;const o=this.getCell(t,e);let n;if(o.rowspan>1){for(let i=e;i<e+o.rowspan;i++)if(n=this.getCell(t+o.colspan,i),!n||1===n.spanned||n.colspan>1||n.rowspan>1)return!1}else if(n=this.getCell(t+o.colspan,e),!n||1===o.spanned||1===n.spanned||n.colspan>1||n.rowspan>1)return!1;return!0}cellCanSpanDown(t,e){if(e===this.rowCount-1)return!1;const o=this.getCell(t,e);let n;if(o.colspan>1){for(let i=t;i<t+o.colspan;i++)if(n=this.getCell(i,e+o.rowspan),!n||1===n.spanned||n.colspan>1||n.rowspan>1)return!1}else if(n=this.getCell(t,e+o.rowspan),!n||1===o.spanned||1===n.spanned||n.colspan>1||n.rowspan>1)return!1;return!0}cellCanShrinkLeft(t,e){return this.data[e][t].colspan>1}cellCanShrinkUp(t,e){return this.data[e][t].rowspan>1}addColspan(t,e){const o=this.getCell(t,e);if(!o||!this.cellCanSpanRight(t,e))return!1;for(let n=e;n<e+o.rowspan;n++)this.data[n][t+o.colspan].spanned=1;return o.colspan+=1,!0}addRowspan(t,e){const o=this.getCell(t,e);if(!o||!this.cellCanSpanDown(t,e))return!1;for(let n=t;n<t+o.colspan;n++)this.data[e+o.rowspan][n].spanned=1;return o.rowspan+=1,!0}removeColspan(t,e){const o=this.getCell(t,e);if(!o||!this.cellCanShrinkLeft(t,e))return!1;o.colspan-=1;for(let n=e;n<e+o.rowspan;n++)this.data[n][t+o.colspan].spanned=0;return!0}removeRowspan(t,e){const o=this.getCell(t,e);if(!o||!this.cellCanShrinkUp(t,e))return!1;o.rowspan-=1;for(let n=t;n<t+o.colspan;n++)this.data[e+o.rowspan][n].spanned=0;return!0}export2LayoutRecord(){let t="backend_layout {\n\tcolCount = "+this.colCount+"\n\trowCount = "+this.rowCount+"\n\trows {\n";for(let e=0;e<this.rowCount;e++){t+="\t\t"+(e+1)+" {\n",t+="\t\t\tcolumns {\n";let o=0;for(let n=0;n<this.colCount;n++){const i=this.getCell(n,e);if(i&&!i.spanned){const r=GridEditor.stripMarkup(i.name)||"";o++,t+="\t\t\t\t"+o+" {\n",t+="\t\t\t\t\tname = "+(r||n+"x"+e)+"\n",i.colspan>1&&(t+="\t\t\t\t\tcolspan = "+i.colspan+"\n"),i.rowspan>1&&(t+="\t\t\t\t\trowspan = "+i.rowspan+"\n"),"number"==typeof i.column&&(t+="\t\t\t\t\tcolPos = "+i.column+"\n"),t+="\t\t\t\t}\n"}}t+="\t\t\t}\n",t+="\t\t}\n"}return t+="\t}\n}\n",t}addVisibilityObserver(t){null===t.offsetParent&&new IntersectionObserver((t,e)=>{t.forEach(t=>{const e=document.querySelector(this.selectorCodeMirror);t.intersectionRatio>0&&e&&e.CodeMirror.refresh()})}).observe(t)}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Hashing/Md5.js b/typo3/sysext/backend/Resources/Public/JavaScript/hashing/md5.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Hashing/Md5.js rename to typo3/sysext/backend/Resources/Public/JavaScript/hashing/md5.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/icons.js b/typo3/sysext/backend/Resources/Public/JavaScript/icons.js new file mode 100644 index 0000000000000000000000000000000000000000..87f800d538090d1a43b742ba47d58cea93230d45 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/icons.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import ClientStorage from"@typo3/backend/storage/client.js";import{Sizes,States,MarkupIdentifiers}from"@typo3/backend/enum/icon-types.js";class Icons{constructor(){this.sizes=Sizes,this.states=States,this.markupIdentifiers=MarkupIdentifiers,this.promiseCache={}}getIcon(e,t,i,s,r){const o=[e,t=t||Sizes.default,i,s=s||States.default,r=r||MarkupIdentifiers.default],n=o.join("_");return this.getIconRegistryCache().then(e=>(ClientStorage.isset("icon_registry_cache_identifier")&&ClientStorage.get("icon_registry_cache_identifier")===e||(ClientStorage.unsetByPrefix("icon_"),ClientStorage.set("icon_registry_cache_identifier",e)),this.fetchFromLocal(n).then(null,()=>this.fetchFromRemote(o,n))))}getIconRegistryCache(){const e="icon_registry_cache_identifier";return this.isPromiseCached(e)||this.putInPromiseCache(e,new AjaxRequest(TYPO3.settings.ajaxUrls.icons_cache).get().then(async e=>await e.resolve())),this.getFromPromiseCache(e)}fetchFromRemote(e,t){if(!this.isPromiseCached(t)){const i={icon:JSON.stringify(e)};this.putInPromiseCache(t,new AjaxRequest(TYPO3.settings.ajaxUrls.icons).withQueryArguments(i).get().then(async e=>{const i=await e.resolve();return i.includes("t3js-icon")&&i.includes('<span class="icon-markup">')&&ClientStorage.set("icon_"+t,i),i}))}return this.getFromPromiseCache(t)}fetchFromLocal(e){return ClientStorage.isset("icon_"+e)?Promise.resolve(ClientStorage.get("icon_"+e)):Promise.reject()}isPromiseCached(e){return void 0!==this.promiseCache[e]}getFromPromiseCache(e){return this.promiseCache[e]}putInPromiseCache(e,t){this.promiseCache[e]=t}}let iconsObject;iconsObject||(iconsObject=new Icons,TYPO3.Icons=iconsObject);export default iconsObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/image-manipulation.js b/typo3/sysext/backend/Resources/Public/JavaScript/image-manipulation.js new file mode 100644 index 0000000000000000000000000000000000000000..9c2175b7fd0551a665b6bc127b6083b2a1932e41 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/image-manipulation.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import"jquery-ui/draggable.js";import"jquery-ui/resizable.js";import FormEngineValidation from"@typo3/backend/form-engine-validation.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Cropper from"cropperjs";import ImagesLoaded from"imagesloaded";import Icons from"@typo3/backend/icons.js";import Modal from"@typo3/backend/modal.js";class ImageManipulation{constructor(){this.initialized=!1,this.cropImageContainerSelector="#t3js-crop-image-container",this.cropImageSelector="#t3js-crop-image",this.coverAreaSelector=".t3js-cropper-cover-area",this.cropInfoSelector=".t3js-cropper-info-crop",this.focusAreaSelector="#t3js-cropper-focus-area",this.defaultFocusArea={height:1/3,width:1/3,x:0,y:0},this.defaultOpts={autoCrop:!0,autoCropArea:.7,dragMode:"crop",guides:!0,responsive:!0,viewMode:1,zoomable:!1,checkCrossOrigin:!1},this.cropBuiltHandler=()=>{this.initialized=!0;const t=this.cropper.getImageData(),e=this.currentModal.find(this.cropImageSelector);this.currentModal.find(".cropper-canvas img").removeClass("cropper-hide"),this.imageOriginalSizeFactor=e.data("originalWidth")/t.naturalWidth,this.cropVariantTriggers.each((e,r)=>{const a=$(r).attr("data-crop-variant-id"),i=this.convertRelativeToAbsoluteCropArea(this.data[a].cropArea,t),o=$.extend(!0,{},this.data[a],{cropArea:i});this.updatePreviewThumbnail(o,$(r))}),this.currentCropVariant.cropArea=this.convertRelativeToAbsoluteCropArea(this.currentCropVariant.cropArea,t),this.cropBox=this.currentModal.find(".cropper-crop-box"),this.setCropArea(this.currentCropVariant.cropArea),this.currentCropVariant.coverAreas&&this.initCoverAreas(this.cropBox,this.currentCropVariant.coverAreas),this.currentCropVariant.focusArea&&(ImageManipulation.isEmptyArea(this.currentCropVariant.focusArea)&&(this.currentCropVariant.focusArea=$.extend(!0,{},this.defaultFocusArea)),this.initFocusArea(this.cropBox),this.scaleAndMoveFocusArea(this.currentCropVariant.focusArea)),this.currentCropVariant.selectedRatio&&this.currentModal.find(`[data-bs-option='${this.currentCropVariant.selectedRatio}']`).addClass("active")},this.cropMoveHandler=t=>{if(!this.initialized)return;this.currentCropVariant.cropArea=$.extend(!0,this.currentCropVariant.cropArea,{height:Math.floor(t.detail.height),width:Math.floor(t.detail.width),x:Math.floor(t.detail.x),y:Math.floor(t.detail.y)}),this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger),this.updateCropVariantData(this.currentCropVariant);const e=Math.round(this.currentCropVariant.cropArea.width*this.imageOriginalSizeFactor),r=Math.round(this.currentCropVariant.cropArea.height*this.imageOriginalSizeFactor);this.cropInfo.text(`${e}×${r} px`)},this.cropStartHandler=()=>{this.currentCropVariant.focusArea&&(this.focusArea.draggable("option","disabled",!0),this.focusArea.resizable("option","disabled",!0))},this.cropEndHandler=()=>{this.currentCropVariant.focusArea&&(this.focusArea.draggable("option","disabled",!1),this.focusArea.resizable("option","disabled",!1))}}static isEmptyArea(t){return $.isEmptyObject(t)}static wait(t,e){window.setTimeout(t,e)}static toCssPercent(t){return 100*t+"%"}static serializeCropVariants(t){return JSON.stringify(t,(t,e)=>"id"===t||"title"===t||"allowedAspectRatios"===t||"coverAreas"===t?void 0:e)}initializeTrigger(){$(".t3js-image-manipulation-trigger").off("click").on("click",t=>{t.preventDefault(),this.trigger=$(t.currentTarget),this.show()})}initializeCropperModal(){const t=this.currentModal.find(this.cropImageSelector);ImagesLoaded(t.get(0),()=>{this.init()})}show(){const t=this.trigger.data("modalTitle"),e=this.trigger.data("buttonPreviewText"),r=this.trigger.data("buttonDismissText"),a=this.trigger.data("buttonSaveText"),i=this.trigger.data("url"),o=this.trigger.data("payload");Icons.getIcon("spinner-circle",Icons.sizes.default,null,null,Icons.markupIdentifiers.inline).then(s=>{this.currentModal=Modal.advanced({additionalCssClasses:["modal-image-manipulation"],buttons:[{btnClass:"btn-default pull-left",dataAttributes:{method:"preview"},icon:"actions-view",text:e},{btnClass:"btn-default",dataAttributes:{method:"dismiss"},icon:"actions-close",text:r},{btnClass:"btn-primary",dataAttributes:{method:"save"},icon:"actions-document-save",text:a}],content:$('<div class="modal-loading">').append(s),size:Modal.sizes.full,style:Modal.styles.dark,title:t}),this.currentModal.on("shown.bs.modal",()=>{new AjaxRequest(i).post(o).then(async t=>{this.currentModal.find(".t3js-modal-body").append(await t.resolve()).addClass("cropper"),this.currentModal.find(".modal-loading").remove(),this.initializeCropperModal()})}),this.currentModal.on("hide.bs.modal",()=>{this.destroy()}),this.currentModal.css("pointer-events","none")})}init(){const t=this.currentModal.find(this.cropImageSelector),e=this.trigger.attr("data-crop-variants");if(!e)throw new TypeError("ImageManipulation: No cropVariants data found for image");this.data=$.isEmptyObject(this.data)?JSON.parse(e):this.data,this.cropVariantTriggers=this.currentModal.find(".t3js-crop-variant-trigger"),this.activeCropVariantTrigger=this.currentModal.find(".t3js-crop-variant-trigger.is-active"),this.cropInfo=this.currentModal.find(this.cropInfoSelector),this.saveButton=this.currentModal.find("[data-method=save]"),this.previewButton=this.currentModal.find("[data-method=preview]"),this.dismissButton=this.currentModal.find("[data-method=dismiss]"),this.resetButton=this.currentModal.find("[data-method=reset]"),this.aspectRatioTrigger=this.currentModal.find("[data-method=setAspectRatio]"),this.currentCropVariant=this.data[this.activeCropVariantTrigger.attr("data-crop-variant-id")],this.cropVariantTriggers.off("click").on("click",t=>{if($(t.currentTarget).hasClass("is-active"))return t.stopPropagation(),void t.preventDefault();this.activeCropVariantTrigger.removeClass("is-active"),$(t.currentTarget).addClass("is-active"),this.activeCropVariantTrigger=$(t.currentTarget);const e=this.data[this.activeCropVariantTrigger.attr("data-crop-variant-id")],r=this.cropper.getImageData();e.cropArea=this.convertRelativeToAbsoluteCropArea(e.cropArea,r),this.currentCropVariant=$.extend(!0,{},e),this.update(e)}),this.aspectRatioTrigger.off("click").on("click",t=>{const e=$(t.currentTarget).attr("data-bs-option"),r=$.extend(!0,{},this.currentCropVariant),a=r.allowedAspectRatios[e];this.setAspectRatio(a),this.setCropArea(r.cropArea),this.currentCropVariant=$.extend(!0,{},r,{selectedRatio:e}),this.update(this.currentCropVariant)}),this.saveButton.off("click").on("click",()=>{this.save(this.data)}),this.trigger.attr("data-preview-url")?this.previewButton.off("click").on("click",()=>{this.openPreview(this.data)}):this.previewButton.hide(),this.dismissButton.off("click").on("click",()=>{this.currentModal.modal("hide")}),this.resetButton.off("click").on("click",t=>{const e=this.cropper.getImageData(),r=$(t.currentTarget).attr("data-crop-variant");if(t.preventDefault(),t.stopPropagation(),!r)throw new TypeError("TYPO3 Cropper: No cropVariant data attribute found on reset element.");const a=JSON.parse(r),i=this.convertRelativeToAbsoluteCropArea(a.cropArea,e);this.currentCropVariant=$.extend(!0,{},a,{cropArea:i}),this.update(this.currentCropVariant)}),ImageManipulation.isEmptyArea(this.currentCropVariant.cropArea)&&(this.defaultOpts=$.extend({autoCropArea:1},this.defaultOpts)),this.cropper=new Cropper(t.get(0),$.extend(this.defaultOpts,{ready:this.cropBuiltHandler,crop:this.cropMoveHandler,cropend:this.cropEndHandler,cropstart:this.cropStartHandler,data:this.currentCropVariant.cropArea})),this.update(this.currentCropVariant)}update(t){const e=$.extend(!0,{},t),r=t.allowedAspectRatios[t.selectedRatio];this.currentModal.find("[data-bs-option]").removeClass("active"),this.currentModal.find(`[data-bs-option="${t.selectedRatio}"]`).addClass("active"),this.setAspectRatio(r),this.setCropArea(e.cropArea),this.currentCropVariant=$.extend(!0,{},e,t),this.cropBox.find(this.coverAreaSelector).remove(),this.cropBox.has(this.focusAreaSelector).length&&(this.focusArea.resizable("destroy").draggable("destroy"),this.focusArea.remove()),t.focusArea&&(ImageManipulation.isEmptyArea(t.focusArea)&&(this.currentCropVariant.focusArea=$.extend(!0,{},this.defaultFocusArea)),this.initFocusArea(this.cropBox),this.scaleAndMoveFocusArea(this.currentCropVariant.focusArea)),t.coverAreas&&this.initCoverAreas(this.cropBox,this.currentCropVariant.coverAreas),this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger)}initFocusArea(t){this.focusArea=$('<div id="t3js-cropper-focus-area" class="cropper-focus-area"></div>'),t.append(this.focusArea),this.focusArea.draggable({containment:t,create:()=>{const t="undefined"!=typeof window&&void 0!==window.document,e=!(!t||!window.document.documentElement)&&"ontouchstart"in window.document.documentElement,r=!!t&&"PointerEvent"in window,a=r?"pointerdown":e?"touchstart":"mousedown",i=r?"pointerup pointercancel":e?"touchend touchcancel":"mouseup";this.focusArea.on(a,()=>{this.cropper.disable()}),this.focusArea.on(i,()=>{this.cropper.enable()}),this.scaleAndMoveFocusArea(this.currentCropVariant.focusArea)},drag:()=>{const{left:e,top:r}=t.offset(),{left:a,top:i}=this.focusArea.offset(),{focusArea:o,coverAreas:s}=this.currentCropVariant;o.x=(a-e)/t.width(),o.y=(i-r)/t.height(),this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger),this.checkFocusAndCoverAreasCollision(o,s)?this.focusArea.addClass("has-nodrop"):this.focusArea.removeClass("has-nodrop")},revert:()=>{const{left:e,top:r}=t.offset(),{left:a,top:i}=this.focusArea.offset(),{focusArea:o,coverAreas:s}=this.currentCropVariant;return!!this.checkFocusAndCoverAreasCollision(o,s)&&(this.focusArea.removeClass("has-nodrop"),ImageManipulation.wait(()=>{o.x=(a-e)/t.width(),o.y=(i-r)/t.height(),this.updateCropVariantData(this.currentCropVariant)},250),!0)},revertDuration:200,stop:()=>{const{left:e,top:r}=t.offset(),{left:a,top:i}=this.focusArea.offset(),{focusArea:o}=this.currentCropVariant;o.x=(a-e)/t.width(),o.y=(i-r)/t.height(),this.scaleAndMoveFocusArea(o)}}).resizable({containment:t,handles:"all",resize:()=>{const{left:e,top:r}=t.offset(),{left:a,top:i}=this.focusArea.offset(),{focusArea:o,coverAreas:s}=this.currentCropVariant;o.height=this.focusArea.height()/t.height(),o.width=this.focusArea.width()/t.width(),o.x=(a-e)/t.width(),o.y=(i-r)/t.height(),this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger),this.checkFocusAndCoverAreasCollision(o,s)?this.focusArea.addClass("has-nodrop"):this.focusArea.removeClass("has-nodrop")},stop:(e,r)=>{const{left:a,top:i}=t.offset(),{left:o,top:s}=this.focusArea.offset(),{focusArea:n,coverAreas:c}=this.currentCropVariant;this.checkFocusAndCoverAreasCollision(n,c)?r.element.animate($.extend(r.originalPosition,r.originalSize),250,()=>{n.height=this.focusArea.height()/t.height(),n.width=this.focusArea.width()/t.width(),n.x=(o-a)/t.width(),n.y=(s-i)/t.height(),this.scaleAndMoveFocusArea(n),this.focusArea.removeClass("has-nodrop")}):this.scaleAndMoveFocusArea(n)}})}initCoverAreas(t,e){e.forEach(e=>{const r=$('<div class="cropper-cover-area t3js-cropper-cover-area"></div>');t.append(r),r.css({height:ImageManipulation.toCssPercent(e.height),left:ImageManipulation.toCssPercent(e.x),top:ImageManipulation.toCssPercent(e.y),width:ImageManipulation.toCssPercent(e.width)})})}updatePreviewThumbnail(t,e){let r;const a=e.find(".t3js-cropper-preview-thumbnail-crop-area"),i=e.find(".t3js-cropper-preview-thumbnail-crop-image"),o=e.find(".t3js-cropper-preview-thumbnail-focus-area"),s=this.cropper.getImageData();a.css({height:ImageManipulation.toCssPercent(t.cropArea.height/s.naturalHeight),left:ImageManipulation.toCssPercent(t.cropArea.x/s.naturalWidth),top:ImageManipulation.toCssPercent(t.cropArea.y/s.naturalHeight),width:ImageManipulation.toCssPercent(t.cropArea.width/s.naturalWidth)}),t.focusArea&&o.css({height:ImageManipulation.toCssPercent(t.focusArea.height),left:ImageManipulation.toCssPercent(t.focusArea.x),top:ImageManipulation.toCssPercent(t.focusArea.y),width:ImageManipulation.toCssPercent(t.focusArea.width)}),r=a.css(["width","height","left","top"]),i.css({height:parseFloat(r.height)*(1/(t.cropArea.height/s.naturalHeight))+"px",margin:-1*parseFloat(r.left)+"px",marginTop:-1*parseFloat(r.top)+"px",width:parseFloat(r.width)*(1/(t.cropArea.width/s.naturalWidth))+"px"})}scaleAndMoveFocusArea(t){this.focusArea.css({height:ImageManipulation.toCssPercent(t.height),left:ImageManipulation.toCssPercent(t.x),top:ImageManipulation.toCssPercent(t.y),width:ImageManipulation.toCssPercent(t.width)}),this.currentCropVariant.focusArea=t,this.updatePreviewThumbnail(this.currentCropVariant,this.activeCropVariantTrigger),this.updateCropVariantData(this.currentCropVariant)}updateCropVariantData(t){const e=this.cropper.getImageData(),r=this.convertAbsoluteToRelativeCropArea(t.cropArea,e);this.data[t.id]=$.extend(!0,{},t,{cropArea:r})}setAspectRatio(t){this.cropper.setAspectRatio(t.value)}setCropArea(t){const e=this.currentCropVariant.allowedAspectRatios[this.currentCropVariant.selectedRatio];0===e.value?this.cropper.setData({height:t.height,width:t.width,x:t.x,y:t.y}):this.cropper.setData({height:t.height,width:t.height*e.value,x:t.x,y:t.y})}checkFocusAndCoverAreasCollision(t,e){return!!e&&e.some(e=>t.x<e.x+e.width&&t.x+t.width>e.x&&t.y<e.y+e.height&&t.height+t.y>e.y)}convertAbsoluteToRelativeCropArea(t,e){const{height:r,width:a,x:i,y:o}=t;return{height:r/e.naturalHeight,width:a/e.naturalWidth,x:i/e.naturalWidth,y:o/e.naturalHeight}}convertRelativeToAbsoluteCropArea(t,e){const{height:r,width:a,x:i,y:o}=t;return{height:r*e.naturalHeight,width:a*e.naturalWidth,x:i*e.naturalWidth,y:o*e.naturalHeight}}setPreviewImages(t){const e=this.cropper.image,r=this.cropper.getImageData();Object.keys(t).forEach(a=>{const i=t[a],o=this.convertRelativeToAbsoluteCropArea(i.cropArea,r),s=this.trigger.closest(".form-group").find(`.t3js-image-manipulation-preview[data-crop-variant-id="${a}"]`),n=this.trigger.closest(".form-group").find(`.t3js-image-manipulation-selected-ratio[data-crop-variant-id="${a}"]`);if(0===s.length)return;let c=s.width(),h=s.data("preview-height");const p=o.width/o.height,d=c/p;d>h?c=h*p:h=d,c>o.width&&(c=o.width,h=o.height);const l=c/o.width,u=$("<div />").html('<img src="'+e.src+'">'),g=this.currentModal.find(`.t3-js-ratio-title[data-ratio-id="${i.id}${i.selectedRatio}"]`);n.text(g.text()),u.addClass("cropper-preview-container"),s.empty().append(u),u.wrap('<span class="thumbnail thumbnail-status"></span>'),u.width(c).height(h).find("img").css({height:r.naturalHeight*l,left:-o.x*l,top:-o.y*l,width:r.naturalWidth*l})})}openPreview(t){const e=ImageManipulation.serializeCropVariants(t);let r=this.trigger.attr("data-preview-url");r=r+"&cropVariants="+encodeURIComponent(e),window.open(r,"TYPO3ImageManipulationPreview")}save(t){const e=ImageManipulation.serializeCropVariants(t),r=$("#"+this.trigger.attr("data-field"));this.trigger.attr("data-crop-variants",JSON.stringify(t)),this.setPreviewImages(t),r.val(e),FormEngineValidation.markFieldAsChanged(r),this.currentModal.modal("hide")}destroy(){this.currentModal&&(this.cropper instanceof Cropper&&this.cropper.destroy(),this.initialized=!1,this.cropper=null,this.currentModal=null,this.data=null)}}export default new ImageManipulation; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/info-window.js b/typo3/sysext/backend/Resources/Public/JavaScript/info-window.js new file mode 100644 index 0000000000000000000000000000000000000000..061a2a210665b4aeadcc34da513a31e2318b2e39 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/info-window.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{SeverityEnum}from"@typo3/backend/enum/severity.js";import Modal from"@typo3/backend/modal.js";class InfoWindow{static showItem(o,e){Modal.advanced({type:Modal.types.iframe,size:Modal.sizes.large,content:top.TYPO3.settings.ShowItem.moduleUrl+"&table="+encodeURIComponent(o)+"&uid="+("number"==typeof e?e:encodeURIComponent(e)),severity:SeverityEnum.notice})}}top.TYPO3.InfoWindow||(top.TYPO3.InfoWindow=InfoWindow),TYPO3.InfoWindow=InfoWindow;export default InfoWindow; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Input/Clearable.js b/typo3/sysext/backend/Resources/Public/JavaScript/input/clearable.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Input/Clearable.js rename to typo3/sysext/backend/Resources/Public/JavaScript/input/clearable.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/JavaScriptModuleImportEventHandler.js b/typo3/sysext/backend/Resources/Public/JavaScript/java-script-module-import-event-handler.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/JavaScriptModuleImportEventHandler.js rename to typo3/sysext/backend/Resources/Public/JavaScript/java-script-module-import-event-handler.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/layout-module/drag-drop.js b/typo3/sysext/backend/Resources/Public/JavaScript/layout-module/drag-drop.js new file mode 100644 index 0000000000000000000000000000000000000000..2fe34364a5d34e3a9ed37df1c6b83470a7ca0b24 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/layout-module/drag-drop.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import"jquery-ui/droppable.js";import DataHandler from"@typo3/backend/ajax-data-handler.js";import Icons from"@typo3/backend/icons.js";class DragDrop{static initialize(){$(DragDrop.contentIdentifier).draggable({handle:DragDrop.dragHeaderIdentifier,scope:"tt_content",cursor:"move",distance:20,revert:"invalid",zIndex:100,start:e=>{DragDrop.onDragStart($(e.target))},stop:e=>{DragDrop.onDragStop($(e.target))}}),$(DragDrop.dropZoneIdentifier).droppable({accept:this.contentIdentifier,scope:"tt_content",tolerance:"pointer",over:(e,r)=>{DragDrop.onDropHoverOver($(r.draggable),$(e.target))},out:(e,r)=>{DragDrop.onDropHoverOut($(r.draggable),$(e.target))},drop:(e,r)=>{DragDrop.onDrop($(r.draggable),$(e.target),e)}})}static onDragStart(e){DragDrop.originalStyles=e.get(0).style.cssText,e.children(DragDrop.dragIdentifier).addClass("dragitem-shadow"),e.append('<div class="ui-draggable-copy-message">'+TYPO3.lang["dragdrop.copy.message"]+"</div>"),e.children(DragDrop.dropZoneIdentifier).addClass("drag-start"),e.closest(DragDrop.columnIdentifier).removeClass("active"),e.find(DragDrop.dropZoneIdentifier).hide(),$(DragDrop.dropZoneIdentifier).each((e,r)=>{const a=$(r);a.parent().find(DragDrop.addContentIdentifier).length&&a.addClass(DragDrop.validDropZoneClass)})}static onDragStop(e){e.children(DragDrop.dragIdentifier).removeClass("dragitem-shadow"),e.children(DragDrop.dropZoneIdentifier).removeClass("drag-start"),e.closest(DragDrop.columnIdentifier).addClass("active"),e.find(DragDrop.dropZoneIdentifier).show(),e.find(".ui-draggable-copy-message").remove(),e.get(0).style.cssText=DragDrop.originalStyles,$(DragDrop.dropZoneIdentifier+"."+DragDrop.validDropZoneClass).removeClass(DragDrop.validDropZoneClass)}static onDropHoverOver(e,r){r.hasClass(DragDrop.validDropZoneClass)&&r.addClass(DragDrop.dropPossibleHoverClass)}static onDropHoverOut(e,r){r.removeClass(DragDrop.dropPossibleHoverClass)}static onDrop(e,r,a){const t=DragDrop.getColumnPositionForElement(r);r.removeClass(DragDrop.dropPossibleHoverClass);const o=parseInt(e.data("uid"),10);if("number"==typeof o&&o>0){let s={};const n=r.closest(DragDrop.contentIdentifier).data("uid");let i=0;i=void 0===n?parseInt(a.target.offsetParent.getAttribute("data-page"),10):0-parseInt(n,10);let d=parseInt(e.data("language-uid"),10);-1!==d&&(d=parseInt(r.closest("[data-language-uid]").data("language-uid"),10));let p=0;0!==i&&(p=t);const g=a&&a.originalEvent.ctrlKey||r.hasClass("t3js-paste-copy"),l=g?"copy":"move";s.cmd={tt_content:{[o]:{[l]:{action:"paste",target:i,update:{colPos:p,sys_language_uid:d}}}}},DragDrop.ajaxAction(r,e,s,g).then(()=>{const r=$(`.t3-page-column-lang-name[data-language-uid="${d}"]`);if(0===r.length)return;const a=r.data("flagIdentifier"),t=r.data("languageTitle");Icons.getIcon(a,Icons.sizes.small).then(r=>{e.find(".t3js-flag").attr("title",t).html(r)})})}}static ajaxAction(e,r,a,t){const o=Object.keys(a.cmd).shift(),s=parseInt(Object.keys(a.cmd[o]).shift(),10),n={component:"dragdrop",action:t?"copy":"move",table:o,uid:s};return DataHandler.process(a,n).then(a=>{if(a.hasErrors)throw a.messages;e.parent().hasClass(DragDrop.contentIdentifier.substring(1))?r.detach().css({top:0,left:0}).insertAfter(e.closest(DragDrop.contentIdentifier)):r.detach().css({top:0,left:0}).insertAfter(e.closest(DragDrop.dropZoneIdentifier)),t&&self.location.reload()})}static getColumnPositionForElement(e){const r=e.closest("[data-colpos]");return!(!r.length||"undefined"===r.data("colpos"))&&r.data("colpos")}}DragDrop.contentIdentifier=".t3js-page-ce",DragDrop.dragIdentifier=".t3-page-ce-dragitem",DragDrop.dragHeaderIdentifier=".t3js-page-ce-draghandle",DragDrop.dropZoneIdentifier=".t3js-page-ce-dropzone-available",DragDrop.columnIdentifier=".t3js-page-column",DragDrop.validDropZoneClass="active",DragDrop.dropPossibleHoverClass="t3-page-ce-dropzone-possible",DragDrop.addContentIdentifier=".t3js-page-new-ce",DragDrop.originalStyles="";export default DragDrop;$(DragDrop.initialize); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/layout-module/paste.js b/typo3/sysext/backend/Resources/Public/JavaScript/layout-module/paste.js new file mode 100644 index 0000000000000000000000000000000000000000..88fe0bbd4d42a641991d5fa2419c79bb3fe896aa --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/layout-module/paste.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import DataHandler from"@typo3/backend/ajax-data-handler.js";import Modal from"@typo3/backend/modal.js";import Severity from"@typo3/backend/severity.js";import"@typo3/backend/element/icon-element.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";class Paste{constructor(){this.itemOnClipboardUid=0,this.itemOnClipboardTitle="",this.copyMode="",this.elementIdentifier=".t3js-page-ce",this.pasteAfterLinkTemplate="",this.pasteIntoLinkTemplate="",$(()=>{$(".t3js-page-columns").length&&(this.generateButtonTemplates(),this.activatePasteIcons(),this.initializeEvents())})}static determineColumn(t){const e=t.closest("[data-colpos]");return e.length&&"undefined"!==e.data("colpos")?e.data("colpos"):0}initializeEvents(){$(document).on("click",".t3js-paste",t=>{t.preventDefault(),this.activatePasteModal($(t.currentTarget))})}generateButtonTemplates(){this.itemOnClipboardUid&&(this.pasteAfterLinkTemplate='<button type="button" class="t3js-paste t3js-paste'+(this.copyMode?"-"+this.copyMode:"")+' t3js-paste-after btn btn-default btn-sm" title="'+TYPO3.lang?.pasteAfterRecord+'"><typo3-backend-icon identifier="actions-document-paste-into" size="small"></typo3-backend-icon></button>',this.pasteIntoLinkTemplate='<button type="button" class="t3js-paste t3js-paste'+(this.copyMode?"-"+this.copyMode:"")+' t3js-paste-into btn btn-default btn-sm" title="'+TYPO3.lang?.pasteIntoColumn+'"><typo3-backend-icon identifier="actions-document-paste-into" size="small"></typo3-backend-icon></button>')}activatePasteIcons(){$(".t3-page-ce-wrapper-new-ce").each((t,e)=>{if(this.pasteAfterLinkTemplate&&this.pasteIntoLinkTemplate){$(e).parent().data("page")?$(e).append(this.pasteIntoLinkTemplate):$(e).append(this.pasteAfterLinkTemplate)}})}activatePasteModal(t){const e=(TYPO3.lang["paste.modal.title.paste"]||"Paste record")+': "'+this.itemOnClipboardTitle+'"',a=TYPO3.lang["paste.modal.paste"]||"Do you want to paste the record to this position?";let s=[];s=[{text:TYPO3.lang["paste.modal.button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}},{text:TYPO3.lang["paste.modal.button.paste"]||"Paste",btnClass:"btn-"+Severity.getCssClass(SeverityEnum.warning),trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.execute(t)}}],Modal.show(e,a,SeverityEnum.warning,s)}execute(t){const e=Paste.determineColumn(t),a=t.closest(this.elementIdentifier),s=a.data("uid");let n;n=void 0===s?parseInt(a.data("page"),10):0-parseInt(s,10);const i={CB:{paste:"tt_content|"+n,pad:"normal",update:{colPos:e,sys_language_uid:parseInt(t.closest("[data-language-uid]").data("language-uid"),10)}}};DataHandler.process(i).then(t=>{t.hasErrors||window.location.reload()})}}export default new Paste; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/localization.js b/typo3/sysext/backend/Resources/Public/JavaScript/localization.js new file mode 100644 index 0000000000000000000000000000000000000000..01ca9e833cd99c950492d96062e5e925547e7f68 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/localization.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Icons from"@typo3/backend/icons.js";import Wizard from"@typo3/backend/wizard.js";class Localization{constructor(){this.triggerButton=".t3js-localize",this.localizationMode=null,this.sourceLanguage=null,this.records=[],$(()=>{this.initialize()})}initialize(){const e=this;Icons.getIcon("actions-localize",Icons.sizes.large).then(a=>{Icons.getIcon("actions-edit-copy",Icons.sizes.large).then(t=>{$(e.triggerButton).removeClass("disabled"),$(document).on("click",e.triggerButton,e=>{e.preventDefault();const l=$(e.currentTarget),i=[],s=[];let o="";l.data("allowTranslate")&&(i.push('<div class="row"><div class="col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-translate">'+a+'<input type="radio" name="mode" id="mode_translate" value="localize" style="display: none"><br>'+TYPO3.lang["localize.wizard.button.translate"]+'</label></div><div class="col-sm-9"><p class="t3js-helptext t3js-helptext-translate text-muted">'+TYPO3.lang["localize.educate.translate"]+"</p></div></div>"),s.push("localize")),l.data("allowCopy")&&(i.push('<div class="row"><div class="col-sm-3"><label class="btn btn-block btn-default t3js-localization-option" data-helptext=".t3js-helptext-copy">'+t+'<input type="radio" name="mode" id="mode_copy" value="copyFromLanguage" style="display: none"><br>'+TYPO3.lang["localize.wizard.button.copy"]+'</label></div><div class="col-sm-9"><p class="t3js-helptext t3js-helptext-copy text-muted">'+TYPO3.lang["localize.educate.copy"]+"</p></div></div>"),s.push("copyFromLanguage")),0===l.data("allowTranslate")&&0===l.data("allowCopy")&&i.push('<div class="row"><div class="col-sm-12"><div class="alert alert-warning"><div class="media"><div class="media-left"><span class="fa-stack fa-lg"><i class="fa fa-circle fa-stack-2x"></i><i class="fa fa-exclamation fa-stack-1x"></i></span></div><div class="media-body"><p class="alert-message">'+TYPO3.lang["localize.educate.noTranslate"]+"</p></div></div></div></div></div>"),o+='<div data-bs-toggle="buttons">'+i.join("<hr>")+"</div>",Wizard.addSlide("localize-choose-action",TYPO3.lang["localize.wizard.header_page"].replace("{0}",l.data("page")).replace("{1}",l.data("languageName")),o,SeverityEnum.info,()=>{1===s.length&&(this.localizationMode=s[0],Wizard.unlockNextStep().trigger("click"))}),Wizard.addSlide("localize-choose-language",TYPO3.lang["localize.view.chooseLanguage"],"",SeverityEnum.info,e=>{Icons.getIcon("spinner-circle-dark",Icons.sizes.large).then(a=>{e.html('<div class="text-center">'+a+"</div>"),this.loadAvailableLanguages(parseInt(l.data("pageId"),10),parseInt(l.data("languageId"),10)).then(async a=>{const t=await a.resolve();if(1===t.length)return this.sourceLanguage=t[0].uid,void Wizard.unlockNextStep().trigger("click");Wizard.getComponent().on("click",".t3js-language-option",e=>{const a=$(e.currentTarget).prev();this.sourceLanguage=a.val(),Wizard.unlockNextStep()});const l=$("<div />",{class:"row"});for(const e of t){const a="language"+e.uid,t=$("<input />",{type:"radio",name:"language",id:a,value:e.uid,style:"display: none;",class:"btn-check"}),i=$("<label />",{class:"btn btn-default btn-block t3js-language-option option",for:a}).text(" "+e.title).prepend(e.flagIcon);l.append($("<div />",{class:"col-sm-4"}).append(t).append(i))}e.empty().append(l)})})}),Wizard.addSlide("localize-summary",TYPO3.lang["localize.view.summary"],"",SeverityEnum.info,e=>{Icons.getIcon("spinner-circle-dark",Icons.sizes.large).then(a=>{e.html('<div class="text-center">'+a+"</div>")}),this.getSummary(parseInt(l.data("pageId"),10),parseInt(l.data("languageId"),10)).then(async a=>{const t=await a.resolve();e.empty(),this.records=[];const l=t.columns.columns;t.columns.columnList.forEach(a=>{if(void 0===t.records[a])return;const i=l[a],s=$("<div />",{class:"row"});t.records[a].forEach(e=>{const a=" ("+e.uid+") "+e.title;this.records.push(e.uid),s.append($("<div />",{class:"col-sm-6"}).append($("<div />",{class:"input-group"}).append($("<span />",{class:"input-group-addon"}).append($("<input />",{type:"checkbox",class:"t3js-localization-toggle-record",id:"record-uid-"+e.uid,checked:"checked","data-uid":e.uid,"aria-label":a})),$("<label />",{class:"form-control",for:"record-uid-"+e.uid}).text(a).prepend(e.icon))))}),e.append($("<fieldset />",{class:"localization-fieldset"}).append($("<label />").text(i).prepend($("<input />",{class:"t3js-localization-toggle-column",type:"checkbox",checked:"checked"})),s))}),Wizard.unlockNextStep(),Wizard.getComponent().on("change",".t3js-localization-toggle-record",e=>{const a=$(e.currentTarget),t=a.data("uid"),l=a.closest("fieldset"),i=l.find(".t3js-localization-toggle-column");if(a.is(":checked"))this.records.push(t);else{const e=this.records.indexOf(t);e>-1&&this.records.splice(e,1)}const s=l.find(".t3js-localization-toggle-record"),o=l.find(".t3js-localization-toggle-record:checked");i.prop("checked",o.length>0),i.prop("indeterminate",o.length>0&&o.length<s.length),this.records.length>0?Wizard.unlockNextStep():Wizard.lockNextStep()}).on("change",".t3js-localization-toggle-column",e=>{const a=$(e.currentTarget),t=a.closest("fieldset").find(".t3js-localization-toggle-record");t.prop("checked",a.is(":checked")),t.trigger("change")})})}),Wizard.addFinalProcessingSlide(()=>{this.localizeRecords(parseInt(l.data("pageId"),10),parseInt(l.data("languageId"),10),this.records).then(()=>{Wizard.dismiss(),document.location.reload()})}).then(()=>{Wizard.show(),Wizard.getComponent().on("click",".t3js-localization-option",e=>{const a=$(e.currentTarget),t=a.find('input[type="radio"]');if(a.data("helptext")){const t=$(e.delegateTarget);t.find(".t3js-localization-option").removeClass("active"),t.find(".t3js-helptext").addClass("text-muted"),a.addClass("active"),t.find(a.data("helptext")).removeClass("text-muted")}this.localizationMode=t.val(),Wizard.unlockNextStep()})})})})})}loadAvailableLanguages(e,a){return new AjaxRequest(TYPO3.settings.ajaxUrls.page_languages).withQueryArguments({pageId:e,languageId:a}).get()}getSummary(e,a){return new AjaxRequest(TYPO3.settings.ajaxUrls.records_localize_summary).withQueryArguments({pageId:e,destLanguageId:a,languageId:this.sourceLanguage}).get()}localizeRecords(e,a,t){return new AjaxRequest(TYPO3.settings.ajaxUrls.records_localize).withQueryArguments({pageId:e,srcLanguageId:this.sourceLanguage,destLanguageId:a,action:this.localizationMode,uidList:t}).get()}}export default new Localization; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/login-refresh.js b/typo3/sysext/backend/Resources/Public/JavaScript/login-refresh.js new file mode 100644 index 0000000000000000000000000000000000000000..5df940fb7f0a50b86c32188dee87762fdf991f96 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/login-refresh.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Notification from"@typo3/backend/notification.js";var MarkupIdentifiers;!function(e){e.loginrefresh="t3js-modal-loginrefresh",e.lockedModal="t3js-modal-backendlocked",e.loginFormModal="t3js-modal-backendloginform"}(MarkupIdentifiers||(MarkupIdentifiers={}));class LoginRefresh{constructor(){this.options={modalConfig:{backdrop:"static"}},this.intervalTime=60,this.intervalId=null,this.backendIsLocked=!1,this.isTimingOut=!1,this.$timeoutModal=null,this.$backendLockedModal=null,this.$loginForm=null,this.loginFramesetUrl="",this.logoutUrl="",this.submitForm=e=>{e.preventDefault();const o=this.$loginForm.find("form"),t=o.find("input[name=p_field]"),i=o.find("input[name=userident]"),s=t.val();if(""===s&&""===i.val())return Notification.error(TYPO3.lang["mess.refresh_login_failed"],TYPO3.lang["mess.refresh_login_emptyPassword"]),void t.focus();s&&(i.val(s),t.val(""));const a={login_status:"login"};$.each(o.serializeArray(),(function(e,o){a[o.name]=o.value})),new AjaxRequest(o.attr("action")).post(a).then(async e=>{(await e.resolve()).login.success?this.hideLoginForm():(Notification.error(TYPO3.lang["mess.refresh_login_failed"],TYPO3.lang["mess.refresh_login_failed_message"]),t.focus())})},this.checkActiveSession=()=>{new AjaxRequest(TYPO3.settings.ajaxUrls.login_timedout).get().then(async e=>{const o=await e.resolve();o.login.locked?this.backendIsLocked||(this.backendIsLocked=!0,this.showBackendLockedModal()):this.backendIsLocked&&(this.backendIsLocked=!1,this.hideBackendLockedModal()),this.backendIsLocked||(o.login.timed_out||o.login.will_time_out)&&(o.login.timed_out?this.showLoginForm():this.showTimeoutModal())})}}initialize(e){"object"==typeof e&&this.applyOptions(e),this.initializeTimeoutModal(),this.initializeBackendLockedModal(),this.initializeLoginForm(),this.startTask()}startTask(){if(null!==this.intervalId)return;let e=1e3*this.intervalTime;this.intervalId=setInterval(this.checkActiveSession,e)}stopTask(){clearInterval(this.intervalId),this.intervalId=null}setIntervalTime(e){this.intervalTime=Math.min(e,86400)}setLogoutUrl(e){this.logoutUrl=e}setLoginFramesetUrl(e){this.loginFramesetUrl=e}showTimeoutModal(){this.isTimingOut=!0,this.$timeoutModal.modal(this.options.modalConfig),this.$timeoutModal.modal("show"),this.fillProgressbar(this.$timeoutModal)}hideTimeoutModal(){this.isTimingOut=!1,this.$timeoutModal.modal("hide")}showBackendLockedModal(){this.$backendLockedModal.modal(this.options.modalConfig),this.$backendLockedModal.modal("show")}hideBackendLockedModal(){this.$backendLockedModal.modal("hide")}showLoginForm(){new AjaxRequest(TYPO3.settings.ajaxUrls.logout).get().then(()=>{TYPO3.configuration.showRefreshLoginPopup?this.showLoginPopup():(this.$loginForm.modal(this.options.modalConfig),this.$loginForm.modal("show"))})}showLoginPopup(){const e=window.open(this.loginFramesetUrl,"relogin_"+Math.random().toString(16).slice(2),"height=450,width=700,status=0,menubar=0,location=1");e&&e.focus()}hideLoginForm(){this.$loginForm.modal("hide")}initializeBackendLockedModal(){this.$backendLockedModal=this.generateModal(MarkupIdentifiers.lockedModal),this.$backendLockedModal.find(".modal-header h4").text(TYPO3.lang["mess.please_wait"]),this.$backendLockedModal.find(".modal-body").append($("<p />").text(TYPO3.lang["mess.be_locked"])),this.$backendLockedModal.find(".modal-footer").remove(),$("body").append(this.$backendLockedModal)}initializeTimeoutModal(){this.$timeoutModal=this.generateModal(MarkupIdentifiers.loginrefresh),this.$timeoutModal.addClass("modal-severity-notice"),this.$timeoutModal.find(".modal-header h4").text(TYPO3.lang["mess.login_about_to_expire_title"]),this.$timeoutModal.find(".modal-body").append($("<p />").text(TYPO3.lang["mess.login_about_to_expire"]),$("<div />",{class:"progress"}).append($("<div />",{class:"progress-bar progress-bar-warning progress-bar-striped progress-bar-animated",role:"progressbar","aria-valuemin":"0","aria-valuemax":"100"}).append($("<span />",{class:"sr-only"})))),this.$timeoutModal.find(".modal-footer").append($("<button />",{class:"btn btn-default","data-action":"logout"}).text(TYPO3.lang["mess.refresh_login_logout_button"]).on("click",()=>{top.location.href=this.logoutUrl}),$("<button />",{class:"btn btn-primary t3js-active","data-action":"refreshSession"}).text(TYPO3.lang["mess.refresh_login_refresh_button"]).on("click",()=>{new AjaxRequest(TYPO3.settings.ajaxUrls.login_timedout).get().then(()=>{this.hideTimeoutModal()})})),this.registerDefaultModalEvents(this.$timeoutModal),$("body").append(this.$timeoutModal)}initializeLoginForm(){if(TYPO3.configuration.showRefreshLoginPopup)return;this.$loginForm=this.generateModal(MarkupIdentifiers.loginFormModal),this.$loginForm.addClass("modal-notice");let e=String(TYPO3.lang["mess.refresh_login_title"]).replace("%s",TYPO3.configuration.username);this.$loginForm.find(".modal-header h4").text(e),this.$loginForm.find(".modal-body").append($("<p />").text(TYPO3.lang["mess.login_expired"]),$("<form />",{id:"beLoginRefresh",method:"POST",action:TYPO3.settings.ajaxUrls.login}).append($("<div />").append($("<input />",{type:"text",name:"username",class:"d-none",value:TYPO3.configuration.username}),$("<input />",{type:"hidden",name:"userident",id:"t3-loginrefresh-userident"})),$("<div />",{class:"form-group"}).append($("<input />",{type:"password",name:"p_field",autofocus:"autofocus",class:"form-control",placeholder:TYPO3.lang["mess.refresh_login_password"]})))),this.$loginForm.find(".modal-body .d-none").attr("autocomplete","username"),this.$loginForm.find(".modal-body .form-control").attr("autocomplete","current-password"),this.$loginForm.find(".modal-footer").append($("<a />",{href:this.logoutUrl,class:"btn btn-default"}).text(TYPO3.lang["mess.refresh_exit_button"]),$("<button />",{type:"button",class:"btn btn-primary","data-action":"refreshSession"}).text(TYPO3.lang["mess.refresh_login_button"]).on("click",()=>{this.$loginForm.find("form").trigger("submit")})),this.registerDefaultModalEvents(this.$loginForm).on("submit",this.submitForm),$("body").append(this.$loginForm)}generateModal(e){return $("<div />",{id:e,class:"t3js-modal "+e+" modal modal-type-default modal-severity-notice modal-style-light modal-size-small fade"}).append($("<div />",{class:"modal-dialog"}).append($("<div />",{class:"modal-content"}).append($("<div />",{class:"modal-header"}).append($("<h4 />",{class:"modal-title"})),$("<div />",{class:"modal-body"}),$("<div />",{class:"modal-footer"}))))}fillProgressbar(e){if(!this.isTimingOut)return;let o=0;const t=e.find(".progress-bar"),i=t.children(".sr-only"),s=setInterval(()=>{const e=o>=100;!this.isTimingOut||e?(clearInterval(s),e&&(this.hideTimeoutModal(),this.showLoginForm()),o=0):o+=1;const a=o+"%";t.css("width",a),i.text(a)},300)}registerDefaultModalEvents(e){return e.on("hidden.bs.modal",()=>{this.startTask()}).on("shown.bs.modal",()=>{this.stopTask(),this.$timeoutModal.find(".modal-footer .t3js-active").first().focus()}),e}applyOptions(e){void 0!==e.intervalTime&&this.setIntervalTime(e.intervalTime),void 0!==e.loginFramesetUrl&&this.setLoginFramesetUrl(e.loginFramesetUrl),void 0!==e.logoutUrl&&this.setLogoutUrl(e.logoutUrl)}}let loginRefreshObject;try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.LoginRefresh&&(loginRefreshObject=window.opener.TYPO3.LoginRefresh),parent&&parent.window.TYPO3&&parent.window.TYPO3.LoginRefresh&&(loginRefreshObject=parent.window.TYPO3.LoginRefresh),top&&top.TYPO3&&top.TYPO3.LoginRefresh&&(loginRefreshObject=top.TYPO3.LoginRefresh)}catch{}loginRefreshObject||(loginRefreshObject=new LoginRefresh,"undefined"!=typeof TYPO3&&(TYPO3.LoginRefresh=loginRefreshObject));export default loginRefreshObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/login.js b/typo3/sysext/backend/Resources/Public/JavaScript/login.js new file mode 100644 index 0000000000000000000000000000000000000000..8e3377d1fb39802ee57f839a76bbd8430ff1548f --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/login.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import"@typo3/backend/input/clearable.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";class BackendLogin{constructor(){this.ready=!0,this.options={error:".t3js-login-error",errorNoCookies:".t3js-login-error-nocookies",errorNoReferrer:".t3js-login-error-noreferrer",formFields:".t3js-login-formfields",interfaceField:".t3js-login-interface-field",loginForm:"#typo3-login-form",loginUrlLink:"t3js-login-url",submitButton:".t3js-login-submit",submitHandler:null,useridentField:".t3js-login-userident-field"},this.checkLoginRefresh(),this.checkCookieSupport(),this.checkForInterfaceCookie(),this.checkDocumentReferrerSupport(),this.initializeEvents(),top.location.href!==location.href&&(this.ready=!1,top.location.href=location.href),this.ready&&document.body.setAttribute("data-typo3-login-ready","true")}showLoginProcess(){this.showLoadingIndicator(),$(this.options.error).addClass("hidden"),$(this.options.errorNoCookies).addClass("hidden")}showLoadingIndicator(){const e=$(this.options.submitButton);e.html(e.data("loading-text"))}handleSubmit(e){this.showLoginProcess(),"function"==typeof this.options.submitHandler&&this.options.submitHandler(e)}interfaceSelectorChanged(){const e=new Date,o=new Date(e.getTime()+31536e6);document.cookie="typo3-login-interface="+$(this.options.interfaceField).val()+"; expires="+o.toUTCString()+";"}checkForInterfaceCookie(){if($(this.options.interfaceField).length){const e=document.cookie.indexOf("typo3-login-interface=");if(-1!==e){let o=document.cookie.substr(e+22);o=o.substr(0,o.indexOf(";")),$(this.options.interfaceField).val(o)}}}checkDocumentReferrerSupport(){const e=document.getElementById(this.options.loginUrlLink);null!==e&&void 0===e.dataset.referrerCheckEnabled&&"1"!==e.dataset.referrerCheckEnabled||void 0!==TYPO3.settings&&void 0!==TYPO3.settings.ajaxUrls&&new AjaxRequest(TYPO3.settings.ajaxUrls.login_preflight).get().then(async e=>{!0!==(await e.resolve("application/json")).capabilities.referrer&&document.querySelectorAll(this.options.errorNoReferrer).forEach(e=>e.classList.remove("hidden"))})}showCookieWarning(){$(this.options.formFields).addClass("hidden"),$(this.options.errorNoCookies).removeClass("hidden")}hideCookieWarning(){$(this.options.formFields).removeClass("hidden"),$(this.options.errorNoCookies).addClass("hidden")}checkLoginRefresh(){const e=document.querySelector(this.options.loginForm+' input[name="loginRefresh"]');e instanceof HTMLInputElement&&e.value&&window.opener&&window.opener.TYPO3&&window.opener.TYPO3.LoginRefresh&&(window.opener.TYPO3.LoginRefresh.startTask(),window.close())}checkCookieSupport(){const e=navigator.cookieEnabled;!1===e?this.showCookieWarning():document.cookie||null!==e||(document.cookie="typo3-login-cookiecheck=1",document.cookie?document.cookie="typo3-login-cookiecheck=; expires="+new Date(0).toUTCString():this.showCookieWarning())}initializeEvents(){$(document).ajaxStart(this.showLoadingIndicator.bind(this)),$(this.options.loginForm).on("submit",this.handleSubmit.bind(this)),$(this.options.interfaceField).length>0&&$(document).on("change blur",this.options.interfaceField,this.interfaceSelectorChanged.bind(this)),document.querySelectorAll(".t3js-clearable").forEach(e=>e.clearable()),$(".t3js-login-news-carousel").on("slide.bs.carousel",e=>{const o=$(e.relatedTarget).height();$(e.target).find("div.active").parent().animate({height:o},500)})}}export default new BackendLogin; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ModalInterface.js b/typo3/sysext/backend/Resources/Public/JavaScript/modal-interface.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/ModalInterface.js rename to typo3/sysext/backend/Resources/Public/JavaScript/modal-interface.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/modal.js b/typo3/sysext/backend/Resources/Public/JavaScript/modal.js new file mode 100644 index 0000000000000000000000000000000000000000..b47364428329d0f470339c8db2e983ffe70e0bb8 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/modal.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import{html,render}from"lit";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import SecurityUtility from"@typo3/core/security-utility.js";import Icons from"@typo3/backend/icons.js";import Severity from"@typo3/backend/severity.js";var Identifiers,Sizes,Styles,Types;!function(t){t.modal=".t3js-modal",t.content=".t3js-modal-content",t.title=".t3js-modal-title",t.close=".t3js-modal-close",t.body=".t3js-modal-body",t.footer=".t3js-modal-footer",t.iframe=".t3js-modal-iframe",t.iconPlaceholder=".t3js-modal-icon-placeholder"}(Identifiers||(Identifiers={})),function(t){t.small="small",t.default="default",t.medium="medium",t.large="large",t.full="full"}(Sizes||(Sizes={})),function(t){t.default="default",t.light="light",t.dark="dark"}(Styles||(Styles={})),function(t){t.default="default",t.ajax="ajax",t.iframe="iframe"}(Types||(Types={}));class Modal{constructor(t){this.sizes=Sizes,this.styles=Styles,this.types=Types,this.currentModal=null,this.instances=[],this.$template=$('\n <div class="t3js-modal modal fade">\n <div class="modal-dialog">\n <div class="t3js-modal-content modal-content">\n <div class="modal-header">\n <h4 class="t3js-modal-title modal-title"></h4>\n <button class="t3js-modal-close close">\n <span aria-hidden="true">\n <span class="t3js-modal-icon-placeholder" data-icon="actions-close"></span>\n </span>\n <span class="sr-only"></span>\n </button>\n </div>\n <div class="t3js-modal-body modal-body"></div>\n <div class="t3js-modal-footer modal-footer"></div>\n </div>\n </div>\n </div>'),this.defaultConfiguration={type:Types.default,title:"Information",content:"No content provided, please check your <code>Modal</code> configuration.",severity:SeverityEnum.notice,buttons:[],style:Styles.default,size:Sizes.default,additionalCssClasses:[],callback:$.noop(),ajaxCallback:$.noop(),ajaxTarget:null},this.securityUtility=t,$(document).on("modal-dismiss",this.dismiss),this.initializeMarkupTrigger(document)}static resolveEventNameTargetElement(t){const e=t.target,a=t.currentTarget;return e.dataset&&e.dataset.eventName?e:a.dataset&&a.dataset.eventName?a:null}static createModalResponseEventFromElement(t,e){return t&&t.dataset.eventName?new CustomEvent(t.dataset.eventName,{bubbles:!0,detail:{result:e,payload:t.dataset.eventPayload||null}}):null}dismiss(){this.currentModal&&this.currentModal.modal("hide")}confirm(t,e,a=SeverityEnum.warning,n=[],s){return 0===n.length&&n.push({text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(a),name:"ok"}),this.advanced({title:t,content:e,severity:a,buttons:n,additionalCssClasses:s,callback:t=>{t.on("button.clicked",t=>{"cancel"===t.target.getAttribute("name")?$(t.currentTarget).trigger("confirm.button.cancel"):"ok"===t.target.getAttribute("name")&&$(t.currentTarget).trigger("confirm.button.ok")})}})}loadUrl(t,e=SeverityEnum.info,a,n,s,i){return this.advanced({type:Types.ajax,title:t,severity:e,buttons:a,ajaxCallback:s,ajaxTarget:i,content:n})}show(t,e,a=SeverityEnum.info,n,s){return this.advanced({type:Types.default,title:t,content:e,severity:a,buttons:n,additionalCssClasses:s})}advanced(t){return t.type="string"==typeof t.type&&t.type in Types?t.type:this.defaultConfiguration.type,t.title="string"==typeof t.title?t.title:this.defaultConfiguration.title,t.content="string"==typeof t.content||"object"==typeof t.content?t.content:this.defaultConfiguration.content,t.severity=void 0!==t.severity?t.severity:this.defaultConfiguration.severity,t.buttons=t.buttons||this.defaultConfiguration.buttons,t.size="string"==typeof t.size&&t.size in Sizes?t.size:this.defaultConfiguration.size,t.style="string"==typeof t.style&&t.style in Styles?t.style:this.defaultConfiguration.style,t.additionalCssClasses=t.additionalCssClasses||this.defaultConfiguration.additionalCssClasses,t.callback="function"==typeof t.callback?t.callback:this.defaultConfiguration.callback,t.ajaxCallback="function"==typeof t.ajaxCallback?t.ajaxCallback:this.defaultConfiguration.ajaxCallback,t.ajaxTarget="string"==typeof t.ajaxTarget?t.ajaxTarget:this.defaultConfiguration.ajaxTarget,this.generate(t)}setButtons(t){const e=this.currentModal.find(Identifiers.footer);if(t.length>0){e.empty();for(let a=0;a<t.length;a++){const n=t[a],s=$("<button />",{class:"btn"});s.html("<span>"+this.securityUtility.encodeHtml(n.text,!1)+"</span>"),n.active&&s.addClass("t3js-active"),""!==n.btnClass&&s.addClass(n.btnClass),""!==n.name&&s.attr("name",n.name),n.action?s.on("click",()=>{e.find("button").not(s).addClass("disabled"),n.action.execute(s.get(0)).then(()=>{this.currentModal.modal("hide")})}):n.trigger&&s.on("click",n.trigger),n.dataAttributes&&Object.keys(n.dataAttributes).length>0&&Object.keys(n.dataAttributes).map(t=>{s.attr("data-"+t,n.dataAttributes[t])}),n.icon&&s.prepend('<span class="t3js-modal-icon-placeholder" data-icon="'+n.icon+'"></span>'),e.append(s)}e.show(),e.find("button").on("click",t=>{$(t.currentTarget).trigger("button.clicked")})}else e.hide();return this.currentModal}initializeMarkupTrigger(t){$(t).on("click",".t3js-modal-trigger",t=>{t.preventDefault();const e=$(t.currentTarget),a=e.data("bs-content")||"Are you sure?",n=void 0!==SeverityEnum[e.data("severity")]?SeverityEnum[e.data("severity")]:SeverityEnum.info;let s=e.data("url")||null;if(null!==s){const t=s.includes("?")?"&":"?";s=s+t+$.param({data:e.data()})}this.advanced({type:null!==s?Types.ajax:Types.default,title:e.data("title")||"Alert",content:null!==s?s:a,severity:n,buttons:[{text:e.data("button-close-text")||TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:()=>{this.currentModal.trigger("modal-dismiss");const e=Modal.resolveEventNameTargetElement(t),a=Modal.createModalResponseEventFromElement(e,!1);null!==a&&e.dispatchEvent(a)}},{text:e.data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(n),trigger:()=>{this.currentModal.trigger("modal-dismiss");const a=Modal.resolveEventNameTargetElement(t),n=Modal.createModalResponseEventFromElement(a,!0);null!==n&&a.dispatchEvent(n);let s=e.attr("data-uri")||e.data("href")||e.attr("href");s&&"#"!==s&&(t.target.ownerDocument.location.href=s),"submit"===t.currentTarget.getAttribute("type")&&(t.currentTarget.closest("form")?.submit(),"BUTTON"===t.currentTarget.tagName&&t.currentTarget.hasAttribute("form")&&t.target.ownerDocument.querySelector("form#"+t.currentTarget.getAttribute("form"))?.submit()),t.currentTarget.hasAttribute("data-target-form")&&t.target.ownerDocument.querySelector("form#"+t.currentTarget.getAttribute("data-target-form"))?.submit()}}]})})}generate(t){const e=this.$template.clone();if(t.additionalCssClasses.length>0)for(let a of t.additionalCssClasses)e.addClass(a);if(e.addClass("modal-type-"+t.type),e.addClass("modal-severity-"+Severity.getCssClass(t.severity)),e.addClass("modal-style-"+t.style),e.addClass("modal-size-"+t.size),e.attr("tabindex","-1"),e.find(Identifiers.title).text(t.title),e.find(Identifiers.close).on("click",()=>{e.modal("hide")}),"ajax"===t.type){const a=t.ajaxTarget?t.ajaxTarget:Identifiers.body,n=e.find(a);Icons.getIcon("spinner-circle",Icons.sizes.default,null,null,Icons.markupIdentifiers.inline).then(e=>{n.html('<div class="modal-loading">'+e+"</div>"),new AjaxRequest(t.content).get().finally(async()=>{this.currentModal.parent().length||this.currentModal.appendTo("body")}).then(async e=>{const n=await e.raw().text();this.currentModal.find(a).empty().append(n),t.ajaxCallback&&t.ajaxCallback(),this.currentModal.trigger("modal-loaded")}).catch(async e=>{const n=await e.raw().text(),s=this.currentModal.find(a).empty();n?s.append(n):render(html`<p><strong>Oops, received a ${e.response.status} response from </strong> <span class="text-break">${t.content}</span>.</p>`,s[0])})})}else"iframe"===t.type?(e.find(Identifiers.body).append($("<iframe />",{src:t.content,name:"modal_frame",class:"modal-iframe t3js-modal-iframe"})),e.find(Identifiers.iframe).on("load",()=>{e.find(Identifiers.title).text(e.find(Identifiers.iframe).get(0).contentDocument.title)})):("string"==typeof t.content&&(t.content=$("<p />").html(this.securityUtility.encodeHtml(t.content))),e.find(Identifiers.body).append(t.content));return e.on("shown.bs.modal",t=>{const e=$(t.currentTarget),a=e.prev(".modal-backdrop"),n=1e3+10*this.instances.length,s=n-10;e.css("z-index",n),a.css("z-index",s),e.find(Identifiers.footer).find(".t3js-active").first().focus(),e.find(Identifiers.iconPlaceholder).each((t,e)=>{Icons.getIcon($(e).data("icon"),Icons.sizes.small,null,null,Icons.markupIdentifiers.inline).then(t=>{this.currentModal.find(Identifiers.iconPlaceholder+"[data-icon="+$(t).data("identifier")+"]").replaceWith(t)})})}),e.on("hide.bs.modal",()=>{if(this.instances.length>0){const t=this.instances.length-1;this.instances.splice(t,1),this.currentModal=this.instances[t-1]}}),e.on("hidden.bs.modal",t=>{e.trigger("modal-destroyed"),$(t.currentTarget).remove(),this.instances.length>0&&$("body").addClass("modal-open")}),e.on("show.bs.modal",e=>{this.currentModal=$(e.currentTarget),this.setButtons(t.buttons),this.instances.push(this.currentModal)}),e.on("modal-dismiss",t=>{$(t.currentTarget).modal("hide")}),t.callback&&t.callback(e),e.modal("show"),e}}let modalObject=null;try{parent&&parent.window.TYPO3&&parent.window.TYPO3.Modal?(parent.window.TYPO3.Modal.initializeMarkupTrigger(document),modalObject=parent.window.TYPO3.Modal):top&&top.TYPO3.Modal&&(top.TYPO3.Modal.initializeMarkupTrigger(document),modalObject=top.TYPO3.Modal)}catch{}modalObject||(modalObject=new Modal(new SecurityUtility),TYPO3.Modal=modalObject);export default modalObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/module-menu.js b/typo3/sysext/backend/Resources/Public/JavaScript/module-menu.js new file mode 100644 index 0000000000000000000000000000000000000000..15d3d1c6c58373563a14a45a02c07524ce24a4cc --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/module-menu.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{ScaffoldIdentifierEnum}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import{getRecordFromName}from"@typo3/backend/module.js";import $ from"jquery";import PersistentStorage from"@typo3/backend/storage/persistent.js";import Viewport from"@typo3/backend/viewport.js";import ClientRequest from"@typo3/backend/event/client-request.js";import TriggerRequest from"@typo3/backend/event/trigger-request.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import RegularEvent from"@typo3/core/event/regular-event.js";import{ModuleStateStorage}from"@typo3/backend/storage/module-state-storage.js";class ModuleMenu{constructor(){this.loadedModule=null,this.spaceKeyPressedOnCollapsible=!1,$(()=>this.initialize())}static getCollapsedMainMenuItems(){return PersistentStorage.isset("modulemenu")?JSON.parse(PersistentStorage.get("modulemenu")):{}}static addCollapsedMainMenuItem(e){const t=ModuleMenu.getCollapsedMainMenuItems();t[e]=!0,PersistentStorage.set("modulemenu",JSON.stringify(t))}static removeCollapseMainMenuItem(e){const t=this.getCollapsedMainMenuItems();delete t[e],PersistentStorage.set("modulemenu",JSON.stringify(t))}static includeId(e,t){if(!e.navigationComponentId)return t;let n="";n="@typo3/backend/page-tree/page-tree-element"===e.navigationComponentId?"web":e.name.split("_")[0];const o=ModuleStateStorage.current(n);return o.selection&&(t="id="+o.selection+"&"+t),t}static toggleMenu(e){const t=$(ScaffoldIdentifierEnum.scaffold),n="scaffold-modulemenu-expanded";void 0===e&&(e=t.hasClass(n)),t.toggleClass(n,!e),e||$(".scaffold").removeClass("scaffold-search-expanded").removeClass("scaffold-toolbar-expanded"),PersistentStorage.set("BackendComponents.States.typo3-module-menu",{collapsed:e})}static toggleModuleGroup(e){const t=e.closest(".modulemenu-group"),n=t.querySelector(".modulemenu-group-container"),o="true"===e.attributes.getNamedItem("aria-expanded").value;o?ModuleMenu.addCollapsedMainMenuItem(e.id):ModuleMenu.removeCollapseMainMenuItem(e.id),t.classList.toggle("modulemenu-group-collapsed",o),t.classList.toggle("modulemenu-group-expanded",!o),e.attributes.getNamedItem("aria-expanded").value=(!o).toString(),$(n).stop().slideToggle()}static highlightModuleMenuItem(e){$(".modulemenu-action.modulemenu-action-active").removeClass("modulemenu-action-active").removeAttr("aria-current"),$("#"+e).addClass("modulemenu-action-active").attr("aria-current","location")}static getPreviousItem(e){let t=e.parentElement.previousElementSibling;return null===t?ModuleMenu.getLastItem(e):t.firstElementChild}static getNextItem(e){let t=e.parentElement.nextElementSibling;return null===t?ModuleMenu.getFirstItem(e):t.firstElementChild}static getFirstItem(e){return e.parentElement.parentElement.firstElementChild.firstElementChild}static getLastItem(e){return e.parentElement.parentElement.lastElementChild.firstElementChild}static getParentItem(e){return e.parentElement.parentElement.parentElement.firstElementChild}static getFirstChildItem(e){return e.nextElementSibling.firstElementChild.firstElementChild}static getLastChildItem(e){return e.nextElementSibling.lastElementChild.firstElementChild}refreshMenu(){new AjaxRequest(TYPO3.settings.ajaxUrls.modulemenu).get().then(async e=>{const t=await e.resolve();document.getElementById("modulemenu").outerHTML=t.menu,this.initializeModuleMenuEvents(),this.loadedModule&&ModuleMenu.highlightModuleMenuItem(this.loadedModule)})}getCurrentModule(){return this.loadedModule}reloadFrames(){Viewport.ContentContainer.refresh()}showModule(e,t,n=null){t=t||"";const o=getRecordFromName(e);return this.loadModuleComponents(o,t,new ClientRequest("typo3.showModule",n))}initialize(){if(null===document.querySelector(".t3js-modulemenu"))return;let e=$.Deferred();e.resolve(),e.then(()=>{this.initializeModuleMenuEvents(),Viewport.Topbar.Toolbar.registerEvent(()=>{document.querySelector(".t3js-scaffold-toolbar")&&this.initializeTopBarEvents()})})}keyboardNavigation(e,t,n=!1){const o=t.parentElement.attributes.getNamedItem("data-level").value;let l=null;switch(n&&(this.spaceKeyPressedOnCollapsible=!1),e.code){case"ArrowUp":l=ModuleMenu.getPreviousItem(t);break;case"ArrowDown":l=ModuleMenu.getNextItem(t);break;case"ArrowLeft":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")?("false"===t.attributes.getNamedItem("aria-expanded").value&&ModuleMenu.toggleModuleGroup(t),l=ModuleMenu.getLastChildItem(t)):"2"===o&&(l=ModuleMenu.getPreviousItem(ModuleMenu.getParentItem(t)));break;case"ArrowRight":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")?("false"===t.attributes.getNamedItem("aria-expanded").value&&ModuleMenu.toggleModuleGroup(t),l=ModuleMenu.getFirstChildItem(t)):"2"===o&&(l=ModuleMenu.getNextItem(ModuleMenu.getParentItem(t)));break;case"Home":l=e.ctrlKey&&"2"===o?ModuleMenu.getFirstItem(ModuleMenu.getParentItem(t)):ModuleMenu.getFirstItem(t);break;case"End":l=e.ctrlKey&&"2"===o?ModuleMenu.getLastItem(ModuleMenu.getParentItem(t)):ModuleMenu.getLastItem(t);break;case"Space":case"Enter":"1"===o&&t.classList.contains("t3js-modulemenu-collapsible")&&("Enter"===e.code&&e.preventDefault(),ModuleMenu.toggleModuleGroup(t),"true"===t.attributes.getNamedItem("aria-expanded").value&&(l=ModuleMenu.getFirstChildItem(t),"Space"===e.code&&(this.spaceKeyPressedOnCollapsible=!0)));break;case"Esc":case"Escape":"2"===o&&(l=ModuleMenu.getParentItem(t),ModuleMenu.toggleModuleGroup(l));break;default:l=null}null!==l&&(e.defaultPrevented||e.preventDefault(),l.focus())}initializeModuleMenuEvents(){const e=document.querySelector(".t3js-modulemenu"),t=function(e){"Space"===e.code&&this.spaceKeyPressedOnCollapsible&&(e.preventDefault(),this.spaceKeyPressedOnCollapsible=!1)}.bind(this);new RegularEvent("keydown",this.keyboardNavigation).delegateTo(e,".t3js-modulemenu-action"),e.querySelectorAll('[data-level="2"] a.t3js-modulemenu-action[href]').forEach(e=>{e.addEventListener("keyup",t)}),new RegularEvent("keyup",(e,t)=>{"Space"===e.code&&e.preventDefault()}).delegateTo(e,".t3js-modulemenu-collapsible"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.showModule(t.id,"",e)}).delegateTo(e,"a.t3js-modulemenu-action[href]"),new RegularEvent("click",(e,t)=>{e.preventDefault(),ModuleMenu.toggleModuleGroup(t)}).delegateTo(e,".t3js-modulemenu-collapsible")}initializeTopBarEvents(){const e=document.querySelector(".t3js-scaffold-toolbar");new RegularEvent("keydown",(e,t)=>{this.keyboardNavigation(e,t)}).delegateTo(e,".t3js-modulemenu-action"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.showModule(t.id,"",e)}).delegateTo(e,"a.t3js-modulemenu-action[href]"),new RegularEvent("click",e=>{e.preventDefault(),ModuleMenu.toggleMenu()}).bindTo(document.querySelector(".t3js-topbar-button-modulemenu")),new RegularEvent("click",e=>{e.preventDefault(),ModuleMenu.toggleMenu(!0)}).bindTo(document.querySelector(".t3js-scaffold-content-overlay"));const t=e=>{const t=e.detail.module;if(!t||this.loadedModule===t)return;const n=getRecordFromName(t);n.link&&(ModuleMenu.highlightModuleMenuItem(t),$("#"+t).focus(),this.loadedModule=t,n.navigationComponentId?Viewport.NavigationContainer.showComponent(n.navigationComponentId):Viewport.NavigationContainer.hide(!1))};document.addEventListener("typo3-module-load",t),document.addEventListener("typo3-module-loaded",t)}loadModuleComponents(e,t,n){const o=e.name,l=Viewport.ContentContainer.beforeSetUrl(n);return l.then(()=>{e.navigationComponentId?Viewport.NavigationContainer.showComponent(e.navigationComponentId):Viewport.NavigationContainer.hide(!0),ModuleMenu.highlightModuleMenuItem(o),this.loadedModule=o,t=ModuleMenu.includeId(e,t),this.openInContentContainer(o,e.link,t,new TriggerRequest("typo3.loadModuleComponents",n))}),l}openInContentContainer(e,t,n,o){const l=t+(n?(t.includes("?")?"&":"?")+n:"");return Viewport.ContentContainer.setUrl(l,new TriggerRequest("typo3.openInContentFrame",o),e)}}top.TYPO3.ModuleMenu||(top.TYPO3.ModuleMenu={App:new ModuleMenu});const moduleMenuApp=top.TYPO3.ModuleMenu;export default moduleMenuApp; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Module.js b/typo3/sysext/backend/Resources/Public/JavaScript/module.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Module.js rename to typo3/sysext/backend/Resources/Public/JavaScript/module.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Module/Iframe.js b/typo3/sysext/backend/Resources/Public/JavaScript/module/iframe.js similarity index 91% rename from typo3/sysext/backend/Resources/Public/JavaScript/Module/Iframe.js rename to typo3/sysext/backend/Resources/Public/JavaScript/module/iframe.js index a47f76609f1a5e26822c537f05c56bde03bbd206..95d44b6f6d0a1ecf0b4af88c0167008ea4038b69 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Module/Iframe.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/module/iframe.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(e,t,o,r){var n,l=arguments.length,i=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(i=(l<3?n(i):l>3?n(t,o,i):n(t,o))||i);return l>3&&i&&Object.defineProperty(t,o,i),i};import{html,LitElement}from"lit";import{customElement,property,query}from"lit/decorators.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";export const componentName="typo3-iframe-module";let IframeModuleElement=class extends LitElement{constructor(){super(...arguments),this.endpoint=""}createRenderRoot(){return this}render(){return this.endpoint?html` +var __decorate=function(e,t,o,r){var n,l=arguments.length,i=l<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,o,r);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(i=(l<3?n(i):l>3?n(t,o,i):n(t,o))||i);return l>3&&i&&Object.defineProperty(t,o,i),i};import{html,LitElement}from"lit";import{customElement,property,query}from"lit/decorators.js";import{lll}from"@typo3/core/lit-helper.js";export const componentName="typo3-iframe-module";let IframeModuleElement=class extends LitElement{constructor(){super(...arguments),this.endpoint=""}createRenderRoot(){return this}render(){return this.endpoint?html` <iframe src="${this.endpoint}" name="list_frame" diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/module/router.js b/typo3/sysext/backend/Resources/Public/JavaScript/module/router.js new file mode 100644 index 0000000000000000000000000000000000000000..c5ac9e053d11cac9b646fe740e81b447d94f7d49 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/module/router.js @@ -0,0 +1,25 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var __decorate=function(t,e,o,r){var i,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(a=(n<3?i(a):n>3?i(e,o,a):i(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};import{html,css,LitElement}from"lit";import{customElement,property,query}from"lit/decorators.js";import{getRecordFromName}from"@typo3/backend/module.js";const IFRAME_COMPONENT="@typo3/backend/module/iframe",alwaysUpdate=(t,e)=>!0;let ModuleRouter=class extends LitElement{constructor(){super(),this.module="",this.endpoint="",this.addEventListener("typo3-module-load",({target:t,detail:e})=>{const o=t.getAttribute("slot");this.pushState({slotName:o,detail:e})}),this.addEventListener("typo3-module-loaded",({detail:t})=>{this.updateBrowserState(t)}),this.addEventListener("typo3-iframe-load",({detail:t})=>{let e={slotName:IFRAME_COMPONENT,detail:t};if(e.detail.url.includes(this.stateTrackerUrl+"?state=")){const t=e.detail.url.split("?state=");e=JSON.parse(decodeURIComponent(t[1]||"{}"))}this.slotElement.getAttribute("name")!==e.slotName&&this.slotElement.setAttribute("name",e.slotName),this.markActive(e.slotName,this.slotElement.getAttribute("name")===IFRAME_COMPONENT?null:e.detail.url,!1),this.updateBrowserState(e.detail),this.parentElement.dispatchEvent(new CustomEvent("typo3-module-load",{bubbles:!0,composed:!0,detail:e.detail}))}),this.addEventListener("typo3-iframe-loaded",({detail:t})=>{this.updateBrowserState(t),this.parentElement.dispatchEvent(new CustomEvent("typo3-module-loaded",{bubbles:!0,composed:!0,detail:t}))})}render(){const t=getRecordFromName(this.module).component||IFRAME_COMPONENT;return html`<slot name="${t}"></slot>`}updated(){const t=getRecordFromName(this.module).component||IFRAME_COMPONENT;this.markActive(t,this.endpoint)}async markActive(t,e,o=!0){const r=await this.getModuleElement(t);e&&(o||r.getAttribute("endpoint")!==e)&&r.setAttribute("endpoint",e),r.hasAttribute("active")||r.setAttribute("active","");for(let t=r.previousElementSibling;null!==t;t=t.previousElementSibling)t.removeAttribute("active");for(let t=r.nextElementSibling;null!==t;t=t.nextElementSibling)t.removeAttribute("active")}async getModuleElement(t){let e=this.querySelector(`*[slot="${t}"]`);if(null!==e)return e;try{const o=await import(t+".js");e=document.createElement(o.componentName)}catch(e){throw console.error({msg:`Error importing ${t} as backend module`,err:e}),e}return e.setAttribute("slot",t),this.appendChild(e),e}async pushState(t){const e=this.stateTrackerUrl+"?state="+encodeURIComponent(JSON.stringify(t));(await this.getModuleElement(IFRAME_COMPONENT)).setAttribute("endpoint",e)}updateBrowserState(t){const e=new URL(t.url||"",window.location.origin),o=new URLSearchParams(e.search),r="title"in t?t.title:"";if(null!==r){const t=[this.sitename];""!==r&&t.unshift(r),this.sitenameFirst&&t.reverse(),document.title=t.join(" · ")}if(!o.has("token"))return;o.delete("token"),e.search=o.toString();const i=e.toString();window.history.replaceState(t,"",i)}};ModuleRouter.styles=css` + :host { + width: 100%; + min-height: 100%; + flex: 1 0 auto; + display: flex; + flex-direction: row; + } + ::slotted(*) { + min-height: 100%; + width: 100%; + } + `,__decorate([property({type:String,hasChanged:alwaysUpdate})],ModuleRouter.prototype,"module",void 0),__decorate([property({type:String,hasChanged:alwaysUpdate})],ModuleRouter.prototype,"endpoint",void 0),__decorate([property({type:String,attribute:"state-tracker"})],ModuleRouter.prototype,"stateTrackerUrl",void 0),__decorate([property({type:String,attribute:"sitename"})],ModuleRouter.prototype,"sitename",void 0),__decorate([property({type:Boolean,attribute:"sitename-first"})],ModuleRouter.prototype,"sitenameFirst",void 0),__decorate([query("slot",!0)],ModuleRouter.prototype,"slotElement",void 0),ModuleRouter=__decorate([customElement("typo3-backend-module-router")],ModuleRouter);export{ModuleRouter}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/MultiRecordSelectionAction.js b/typo3/sysext/backend/Resources/Public/JavaScript/multi-record-selection-action.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/MultiRecordSelectionAction.js rename to typo3/sysext/backend/Resources/Public/JavaScript/multi-record-selection-action.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/multi-record-selection.js b/typo3/sysext/backend/Resources/Public/JavaScript/multi-record-selection.js new file mode 100644 index 0000000000000000000000000000000000000000..a6da74ebeba3bf1ade508311d4f7b0ccc281d781 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/multi-record-selection.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Notification from"@typo3/backend/notification.js";import DocumentService from"@typo3/core/document-service.js";import RegularEvent from"@typo3/core/event/regular-event.js";var Selectors,Buttons,CheckboxActions,CheckboxState;!function(e){e.actionsSelector=".t3js-multi-record-selection-actions",e.checkboxSelector=".t3js-multi-record-selection-check",e.checkboxActionsSelector=".t3js-multi-record-selection-check-actions",e.checkboxActionsToggleSelector=".t3js-multi-record-selection-check-actions-toggle",e.rowSelectionSelector="[data-multi-record-selection-row-selection] tr"}(Selectors||(Selectors={})),function(e){e.actionButton="button[data-multi-record-selection-action]",e.checkboxActionButton="button[data-multi-record-selection-check-action]"}(Buttons||(Buttons={})),function(e){e.checkAll="check-all",e.checkNone="check-none",e.toggle="toggle"}(CheckboxActions||(CheckboxActions={})),function(e){e.any="",e.checked=":checked",e.unchecked=":not(:checked)"}(CheckboxState||(CheckboxState={}));class MultiRecordSelection{constructor(){this.lastChecked=null,DocumentService.ready().then(()=>{MultiRecordSelection.restoreTemporaryState(),this.registerActions(),this.registerActionsEventHandlers(),this.registerCheckboxActions(),this.registerCheckboxKeyboardActions(),this.registerCheckboxTableRowSelectionAction(),this.registerToggleCheckboxActions(),this.registerDispatchCheckboxStateChangedEvent(),this.registerCheckboxStateChangedEventHandler()})}static getCheckboxes(e=CheckboxState.any,t=""){return document.querySelectorAll(MultiRecordSelection.getCombinedSelector(Selectors.checkboxSelector+e,t))}static getCombinedSelector(e,t){return""!==t?['[data-multi-record-selection-identifier="'+t+'"]',e].join(" "):e}static getIdentifier(e){return e.closest("[data-multi-record-selection-identifier]")?.dataset.multiRecordSelectionIdentifier||""}static changeCheckboxState(e,t){e.checked===t||e.dataset.manuallyChanged||(e.checked=t,e.dispatchEvent(new CustomEvent("multiRecordSelection:checkbox:state:changed",{detail:{identifier:MultiRecordSelection.getIdentifier(e)},bubbles:!0,cancelable:!1})))}static restoreTemporaryState(){const e=MultiRecordSelection.getCheckboxes(CheckboxState.checked);if(!e.length)return;let t=!1,c=[];e.forEach(e=>{e.closest("tr").classList.add("success");const o=MultiRecordSelection.getIdentifier(e);""===o||c.includes(o)||(c.push(o),t=!0,MultiRecordSelection.toggleActionsState(o))}),t||MultiRecordSelection.toggleActionsState()}static toggleActionsState(e=""){const t=document.querySelectorAll(MultiRecordSelection.getCombinedSelector(Selectors.actionsSelector,e));if(!t.length)return;if(!MultiRecordSelection.getCheckboxes(CheckboxState.checked,e).length)return void t.forEach(e=>MultiRecordSelection.changeActionContainerVisibility(e,!1));t.forEach(e=>MultiRecordSelection.changeActionContainerVisibility(e));const c=document.querySelectorAll([MultiRecordSelection.getCombinedSelector(Selectors.actionsSelector,e),Buttons.actionButton].join(" "));c.length&&c.forEach(t=>{if(!t.dataset.multiRecordSelectionActionConfig)return;const c=JSON.parse(t.dataset.multiRecordSelectionActionConfig);if(!c.idField)return;t.classList.add("disabled");const o=MultiRecordSelection.getCheckboxes(CheckboxState.checked,e);for(let e=0;e<o.length;e++)if(o[e].closest("tr").dataset[c.idField]){t.classList.remove("disabled");break}})}static changeActionContainerVisibility(e,t=!0){const c=e.closest(".multi-record-selection-panel")?.children;if(t){if(c)for(let e=0;e<c.length;e++)c[e].classList.add("hidden");e.classList.remove("hidden")}else{if(c)for(let e=0;e<c.length;e++)c[e].classList.remove("hidden");e.classList.add("hidden")}}static unsetManuallyChangedAttribute(e){MultiRecordSelection.getCheckboxes(CheckboxState.any,e).forEach(e=>{e.removeAttribute("data-manually-changed")})}registerActions(){new RegularEvent("click",(e,t)=>{t.dataset.multiRecordSelectionAction;const c=MultiRecordSelection.getIdentifier(t),o=JSON.parse(t.dataset.multiRecordSelectionActionConfig||"{}"),i=MultiRecordSelection.getCheckboxes(CheckboxState.checked,c);i.length&&t.dispatchEvent(new CustomEvent("multiRecordSelection:action:"+t.dataset.multiRecordSelectionAction,{detail:{identifier:c,checkboxes:i,configuration:o},bubbles:!0,cancelable:!1}))}).delegateTo(document,[Selectors.actionsSelector,Buttons.actionButton].join(" "))}registerActionsEventHandlers(){new RegularEvent("multiRecordSelection:actions:show",e=>{const t=e.detail?.identifier||"",c=document.querySelectorAll(MultiRecordSelection.getCombinedSelector(Selectors.actionsSelector,t));c.length&&c.forEach(e=>MultiRecordSelection.changeActionContainerVisibility(e))}).bindTo(document),new RegularEvent("multiRecordSelection:actions:hide",e=>{const t=e.detail?.identifier||"",c=document.querySelectorAll(MultiRecordSelection.getCombinedSelector(Selectors.actionsSelector,t));c.length&&c.forEach(e=>MultiRecordSelection.changeActionContainerVisibility(e,!1))}).bindTo(document)}registerCheckboxActions(){new RegularEvent("click",(e,t)=>{if(e.preventDefault(),!t.dataset.multiRecordSelectionCheckAction)return;const c=MultiRecordSelection.getIdentifier(t),o=MultiRecordSelection.getCheckboxes(CheckboxState.any,c);if(o.length){switch(MultiRecordSelection.unsetManuallyChangedAttribute(c),t.dataset.multiRecordSelectionCheckAction){case CheckboxActions.checkAll:o.forEach(e=>{MultiRecordSelection.changeCheckboxState(e,!0)});break;case CheckboxActions.checkNone:o.forEach(e=>{MultiRecordSelection.changeCheckboxState(e,!1)});break;case CheckboxActions.toggle:o.forEach(e=>{MultiRecordSelection.changeCheckboxState(e,!e.checked)});break;default:Notification.warning("Unknown checkbox action")}MultiRecordSelection.unsetManuallyChangedAttribute(c)}}).delegateTo(document,[Selectors.checkboxActionsSelector,Buttons.checkboxActionButton].join(" "))}registerCheckboxKeyboardActions(){new RegularEvent("click",(e,t)=>this.handleCheckboxKeyboardActions(e,t)).delegateTo(document,Selectors.checkboxSelector)}registerCheckboxTableRowSelectionAction(){new RegularEvent("click",(e,t)=>{const c=e.target.tagName;if("TH"!==c&&"TD"!==c)return;const o=t.querySelector(Selectors.checkboxSelector);null!==o&&(MultiRecordSelection.changeCheckboxState(o,!o.checked),this.handleCheckboxKeyboardActions(e,o,!1))}).delegateTo(document,Selectors.rowSelectionSelector),new RegularEvent("mousedown",e=>(e.shiftKey||e.altKey||e.ctrlKey)&&e.preventDefault()).delegateTo(document,Selectors.rowSelectionSelector)}registerDispatchCheckboxStateChangedEvent(){new RegularEvent("change",(e,t)=>{t.dispatchEvent(new CustomEvent("multiRecordSelection:checkbox:state:changed",{detail:{identifier:MultiRecordSelection.getIdentifier(t)},bubbles:!0,cancelable:!1}))}).delegateTo(document,Selectors.checkboxSelector)}registerCheckboxStateChangedEventHandler(){new RegularEvent("multiRecordSelection:checkbox:state:changed",e=>{const t=e.target,c=e.detail?.identifier||"";t.checked?t.closest("tr").classList.add("success"):t.closest("tr").classList.remove("success"),MultiRecordSelection.toggleActionsState(c)}).bindTo(document)}registerToggleCheckboxActions(){new RegularEvent("click",(e,t)=>{const c=MultiRecordSelection.getIdentifier(t),o=document.querySelector([MultiRecordSelection.getCombinedSelector(Selectors.checkboxActionsSelector,c),'button[data-multi-record-selection-check-action="'+CheckboxActions.checkAll+'"]'].join(" "));null!==o&&o.classList.toggle("disabled",!MultiRecordSelection.getCheckboxes(CheckboxState.unchecked,c).length);const i=document.querySelector([MultiRecordSelection.getCombinedSelector(Selectors.checkboxActionsSelector,c),'button[data-multi-record-selection-check-action="'+CheckboxActions.checkNone+'"]'].join(" "));null!==i&&i.classList.toggle("disabled",!MultiRecordSelection.getCheckboxes(CheckboxState.checked,c).length)}).delegateTo(document,Selectors.checkboxActionsToggleSelector)}handleCheckboxKeyboardActions(e,t,c=!0){const o=MultiRecordSelection.getIdentifier(t);if(this.lastChecked&&document.body.contains(this.lastChecked)&&MultiRecordSelection.getIdentifier(this.lastChecked)===o&&(e.shiftKey||e.altKey||e.ctrlKey)){if(c&&MultiRecordSelection.unsetManuallyChangedAttribute(o),e.shiftKey){const e=Array.from(MultiRecordSelection.getCheckboxes(CheckboxState.any,o)),c=e.indexOf(t),i=e.indexOf(this.lastChecked);e.slice(Math.min(c,i),Math.max(c,i)+1).forEach(e=>{e!==t&&MultiRecordSelection.changeCheckboxState(e,t.checked)})}this.lastChecked=t,(e.altKey||e.ctrlKey)&&MultiRecordSelection.getCheckboxes(CheckboxState.any,o).forEach(e=>{e!==t&&MultiRecordSelection.changeCheckboxState(e,!e.checked)}),MultiRecordSelection.unsetManuallyChangedAttribute(o)}else this.lastChecked=t}}export default new MultiRecordSelection; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/multi-step-wizard.js b/typo3/sysext/backend/Resources/Public/JavaScript/multi-step-wizard.js new file mode 100644 index 0000000000000000000000000000000000000000..7f45e1967b25130c246b9ab9a0a6e85cb88c4b82 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/multi-step-wizard.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{SeverityEnum}from"@typo3/backend/enum/severity.js";import $ from"jquery";import Modal from"@typo3/backend/modal.js";import Severity from"@typo3/backend/severity.js";import Icons from"@typo3/backend/icons.js";class MultiStepWizard{constructor(){this.setup={slides:[],settings:{},forceSelection:!0,$carousel:null},this.originalSetup=$.extend(!0,{},this.setup)}set(e,t){return this.setup.settings[e]=t,this}addSlide(e,t,s="",i=SeverityEnum.info,r,a){const l={identifier:e,title:t,content:s,severity:i,progressBarTitle:r,callback:a};return this.setup.slides.push(l),this}addFinalProcessingSlide(e){return e||(e=()=>{this.dismiss()}),Icons.getIcon("spinner-circle",Icons.sizes.default,null,null).then(t=>{let s=$("<div />",{class:"text-center"}).append(t);this.addSlide("final-processing-slide",top.TYPO3.lang["wizard.processing.title"],s[0].outerHTML,Severity.info,null,e)})}show(){let e=this.generateSlides(),t=this.setup.slides[0];Modal.confirm(t.title,e,t.severity,[{text:top.TYPO3.lang["wizard.button.cancel"],active:!0,btnClass:"btn-default pull-left",name:"cancel",trigger:()=>{this.getComponent().trigger("wizard-dismiss")}},{text:top.TYPO3.lang["wizard.button.prev"],btnClass:"btn-"+Severity.getCssClass(t.severity),name:"prev"},{text:top.TYPO3.lang["wizard.button.next"],btnClass:"btn-"+Severity.getCssClass(t.severity),name:"next"}],["modal-multi-step-wizard"]),this.addButtonContainer(),this.addProgressBar(),this.initializeEvents(),this.getComponent().on("wizard-visible",()=>{this.runSlideCallback(t,this.setup.$carousel.find(".carousel-item").first())}).on("wizard-dismissed",()=>{this.setup=$.extend(!0,{},this.originalSetup)})}getComponent(){return null===this.setup.$carousel&&this.generateSlides(),this.setup.$carousel}dismiss(){Modal.dismiss()}lockNextStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="next"]');return e.prop("disabled",!0),e}unlockNextStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="next"]');return e.prop("disabled",!1),e}lockPrevStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="prev"]');return e.prop("disabled",!0),e}unlockPrevStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="prev"]');return e.prop("disabled",!1),e}triggerStepButton(e){let t=this.setup.$carousel.closest(".modal").find('button[name="'+e+'"]');return t.length>0&&!0!==t.prop("disabled")&&t.trigger("click"),t}blurCancelStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="cancel"]');return e.trigger("blur"),e}initializeEvents(){let e=this.setup.$carousel.closest(".modal");this.initializeSlideNextEvent(e),this.initializeSlidePrevEvent(e),this.setup.$carousel.on("slide.bs.carousel",t=>{"left"===t.direction?this.nextSlideChanges(e):this.prevSlideChanges(e)}).on("slid.bs.carousel",e=>{let t=this.setup.$carousel.data("currentIndex"),s=this.setup.slides[t];this.runSlideCallback(s,$(e.relatedTarget)),this.setup.forceSelection&&this.lockNextStep()});let t=this.getComponent();t.on("wizard-dismiss",this.dismiss),Modal.currentModal.on("hidden.bs.modal",()=>{t.trigger("wizard-dismissed")}).on("shown.bs.modal",()=>{t.trigger("wizard-visible")})}initializeSlideNextEvent(e){e.find(".modal-footer").find('button[name="next"]').off().on("click",()=>{this.setup.$carousel.carousel("next")})}initializeSlidePrevEvent(e){e.find(".modal-footer").find('button[name="prev"]').off().on("click",()=>{this.setup.$carousel.carousel("prev")})}nextSlideChanges(e){this.initializeSlideNextEvent(e);const t=e.find(".modal-title"),s=e.find(".modal-footer"),i=this.setup.$carousel.data("currentSlide")+1,r=this.setup.$carousel.data("currentIndex"),a=r+1;t.text(this.setup.slides[a].title),this.setup.$carousel.data("currentSlide",i),this.setup.$carousel.data("currentIndex",a);const l=s.find(".progress-bar");l.eq(r).width("0%"),l.eq(a).width(this.setup.$carousel.data("initialStep")*i+"%").removeClass("inactive"),this.updateCurrentSeverity(e,r,a)}prevSlideChanges(e){this.initializeSlidePrevEvent(e);const t=e.find(".modal-title"),s=e.find(".modal-footer"),i=s.find('button[name="next"]'),r=this.setup.$carousel.data("currentSlide")-1,a=this.setup.$carousel.data("currentIndex"),l=a-1;this.setup.$carousel.data("currentSlide",r),this.setup.$carousel.data("currentIndex",l),t.text(this.setup.slides[l].title),s.find(".progress-bar.last-step").width(this.setup.$carousel.data("initialStep")+"%").text(this.getProgressBarTitle(this.setup.$carousel.data("slideCount")-1)),i.text(top.TYPO3.lang["wizard.button.next"]);const n=s.find(".progress-bar");n.eq(a).width(this.setup.$carousel.data("initialStep")+"%").addClass("inactive"),n.eq(l).width(this.setup.$carousel.data("initialStep")*r+"%").removeClass("inactive"),this.updateCurrentSeverity(e,a,l)}updateCurrentSeverity(e,t,s){e.find(".modal-footer").find('button[name="next"]').removeClass("btn-"+Severity.getCssClass(this.setup.slides[t].severity)).addClass("btn-"+Severity.getCssClass(this.setup.slides[s].severity)),e.removeClass("modal-severity-"+Severity.getCssClass(this.setup.slides[t].severity)).addClass("modal-severity-"+Severity.getCssClass(this.setup.slides[s].severity))}getProgressBarTitle(e){let t;return t=null===this.setup.slides[e].progressBarTitle?0===e?top.TYPO3.lang["wizard.progressStep.start"]:e>=this.setup.$carousel.data("slideCount")-1?top.TYPO3.lang["wizard.progressStep.finish"]:top.TYPO3.lang["wizard.progressStep"]+String(e+1):this.setup.slides[e].progressBarTitle,t}runSlideCallback(e,t){"function"==typeof e.callback&&e.callback(t,this.setup.settings,e.identifier)}addProgressBar(){let e,t=this.setup.$carousel.find(".carousel-item").length,s=Math.max(1,t),i=this.setup.$carousel.closest(".modal").find(".modal-footer");if(e=Math.round(100/s),this.setup.$carousel.data("initialStep",e).data("slideCount",s).data("realSlideCount",t).data("currentIndex",0).data("currentSlide",1),s>1){i.prepend($("<div />",{class:"progress"}));for(let t=0;t<this.setup.slides.length;++t){let s;s=0===t?"progress-bar first-step":t===this.setup.$carousel.data("slideCount")-1?"progress-bar last-step inactive":"progress-bar step inactive",i.find(".progress").append($("<div />",{role:"progressbar",class:s,"aria-valuemin":0,"aria-valuenow":e,"aria-valuemax":100}).width(e+"%").text(this.getProgressBarTitle(t)))}}}addButtonContainer(){this.setup.$carousel.closest(".modal").find(".modal-footer .btn").wrapAll('<div class="modal-btn-group" />')}generateSlides(){if(null!==this.setup.$carousel)return this.setup.$carousel;let e='<div class="carousel slide" data-bs-ride="carousel" data-bs-interval="false"><div class="carousel-inner" role="listbox">';for(let t=0;t<this.setup.slides.length;++t){let s=this.setup.slides[t],i=s.content;"object"==typeof i&&(i=i.html()),e+='<div class="carousel-item" data-bs-slide="'+s.identifier+'" data-step="'+t+'">'+i+"</div>"}return e+="</div></div>",this.setup.$carousel=$(e),this.setup.$carousel.find(".carousel-item").first().addClass("active"),this.setup.$carousel}}let multistepWizardObject;try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.MultiStepWizard&&(multistepWizardObject=window.opener.TYPO3.MultiStepWizard),parent&&parent.window.TYPO3&&parent.window.TYPO3.MultiStepWizard&&(multistepWizardObject=parent.window.TYPO3.MultiStepWizard),top&&top.TYPO3&&top.TYPO3.MultiStepWizard&&(multistepWizardObject=top.TYPO3.MultiStepWizard)}catch(e){}multistepWizardObject||(multistepWizardObject=new MultiStepWizard,"undefined"!=typeof TYPO3&&(TYPO3.MultiStepWizard=multistepWizardObject));export default multistepWizardObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/new-content-element-wizard-button.js b/typo3/sysext/backend/Resources/Public/JavaScript/new-content-element-wizard-button.js new file mode 100644 index 0000000000000000000000000000000000000000..d53f1fa1b9d1aa0185138dcd411c729ec0b61c88 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/new-content-element-wizard-button.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var NewContentElementWizardButton_1,__decorate=function(e,t,n,o){var r,a=arguments.length,i=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(r=e[l])&&(i=(a<3?r(i):a>3?r(t,n,i):r(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i};import{customElement,property}from"lit/decorators.js";import{html,LitElement}from"lit";import Modal from"@typo3/backend/modal.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import{NewContentElementWizard}from"@typo3/backend/new-content-element-wizard.js";let NewContentElementWizardButton=NewContentElementWizardButton_1=class extends LitElement{constructor(){super(),this.addEventListener("click",e=>{e.preventDefault(),this.renderWizard()})}static handleModalContentLoaded(e){e&&e.querySelector(".t3-new-content-element-wizard-inner")&&new NewContentElementWizard(e)}render(){return html`<slot></slot>`}renderWizard(){this.url&&Modal.advanced({content:this.url,title:this.title,severity:SeverityEnum.notice,size:Modal.sizes.medium,type:Modal.types.ajax,ajaxCallback:()=>NewContentElementWizardButton_1.handleModalContentLoaded(Modal.currentModal[0])})}};__decorate([property({type:String})],NewContentElementWizardButton.prototype,"url",void 0),__decorate([property({type:String})],NewContentElementWizardButton.prototype,"title",void 0),NewContentElementWizardButton=NewContentElementWizardButton_1=__decorate([customElement("typo3-backend-new-content-element-wizard-button")],NewContentElementWizardButton);export{NewContentElementWizardButton}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/new-content-element-wizard.js b/typo3/sysext/backend/Resources/Public/JavaScript/new-content-element-wizard.js new file mode 100644 index 0000000000000000000000000000000000000000..5523edaf658584cbe6d895a38e662c4b2fffec0d --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/new-content-element-wizard.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import RegularEvent from"@typo3/core/event/regular-event.js";import DebounceEvent from"@typo3/core/event/debounce-event.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";var ClassNames,Selectors;!function(e){e.wizardWindow="t3-new-content-element-wizard-window"}(ClassNames||(ClassNames={})),function(e){e.modalBodySelector=".t3js-modal-body",e.modalTabsSelector=".t3js-tabs",e.elementsFilterSelector=".t3js-contentWizard-search",e.noResultSelector=".t3js-filter-noresult",e.wizardWindowSelector=".t3-new-content-element-wizard-window",e.wizardElementSelector=".t3js-media-new-content-element-wizard",e.wizardElementWithTargetSelector="button[data-target]",e.wizardElementWithPositionMapArugmentsSelector="button[data-position-map-arguments]"}(Selectors||(Selectors={}));export class NewContentElementWizard{constructor(e){this.modal=e,this.elementsFilter=this.modal.querySelector(Selectors.elementsFilterSelector),this.modal.querySelector(Selectors.modalBodySelector)?.classList.add(ClassNames.wizardWindow),this.registerEvents()}static getTabIdentifier(e){const t=e.querySelector("a"),[,o]=t.href.split("#");return o}static countVisibleContentElements(e){return e.querySelectorAll(Selectors.wizardElementSelector+":not(.hidden)").length}registerEvents(){new RegularEvent("shown.bs.modal",()=>{this.elementsFilter.focus()}).bindTo(this.modal),new RegularEvent("keydown",e=>{const t=e.target;"Escape"===e.code&&(e.stopImmediatePropagation(),t.value="")}).bindTo(this.elementsFilter),new DebounceEvent("keyup",e=>{this.filterElements(e.target)},150).bindTo(this.elementsFilter),new RegularEvent("search",e=>{this.filterElements(e.target)}).bindTo(this.elementsFilter),new RegularEvent("click",e=>{e.preventDefault(),e.stopPropagation()}).delegateTo(this.modal,[Selectors.modalTabsSelector,".disabled"].join(" ")),new RegularEvent("click",(e,t)=>{e.preventDefault();const o=t.dataset.target;o&&(Modal.dismiss(),top.list_frame.location.href=o)}).delegateTo(this.modal,[Selectors.wizardWindowSelector,Selectors.wizardElementWithTargetSelector].join(" ")),new RegularEvent("click",(e,t)=>{if(e.preventDefault(),!t.dataset.positionMapArguments)return;const o=JSON.parse(t.dataset.positionMapArguments);o.url&&new AjaxRequest(o.url).post({defVals:o.defVals,saveAndClose:o.saveAndClose?"1":"0"}).then(async e=>{this.modal.querySelector(Selectors.wizardWindowSelector).innerHTML=await e.raw().text()}).catch(()=>{Notification.error("Could not load module data")})}).delegateTo(this.modal,[Selectors.wizardWindowSelector,Selectors.wizardElementWithPositionMapArugmentsSelector].join(" "))}filterElements(e){const t=this.modal.querySelector(Selectors.modalTabsSelector),o=this.modal.querySelector(Selectors.noResultSelector);this.modal.querySelectorAll(Selectors.wizardElementSelector).forEach(t=>{const o=t.textContent.trim().replace(/\s+/g," ");t.classList.toggle("hidden",""!==e.value&&!RegExp(e.value,"i").test(o))});const a=NewContentElementWizard.countVisibleContentElements(this.modal);t.parentElement.classList.toggle("hidden",0===a),o.classList.toggle("hidden",a>0),this.switchTabIfNecessary(t)}switchTabIfNecessary(e){const t=e.querySelector(".active").parentElement,o=Array.from(t.parentElement.children);for(let e of o){const t=NewContentElementWizard.getTabIdentifier(e),o=e.querySelector("a");o.classList.toggle("disabled",!this.hasTabContent(t)),o.classList.contains("disabled")?o.setAttribute("tabindex","-1"):o.removeAttribute("tabindex")}if(!this.hasTabContent(NewContentElementWizard.getTabIdentifier(t)))for(let a of o){if(a===t)continue;const o=NewContentElementWizard.getTabIdentifier(a);if(this.hasTabContent(o)){this.switchTab(e.parentElement,o);break}}}hasTabContent(e){const t=this.modal.querySelector("#"+e);return NewContentElementWizard.countVisibleContentElements(t)>0}switchTab(e,t){const o=e.querySelector(`a[href="#${t}"]`),a=this.modal.querySelector("#"+t);e.querySelector("a.active").classList.remove("active"),e.querySelector(".tab-pane.active").classList.remove("active"),o.classList.add("active"),a.classList.add("active")}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/NewMultiplePages.js b/typo3/sysext/backend/Resources/Public/JavaScript/new-multiple-pages.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/NewMultiplePages.js rename to typo3/sysext/backend/Resources/Public/JavaScript/new-multiple-pages.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Notification.js b/typo3/sysext/backend/Resources/Public/JavaScript/notification.js similarity index 59% rename from typo3/sysext/backend/Resources/Public/JavaScript/Notification.js rename to typo3/sysext/backend/Resources/Public/JavaScript/notification.js index 60e0b0a5370a3e7b738401c4784179aef751e3de..f144cf68167201c45c8c2537be14edb76902c47d 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Notification.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/notification.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(t,e,i,o){var s,a=arguments.length,n=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var r=t.length-1;r>=0;r--)(s=t[r])&&(n=(a<3?s(n):a>3?s(e,i,n):s(e,i))||n);return a>3&&n&&Object.defineProperty(e,i,n),n};import{LitElement,html}from"lit";import{customElement,property,state}from"lit/decorators.js";import{classMap}from"lit/directives/class-map.js";import{ifDefined}from"lit/directives/if-defined.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import Severity from"TYPO3/CMS/Backend/Severity.js";class Notification{static notice(t,e,i,o){Notification.showMessage(t,e,SeverityEnum.notice,i,o)}static info(t,e,i,o){Notification.showMessage(t,e,SeverityEnum.info,i,o)}static success(t,e,i,o){Notification.showMessage(t,e,SeverityEnum.ok,i,o)}static warning(t,e,i,o){Notification.showMessage(t,e,SeverityEnum.warning,i,o)}static error(t,e,i=0,o){Notification.showMessage(t,e,SeverityEnum.error,i,o)}static showMessage(t,e,i=SeverityEnum.info,o=this.duration,s=[]){o=void 0===o?this.duration:o,null!==this.messageContainer&&null!==document.getElementById("alert-container")||(this.messageContainer=document.createElement("div"),this.messageContainer.setAttribute("id","alert-container"),document.body.appendChild(this.messageContainer));const a=document.createElement("typo3-notification-message");a.setAttribute("notificationId","notification-"+Math.random().toString(36).substr(2,5)),a.setAttribute("title",t),e&&a.setAttribute("message",e),a.setAttribute("severity",i.toString()),a.setAttribute("duration",o.toString()),a.actions=s,this.messageContainer.appendChild(a)}}Notification.duration=5,Notification.messageContainer=null;let notificationObject,NotificationMessage=class extends LitElement{constructor(){super(...arguments),this.severity=SeverityEnum.info,this.duration=0,this.actions=[],this.visible=!1,this.executingAction=-1}createRenderRoot(){return this}async firstUpdated(){await new Promise(t=>window.setTimeout(t,200)),this.visible=!0,await this.requestUpdate(),this.duration>0&&(await new Promise(t=>window.setTimeout(t,1e3*this.duration)),this.close())}async close(){this.visible=!1;const t=()=>{this.parentNode&&this.parentNode.removeChild(this)};"animate"in this?(this.style.overflow="hidden",this.style.display="block",this.animate([{height:this.getBoundingClientRect().height+"px"},{height:0}],{duration:400,easing:"cubic-bezier(.02, .01, .47, 1)"}).onfinish=t):t()}render(){const t=Severity.getCssClass(this.severity);let e="";switch(this.severity){case SeverityEnum.notice:e="lightbulb-o";break;case SeverityEnum.ok:e="check";break;case SeverityEnum.warning:e="exclamation";break;case SeverityEnum.error:e="times";break;case SeverityEnum.info:default:e="info"}return html` +var __decorate=function(t,e,i,o){var s,a=arguments.length,n=a<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,i,o);else for(var r=t.length-1;r>=0;r--)(s=t[r])&&(n=(a<3?s(n):a>3?s(e,i,n):s(e,i))||n);return a>3&&n&&Object.defineProperty(e,i,n),n};import{LitElement,html}from"lit";import{customElement,property,state}from"lit/decorators.js";import{classMap}from"lit/directives/class-map.js";import{ifDefined}from"lit/directives/if-defined.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import Severity from"@typo3/backend/severity.js";class Notification{static notice(t,e,i,o){Notification.showMessage(t,e,SeverityEnum.notice,i,o)}static info(t,e,i,o){Notification.showMessage(t,e,SeverityEnum.info,i,o)}static success(t,e,i,o){Notification.showMessage(t,e,SeverityEnum.ok,i,o)}static warning(t,e,i,o){Notification.showMessage(t,e,SeverityEnum.warning,i,o)}static error(t,e,i=0,o){Notification.showMessage(t,e,SeverityEnum.error,i,o)}static showMessage(t,e,i=SeverityEnum.info,o=this.duration,s=[]){o=void 0===o?this.duration:o,null!==this.messageContainer&&null!==document.getElementById("alert-container")||(this.messageContainer=document.createElement("div"),this.messageContainer.setAttribute("id","alert-container"),document.body.appendChild(this.messageContainer));const a=document.createElement("typo3-notification-message");a.setAttribute("notificationId","notification-"+Math.random().toString(36).substr(2,5)),a.setAttribute("title",t),e&&a.setAttribute("message",e),a.setAttribute("severity",i.toString()),a.setAttribute("duration",o.toString()),a.actions=s,this.messageContainer.appendChild(a)}}Notification.duration=5,Notification.messageContainer=null;let notificationObject,NotificationMessage=class extends LitElement{constructor(){super(...arguments),this.severity=SeverityEnum.info,this.duration=0,this.actions=[],this.visible=!1,this.executingAction=-1}createRenderRoot(){return this}async firstUpdated(){await new Promise(t=>window.setTimeout(t,200)),this.visible=!0,await this.requestUpdate(),this.duration>0&&(await new Promise(t=>window.setTimeout(t,1e3*this.duration)),this.close())}async close(){this.visible=!1;const t=()=>{this.parentNode&&this.parentNode.removeChild(this)};"animate"in this?(this.style.overflow="hidden",this.style.display="block",this.animate([{height:this.getBoundingClientRect().height+"px"},{height:0}],{duration:400,easing:"cubic-bezier(.02, .01, .47, 1)"}).onfinish=t):t()}render(){const t=Severity.getCssClass(this.severity);let e="";switch(this.severity){case SeverityEnum.notice:e="lightbulb-o";break;case SeverityEnum.ok:e="check";break;case SeverityEnum.warning:e="exclamation";break;case SeverityEnum.error:e="times";break;case SeverityEnum.info:default:e="info"}return html` <div id="${ifDefined(this.notificationId||void 0)}" class="${"alert alert-"+t+" alert-dismissible fade"+(this.visible?" in":"")}" diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/online-media.js b/typo3/sysext/backend/Resources/Public/JavaScript/online-media.js new file mode 100644 index 0000000000000000000000000000000000000000..7f9a79b86b3929d12c26fbd4c09964a500c04bbb --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/online-media.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import{MessageUtility}from"@typo3/backend/utility/message-utility.js";import{KeyTypesEnum}from"@typo3/backend/enum/key-types.js";import NProgress from"nprogress";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import SecurityUtility from"@typo3/core/security-utility.js";import Modal from"@typo3/backend/modal.js";import Severity from"@typo3/backend/severity.js";class OnlineMedia{constructor(){this.securityUtility=new SecurityUtility,$(()=>{this.registerEvents()})}registerEvents(){const e=this;$(document).on("click",".t3js-online-media-add-btn",t=>{e.triggerModal($(t.currentTarget))})}addOnlineMedia(e,t){const i=e.data("target-folder"),r=e.data("online-media-allowed"),o=e.data("file-irre-object");NProgress.start(),new AjaxRequest(TYPO3.settings.ajaxUrls.online_media_create).post({url:t,targetFolder:i,allowed:r}).then(async e=>{const t=await e.resolve();if(t.file){const e={actionName:"typo3:foreignRelation:insert",objectGroup:o,table:"sys_file",uid:t.file};MessageUtility.send(e)}else{const e=Modal.confirm("ERROR",t.error,Severity.error,[{text:TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(Severity.error),name:"ok",active:!0}]).on("confirm.button.ok",()=>{e.modal("hide")})}NProgress.done()})}triggerModal(e){const t=e.data("btn-submit")||"Add",i=e.data("placeholder")||"Paste media url here...",r=$.map(e.data("online-media-allowed").split(","),e=>'<span class="label label-success">'+this.securityUtility.encodeHtml(e.toUpperCase(),!1)+"</span>"),o=e.data("online-media-allowed-help-text")||"Allow to embed from sources:",a=$("<div>").attr("class","form-control-wrap").append([$("<input>").attr("type","text").attr("class","form-control online-media-url").attr("placeholder",i),$("<div>").attr("class","help-block").html(this.securityUtility.encodeHtml(o,!1)+"<br>"+r.join(" "))]),n=Modal.show(e.attr("title"),a,Severity.notice,[{text:t,btnClass:"btn btn-primary",name:"ok",trigger:()=>{const t=n.find("input.online-media-url").val();t&&(n.modal("hide"),this.addOnlineMedia(e,t))}}]);n.on("shown.bs.modal",e=>{$(e.currentTarget).find("input.online-media-url").first().focus().on("keydown",e=>{e.keyCode===KeyTypesEnum.ENTER&&n.find('button[name="ok"]').trigger("click")})})}}export default new OnlineMedia; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/page-actions.js b/typo3/sysext/backend/Resources/Public/JavaScript/page-actions.js new file mode 100644 index 0000000000000000000000000000000000000000..d5f9f97f280161f3a046d9e921dfe467606668ea --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/page-actions.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{KeyTypesEnum}from"@typo3/backend/enum/key-types.js";import $ from"jquery";import PersistentStorage from"@typo3/backend/storage/persistent.js";import"@typo3/backend/element/icon-element.js";import"@typo3/backend/new-content-element-wizard-button.js";var IdentifierEnum;!function(e){e.pageTitle=".t3js-title-inlineedit",e.hiddenElements=".t3js-hidden-record"}(IdentifierEnum||(IdentifierEnum={}));class PageActions{constructor(){this.pageId=0,this.pageOverlayId=0,this.$pageTitle=null,this.$showHiddenElementsCheckbox=null,$(()=>{this.initializeElements(),this.initializeEvents(),this.initializePageTitleRenaming()})}setPageId(e){this.pageId=e}setLanguageOverlayId(e){this.pageOverlayId=e}initializePageTitleRenaming(){if(!$.isReady)return void $(()=>{this.initializePageTitleRenaming()});if(this.pageId<=0)return;const e=$('<button type="button" class="btn btn-link" aria-label="'+TYPO3.lang.editPageTitle+'" data-action="edit"><typo3-backend-icon identifier="actions-open" size="small"></typo3-backend-icon></button>');e.on("click",()=>{this.editPageTitle()}),this.$pageTitle.on("dblclick",()=>{this.editPageTitle()}).append(e)}initializeElements(){this.$pageTitle=$(IdentifierEnum.pageTitle+":first"),this.$showHiddenElementsCheckbox=$("#checkShowHidden")}initializeEvents(){this.$showHiddenElementsCheckbox.on("change",this.toggleContentElementVisibility)}toggleContentElementVisibility(e){const t=$(e.currentTarget),i=$(IdentifierEnum.hiddenElements),n=$('<span class="form-check-spinner"><typo3-backend-icon identifier="spinner-circle" size="small"></typo3-backend-icon></span>');t.hide().after(n),t.prop("checked")?i.slideDown():i.slideUp(),PersistentStorage.set("moduleData.web_layout.showHidden",t.prop("checked")?"1":"0").done(()=>{n.remove(),t.show()})}editPageTitle(){const e=$('<form class="t3js-title-edit-form"><div class="form-group"><div class="input-group input-group-lg"><input class="form-control t3js-title-edit-input"><button class="btn btn-default" type="button" data-action="submit"><typo3-backend-icon identifier="actions-save" size="small"></typo3-backend-icon></button> <button class="btn btn-default" type="button" data-action="cancel"><typo3-backend-icon identifier="actions-close" size="small"></typo3-backend-icon></button> </div></div></form>'),t=e.find("input");e.find('[data-action="cancel"]').on("click",()=>{e.replaceWith(this.$pageTitle),this.initializePageTitleRenaming()}),e.find('[data-action="submit"]').on("click",()=>{const i=t.val().trim();""!==i&&this.$pageTitle.text()!==i?this.saveChanges(t):e.find('[data-action="cancel"]').trigger("click")}),t.parents("form").on("submit",e=>(e.preventDefault(),!1));const i=this.$pageTitle;i.children().last().remove(),i.replaceWith(e),t.val(i.text()).focus(),t.on("keydown",t=>{switch(t.which){case KeyTypesEnum.ENTER:e.find('[data-action="submit"]').trigger("click");break;case KeyTypesEnum.ESCAPE:e.find('[data-action="cancel"]').trigger("click")}})}saveChanges(e){const t=e.parents("form.t3js-title-edit-form");t.find("button").addClass("disabled"),e.attr("disabled","disabled");let i,n={};i=this.pageOverlayId>0?this.pageOverlayId:this.pageId,n.data={},n.data.pages={},n.data.pages[i]={title:e.val()},import("@typo3/backend/ajax-data-handler.js").then(({default:i})=>{i.process(n).then(()=>{t.find("[data-action=cancel]").trigger("click"),this.$pageTitle.text(e.val()),this.initializePageTitleRenaming(),top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}).catch(()=>{t.find("[data-action=cancel]").trigger("click")})})}}export default new PageActions; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeElement.js b/typo3/sysext/backend/Resources/Public/JavaScript/page-tree/page-tree-element.js similarity index 73% rename from typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeElement.js rename to typo3/sysext/backend/Resources/Public/JavaScript/page-tree/page-tree-element.js index 04862f6a18cac72161d3ed995ea7658a3c6e03c7..4a2280135f79330f84401084d2d7a154ffdff817 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTreeElement.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/page-tree/page-tree-element.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(e,t,o,i){var r,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(n<3?r(s):n>3?r(t,o,s):r(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s};import{html,LitElement}from"lit";import{customElement,property,query}from"lit/decorators.js";import{until}from"lit/directives/until.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";import{PageTree}from"TYPO3/CMS/Backend/PageTree/PageTree.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Persistent from"TYPO3/CMS/Backend/Storage/Persistent.js";import{getRecordFromName}from"TYPO3/CMS/Backend/Module.js";import ContextMenu from"TYPO3/CMS/Backend/ContextMenu.js";import*as d3selection from"d3-selection";import{KeyTypesEnum as KeyTypes}from"TYPO3/CMS/Backend/Enum/KeyTypes.js";import{Toolbar}from"TYPO3/CMS/Backend/SvgTree.js";import{DragDrop,DraggablePositionEnum}from"TYPO3/CMS/Backend/Tree/DragDrop.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import{ModuleStateStorage}from"TYPO3/CMS/Backend/Storage/ModuleStateStorage.js";export const navigationComponentName="typo3-backend-navigation-component-pagetree";let EditablePageTree=class extends PageTree{selectFirstNode(){this.selectNode(this.nodes[0],!0)}sendChangeCommand(e){let t="",o=0;if(e.target&&(o=e.target.identifier,"after"===e.position&&(o=-o)),"new"===e.command)t="&data[pages][NEW_1][pid]="+o+"&data[pages][NEW_1][title]="+encodeURIComponent(e.name)+"&data[pages][NEW_1][doktype]="+e.type;else if("edit"===e.command)t="&data[pages]["+e.uid+"]["+e.nameSourceField+"]="+encodeURIComponent(e.title);else if("delete"===e.command){const o=ModuleStateStorage.current("web");e.uid===o.identifier&&this.selectFirstNode(),t="&cmd[pages]["+e.uid+"][delete]=1"}else t="cmd[pages]["+e.uid+"]["+e.command+"]="+o;this.requestTreeUpdate(t).then(e=>{e&&e.hasErrors?(this.errorNotification(e.messages,!1),this.nodesContainer.selectAll(".node").remove(),this.updateVisibleNodes(),this.nodesRemovePlaceholder()):this.refreshOrFilterTree()})}switchFocusNode(e){this.nodeIsEdit||this.switchFocus(this.getNodeElement(e))}nodesUpdate(e){return super.nodesUpdate.call(this,e).call(this.initializeDragForNode())}updateNodeBgClass(e){return super.updateNodeBgClass.call(this,e).call(this.initializeDragForNode())}initializeDragForNode(){return this.dragDrop.connectDragHandler(new PageTreeNodeDragHandler(this,this.dragDrop))}removeEditedText(){const e=d3selection.selectAll(".node-edit");if(e.size())try{e.remove(),this.nodeIsEdit=!1}catch(e){}}appendTextElement(e){let t=0;return super.appendTextElement(e).on("click",(e,o)=>{"0"!==o.identifier?1==++t&&setTimeout(()=>{1===t?this.selectNode(o,!0):this.editNodeLabel(o),t=0},300):this.selectNode(o,!0)})}sendEditNodeLabelCommand(e){const t="&data[pages]["+e.identifier+"]["+e.nameSourceField+"]="+encodeURIComponent(e.newName);this.requestTreeUpdate(t,e).then(t=>{t&&t.hasErrors?this.errorNotification(t.messages,!1):e.name=e.newName,this.refreshOrFilterTree()})}requestTreeUpdate(e,t=null){return this.nodesAddPlaceholder(t),new AjaxRequest(top.TYPO3.settings.ajaxUrls.record_process).post(e,{headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"}}).then(e=>e.resolve()).catch(e=>{this.errorNotification(e,!0)})}editNodeLabel(e){e.allowEdit&&(this.removeEditedText(),this.nodeIsEdit=!0,d3selection.select(this.svg.node().parentNode).append("input").attr("class","node-edit").style("top",()=>e.y+this.settings.marginTop+"px").style("left",e.x+this.textPosition+5+"px").style("width",this.settings.width-(e.x+this.textPosition+20)+"px").style("height",this.settings.nodeHeight+"px").attr("type","text").attr("value",e.name).on("keydown",t=>{const o=t.keyCode;if(o===KeyTypes.ENTER||o===KeyTypes.TAB){const o=t.target.value.trim();this.nodeIsEdit=!1,this.removeEditedText(),o.length&&o!==e.name&&(e.nameSourceField=e.nameSourceField||"title",e.newName=o,this.sendEditNodeLabelCommand(e))}else o===KeyTypes.ESCAPE&&(this.nodeIsEdit=!1,this.removeEditedText())}).on("blur",t=>{if(!this.nodeIsEdit)return;const o=t.target.value.trim();o.length&&o!==e.name&&(e.nameSourceField=e.nameSourceField||"title",e.newName=o,this.sendEditNodeLabelCommand(e)),this.removeEditedText()}).node().select())}};EditablePageTree=__decorate([customElement("typo3-backend-navigation-component-pagetree-tree")],EditablePageTree);export{EditablePageTree};let PageTreeNavigationComponent=class extends LitElement{constructor(){super(...arguments),this.mountPointPath=null,this.configuration=null,this.refresh=()=>{this.tree.refreshOrFilterTree()},this.setMountPoint=e=>{this.setTemporaryMountPoint(e.detail.pageId)},this.selectFirstNode=()=>{this.tree.selectFirstNode()},this.toggleExpandState=e=>{const t=e.detail.node;t&&Persistent.set("BackendComponents.States.Pagetree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadContent=e=>{const t=e.detail.node;if(!t?.checked)return;if(ModuleStateStorage.update("web",t.identifier,!0,t.stateIdentifier.split("_")[0]),!1===e.detail.propagate)return;const o=top.TYPO3.ModuleMenu.App;let i=getRecordFromName(o.getCurrentModule()).link;i+=i.includes("?")?"&":"?",top.TYPO3.Backend.ContentContainer.setUrl(i+"id="+t.identifier)},this.showContextMenu=e=>{const t=e.detail.node;t&&ContextMenu.show(t.itemType,parseInt(t.identifier,10),"tree","","",this.tree.getNodeElement(t))},this.selectActiveNode=e=>{const t=ModuleStateStorage.current("web").selection;let o=e.detail.nodes;e.detail.nodes=o.map(e=>(e.stateIdentifier===t&&(e.checked=!0),e))}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:pagetree:refresh",this.refresh),document.addEventListener("typo3:pagetree:mountPoint",this.setMountPoint),document.addEventListener("typo3:pagetree:selectFirstNode",this.selectFirstNode)}disconnectedCallback(){document.removeEventListener("typo3:pagetree:refresh",this.refresh),document.removeEventListener("typo3:pagetree:mountPoint",this.setMountPoint),document.removeEventListener("typo3:pagetree:selectFirstNode",this.selectFirstNode),super.disconnectedCallback()}createRenderRoot(){return this}render(){return html` +var __decorate=function(e,t,o,i){var r,n=arguments.length,s=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(n<3?r(s):n>3?r(t,o,s):r(t,o))||s);return n>3&&s&&Object.defineProperty(t,o,s),s};import{html,LitElement}from"lit";import{customElement,property,query}from"lit/decorators.js";import{until}from"lit/directives/until.js";import{lll}from"@typo3/core/lit-helper.js";import{PageTree}from"@typo3/backend/page-tree/page-tree.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Persistent from"@typo3/backend/storage/persistent.js";import{getRecordFromName}from"@typo3/backend/module.js";import ContextMenu from"@typo3/backend/context-menu.js";import*as d3selection from"d3-selection";import{KeyTypesEnum as KeyTypes}from"@typo3/backend/enum/key-types.js";import{Toolbar}from"@typo3/backend/svg-tree.js";import{DragDrop,DraggablePositionEnum}from"@typo3/backend/tree/drag-drop.js";import Modal from"@typo3/backend/modal.js";import Severity from"@typo3/backend/severity.js";import{ModuleStateStorage}from"@typo3/backend/storage/module-state-storage.js";export const navigationComponentName="typo3-backend-navigation-component-pagetree";let EditablePageTree=class extends PageTree{selectFirstNode(){this.selectNode(this.nodes[0],!0)}sendChangeCommand(e){let t="",o=0;if(e.target&&(o=e.target.identifier,"after"===e.position&&(o=-o)),"new"===e.command)t="&data[pages][NEW_1][pid]="+o+"&data[pages][NEW_1][title]="+encodeURIComponent(e.name)+"&data[pages][NEW_1][doktype]="+e.type;else if("edit"===e.command)t="&data[pages]["+e.uid+"]["+e.nameSourceField+"]="+encodeURIComponent(e.title);else if("delete"===e.command){const o=ModuleStateStorage.current("web");e.uid===o.identifier&&this.selectFirstNode(),t="&cmd[pages]["+e.uid+"][delete]=1"}else t="cmd[pages]["+e.uid+"]["+e.command+"]="+o;this.requestTreeUpdate(t).then(e=>{e&&e.hasErrors?(this.errorNotification(e.messages,!1),this.nodesContainer.selectAll(".node").remove(),this.updateVisibleNodes(),this.nodesRemovePlaceholder()):this.refreshOrFilterTree()})}switchFocusNode(e){this.nodeIsEdit||this.switchFocus(this.getNodeElement(e))}nodesUpdate(e){return super.nodesUpdate.call(this,e).call(this.initializeDragForNode())}updateNodeBgClass(e){return super.updateNodeBgClass.call(this,e).call(this.initializeDragForNode())}initializeDragForNode(){return this.dragDrop.connectDragHandler(new PageTreeNodeDragHandler(this,this.dragDrop))}removeEditedText(){const e=d3selection.selectAll(".node-edit");if(e.size())try{e.remove(),this.nodeIsEdit=!1}catch(e){}}appendTextElement(e){let t=0;return super.appendTextElement(e).on("click",(e,o)=>{"0"!==o.identifier?1==++t&&setTimeout(()=>{1===t?this.selectNode(o,!0):this.editNodeLabel(o),t=0},300):this.selectNode(o,!0)})}sendEditNodeLabelCommand(e){const t="&data[pages]["+e.identifier+"]["+e.nameSourceField+"]="+encodeURIComponent(e.newName);this.requestTreeUpdate(t,e).then(t=>{t&&t.hasErrors?this.errorNotification(t.messages,!1):e.name=e.newName,this.refreshOrFilterTree()})}requestTreeUpdate(e,t=null){return this.nodesAddPlaceholder(t),new AjaxRequest(top.TYPO3.settings.ajaxUrls.record_process).post(e,{headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"}}).then(e=>e.resolve()).catch(e=>{this.errorNotification(e,!0)})}editNodeLabel(e){e.allowEdit&&(this.removeEditedText(),this.nodeIsEdit=!0,d3selection.select(this.svg.node().parentNode).append("input").attr("class","node-edit").style("top",()=>e.y+this.settings.marginTop+"px").style("left",e.x+this.textPosition+5+"px").style("width",this.settings.width-(e.x+this.textPosition+20)+"px").style("height",this.settings.nodeHeight+"px").attr("type","text").attr("value",e.name).on("keydown",t=>{const o=t.keyCode;if(o===KeyTypes.ENTER||o===KeyTypes.TAB){const o=t.target.value.trim();this.nodeIsEdit=!1,this.removeEditedText(),o.length&&o!==e.name&&(e.nameSourceField=e.nameSourceField||"title",e.newName=o,this.sendEditNodeLabelCommand(e))}else o===KeyTypes.ESCAPE&&(this.nodeIsEdit=!1,this.removeEditedText())}).on("blur",t=>{if(!this.nodeIsEdit)return;const o=t.target.value.trim();o.length&&o!==e.name&&(e.nameSourceField=e.nameSourceField||"title",e.newName=o,this.sendEditNodeLabelCommand(e)),this.removeEditedText()}).node().select())}};EditablePageTree=__decorate([customElement("typo3-backend-navigation-component-pagetree-tree")],EditablePageTree);export{EditablePageTree};let PageTreeNavigationComponent=class extends LitElement{constructor(){super(...arguments),this.mountPointPath=null,this.configuration=null,this.refresh=()=>{this.tree.refreshOrFilterTree()},this.setMountPoint=e=>{this.setTemporaryMountPoint(e.detail.pageId)},this.selectFirstNode=()=>{this.tree.selectFirstNode()},this.toggleExpandState=e=>{const t=e.detail.node;t&&Persistent.set("BackendComponents.States.Pagetree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadContent=e=>{const t=e.detail.node;if(!t?.checked)return;if(ModuleStateStorage.update("web",t.identifier,!0,t.stateIdentifier.split("_")[0]),!1===e.detail.propagate)return;const o=top.TYPO3.ModuleMenu.App;let i=getRecordFromName(o.getCurrentModule()).link;i+=i.includes("?")?"&":"?",top.TYPO3.Backend.ContentContainer.setUrl(i+"id="+t.identifier)},this.showContextMenu=e=>{const t=e.detail.node;t&&ContextMenu.show(t.itemType,parseInt(t.identifier,10),"tree","","",this.tree.getNodeElement(t))},this.selectActiveNode=e=>{const t=ModuleStateStorage.current("web").selection;let o=e.detail.nodes;e.detail.nodes=o.map(e=>(e.stateIdentifier===t&&(e.checked=!0),e))}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:pagetree:refresh",this.refresh),document.addEventListener("typo3:pagetree:mountPoint",this.setMountPoint),document.addEventListener("typo3:pagetree:selectFirstNode",this.selectFirstNode)}disconnectedCallback(){document.removeEventListener("typo3:pagetree:refresh",this.refresh),document.removeEventListener("typo3:pagetree:mountPoint",this.setMountPoint),document.removeEventListener("typo3:pagetree:selectFirstNode",this.selectFirstNode),super.disconnectedCallback()}createRenderRoot(){return this}render(){return html` <div id="typo3-pagetree" class="svg-tree"> ${until(this.renderTree(),this.renderLoader())} </div> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/page-tree/page-tree.js b/typo3/sysext/backend/Resources/Public/JavaScript/page-tree/page-tree.js new file mode 100644 index 0000000000000000000000000000000000000000..5803797f9b7ceaa2e77fff3b8c88a36299336c26 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/page-tree/page-tree.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{SvgTree}from"@typo3/backend/svg-tree.js";export class PageTree extends SvgTree{constructor(){super(),this.networkErrorTitle=TYPO3.lang.pagetree_networkErrorTitle,this.networkErrorMessage=TYPO3.lang.pagetree_networkErrorDesc,this.settings.defaultProperties={hasChildren:!1,nameSourceField:"title",itemType:"pages",prefix:"",suffix:"",locked:!1,loaded:!1,overlayIcon:"",selectable:!0,expanded:!1,checked:!1,backgroundColor:"",stopPageTree:!1,class:"",readableRootline:"",isMountPoint:!1}}showChildren(e){this.loadChildrenOfNode(e),super.showChildren(e)}nodesUpdate(e){return(e=super.nodesUpdate(e)).append("text").text("+").attr("class","node-stop").attr("dx",30).attr("dy",5).attr("visibility",e=>e.stopPageTree&&0!==e.depth?"visible":"hidden").on("click",(e,t)=>{document.dispatchEvent(new CustomEvent("typo3:pagetree:mountPoint",{detail:{pageId:parseInt(t.identifier,10)}}))}),e}loadChildrenOfNode(e){e.loaded||(this.nodesAddPlaceholder(),new AjaxRequest(this.settings.dataUrl+"&pid="+e.identifier+"&mount="+e.mountPoint+"&pidDepth="+e.depth).get({cache:"no-cache"}).then(e=>e.resolve()).then(t=>{let r=Array.isArray(t)?t:[];r.shift();const o=this.nodes.indexOf(e)+1;r.forEach((e,t)=>{this.nodes.splice(o+t,0,e)}),e.loaded=!0,this.setParametersNode(),this.prepareDataForVisibleNodes(),this.updateVisibleNodes(),this.nodesRemovePlaceholder(),this.switchFocusNode(e)}).catch(e=>{throw this.errorNotification(e,!1),this.nodesRemovePlaceholder(),e}))}appendTextElement(e){return super.appendTextElement(e).attr("dx",e=>{let t=this.textPosition;return e.stopPageTree&&0!==e.depth&&(t+=15),e.locked&&(t+=15),t})}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Popover.js b/typo3/sysext/backend/Resources/Public/JavaScript/popover.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Popover.js rename to typo3/sysext/backend/Resources/Public/JavaScript/popover.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/severity.js b/typo3/sysext/backend/Resources/Public/JavaScript/severity.js new file mode 100644 index 0000000000000000000000000000000000000000..afbfe87a08e0be25f2ac6ab18094bc04e59e44f1 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/severity.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{SeverityEnum}from"@typo3/backend/enum/severity.js";class Severity{static getCssClass(e){let t;switch(e){case SeverityEnum.notice:t="notice";break;case SeverityEnum.ok:t="success";break;case SeverityEnum.warning:t="warning";break;case SeverityEnum.error:t="danger";break;case SeverityEnum.info:default:t="info"}return t}}let severityObject;Severity.notice=SeverityEnum.notice,Severity.info=SeverityEnum.info,Severity.ok=SeverityEnum.ok,Severity.warning=SeverityEnum.warning,Severity.error=SeverityEnum.error;try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.Severity&&(severityObject=window.opener.TYPO3.Severity),parent&&parent.window.TYPO3&&parent.window.TYPO3.Severity&&(severityObject=parent.window.TYPO3.Severity),top&&top.TYPO3&&top.TYPO3.Severity&&(severityObject=top.TYPO3.Severity)}catch{}severityObject||(severityObject=Severity,"undefined"!=typeof TYPO3&&(TYPO3.Severity=severityObject));export default severityObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/site-inline-actions.js b/typo3/sysext/backend/Resources/Public/JavaScript/site-inline-actions.js new file mode 100644 index 0000000000000000000000000000000000000000..b284293b8c6ef1a5dc7a1ada6be345a2763341f6 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/site-inline-actions.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";class SiteInlineActions{constructor(){DocumentService.ready().then(()=>{TYPO3.settings.ajaxUrls.record_inline_details=TYPO3.settings.ajaxUrls.site_configuration_inline_details,TYPO3.settings.ajaxUrls.record_inline_create=TYPO3.settings.ajaxUrls.site_configuration_inline_create})}}export default new SiteInlineActions; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Storage/AbstractClientStorage.js b/typo3/sysext/backend/Resources/Public/JavaScript/storage/abstract-client-storage.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Storage/AbstractClientStorage.js rename to typo3/sysext/backend/Resources/Public/JavaScript/storage/abstract-client-storage.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Event/ClientRequest.js b/typo3/sysext/backend/Resources/Public/JavaScript/storage/browser-session.js similarity index 65% rename from typo3/sysext/backend/Resources/Public/JavaScript/Event/ClientRequest.js rename to typo3/sysext/backend/Resources/Public/JavaScript/storage/browser-session.js index dd04f371ff8d7729a2da7d5727e004d3fc535f9c..d6631e959a379c7e8645fbaae4b4f70b6c05fd0a 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Event/ClientRequest.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/storage/browser-session.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -import InteractionRequest from"TYPO3/CMS/Backend/Event/InteractionRequest.js";class ClientRequest extends InteractionRequest{constructor(e,t=null){super(e),this.clientEvent=t}}export default ClientRequest; \ No newline at end of file +import AbstractClientStorage from"@typo3/backend/storage/abstract-client-storage.js";class BrowserSession extends AbstractClientStorage{constructor(){super(),this.storage=sessionStorage}}export default new BrowserSession; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/storage/client.js b/typo3/sysext/backend/Resources/Public/JavaScript/storage/client.js new file mode 100644 index 0000000000000000000000000000000000000000..0946e97dd1c03f6b51dbdee08abca8a52b8c27fd --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/storage/client.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AbstractClientStorage from"@typo3/backend/storage/abstract-client-storage.js";class Client extends AbstractClientStorage{constructor(){super(),this.storage=localStorage}}export default new Client; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Storage/ModuleStateStorage.js b/typo3/sysext/backend/Resources/Public/JavaScript/storage/module-state-storage.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Storage/ModuleStateStorage.js rename to typo3/sysext/backend/Resources/Public/JavaScript/storage/module-state-storage.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Storage/Persistent.js b/typo3/sysext/backend/Resources/Public/JavaScript/storage/persistent.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Storage/Persistent.js rename to typo3/sysext/backend/Resources/Public/JavaScript/storage/persistent.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js b/typo3/sysext/backend/Resources/Public/JavaScript/svg-tree.js similarity index 58% rename from typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js rename to typo3/sysext/backend/Resources/Public/JavaScript/svg-tree.js index 7473df6e09637469cf69474c36f083a119c25b3d..ccbead5bb3a71ac05160f0aab15efc095702b98d 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/svg-tree.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(e,t,s,i){var o,n=arguments.length,r=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(n<3?o(r):n>3?o(t,s,r):o(t,s))||r);return n>3&&r&&Object.defineProperty(t,s,r),r};import{html,LitElement}from"lit";import{customElement,property,state}from"lit/decorators.js";import*as d3selection from"d3-selection";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import{KeyTypesEnum as KeyTypes}from"TYPO3/CMS/Backend/Enum/KeyTypes.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import Tooltip from"TYPO3/CMS/Backend/Tooltip.js";import{MarkupIdentifiers}from"TYPO3/CMS/Backend/Enum/IconTypes.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";import DebounceEvent from"TYPO3/CMS/Core/Event/DebounceEvent.js";import"TYPO3/CMS/Backend/Element/IconElement.js";export class SvgTree extends LitElement{constructor(){super(...arguments),this.setup=null,this.settings={showIcons:!1,marginTop:15,nodeHeight:20,indentWidth:16,width:300,duration:400,dataUrl:"",filterUrl:"",defaultProperties:{},expandUpToLevel:null,actions:[]},this.isOverSvg=!1,this.svg=null,this.container=null,this.nodesContainer=null,this.nodesBgContainer=null,this.hoveredNode=null,this.nodes=[],this.textPosition=10,this.icons={},this.nodesActionsContainer=null,this.iconsContainer=null,this.linksContainer=null,this.data=new class{constructor(){this.links=[],this.nodes=[]}},this.viewportHeight=0,this.scrollBottom=0,this.searchTerm=null,this.unfilteredNodes="",this.networkErrorTitle=top.TYPO3.lang.tree_networkError,this.networkErrorMessage=top.TYPO3.lang.tree_networkErrorDescription,this.tooltipOptions={}}doSetup(e){Object.assign(this.settings,e),this.settings.showIcons&&(this.textPosition+=20),this.svg=d3selection.select(this).select("svg"),this.container=this.svg.select(".nodes-wrapper"),this.nodesBgContainer=this.container.select(".nodes-bg"),this.nodesActionsContainer=this.container.select(".nodes-actions"),this.linksContainer=this.container.select(".links"),this.nodesContainer=this.container.select(".nodes"),this.iconsContainer=this.svg.select("defs"),this.tooltipOptions={delay:50,trigger:"hover",placement:"right",container:void 0!==this.settings.id?"#"+this.settings.id:"body"},this.updateScrollPosition(),this.loadData(),this.dispatchEvent(new Event("svg-tree:initialized"))}switchFocus(e){if(null===e)return;e.parentNode.querySelectorAll("[tabindex]").forEach(e=>{e.setAttribute("tabindex","-1")}),e.setAttribute("tabindex","0"),e.focus()}switchFocusNode(e){this.switchFocus(this.getNodeElement(e))}getNodeElement(e){return this.querySelector("#identifier-"+this.getNodeStateIdentifier(e))}loadData(){this.nodesAddPlaceholder(),new AjaxRequest(this.settings.dataUrl).get({cache:"no-cache"}).then(e=>e.resolve()).then(e=>{const t=Array.isArray(e)?e:[];this.replaceData(t),this.nodesRemovePlaceholder(),this.updateScrollPosition(),this.updateVisibleNodes()}).catch(e=>{throw this.errorNotification(e,!1),this.nodesRemovePlaceholder(),e})}replaceData(e){this.setParametersNode(e),this.prepareDataForVisibleNodes(),this.nodesContainer.selectAll(".node").remove(),this.nodesBgContainer.selectAll(".node-bg").remove(),this.nodesActionsContainer.selectAll(".node-action").remove(),this.linksContainer.selectAll(".link").remove(),this.updateVisibleNodes()}setParametersNode(e=null){1===(e=(e=e||this.nodes).map((t,s)=>{if(void 0===t.command&&(t=Object.assign({},this.settings.defaultProperties,t)),t.expanded=null!==this.settings.expandUpToLevel?t.depth<this.settings.expandUpToLevel:Boolean(t.expanded),t.parents=[],t.parentsStateIdentifier=[],t.depth>0){let i=t.depth;for(let o=s;o>=0;o--){let s=e[o];s.depth<i&&(t.parents.push(o),t.parentsStateIdentifier.push(e[o].stateIdentifier),i=s.depth)}}return void 0===t.checked&&(t.checked=!1),t})).filter(e=>0===e.depth).length&&(e[0].expanded=!0);const t=new CustomEvent("typo3:svg-tree:nodes-prepared",{detail:{nodes:e},bubbles:!1});this.dispatchEvent(t),this.nodes=t.detail.nodes}nodesRemovePlaceholder(){const e=this.querySelector(".node-loader");e&&(e.style.display="none");const t=this.closest(".svg-tree"),s=t?.querySelector(".svg-tree-loader");s&&(s.style.display="none")}nodesAddPlaceholder(e=null){if(e){const t=this.querySelector(".node-loader");t&&(t.style.top=""+(e.y+this.settings.marginTop),t.style.display="block")}else{const e=this.closest(".svg-tree"),t=e?.querySelector(".svg-tree-loader");t&&(t.style.display="block")}}hideChildren(e){e.expanded=!1,this.setExpandedState(e),this.dispatchEvent(new CustomEvent("typo3:svg-tree:expand-toggle",{detail:{node:e}}))}showChildren(e){e.expanded=!0,this.setExpandedState(e),this.dispatchEvent(new CustomEvent("typo3:svg-tree:expand-toggle",{detail:{node:e}}))}setExpandedState(e){const t=this.getNodeElement(e);t&&(e.hasChildren?t.setAttribute("aria-expanded",e.expanded?"true":"false"):t.removeAttribute("aria-expanded"))}refreshTree(){this.loadData()}refreshOrFilterTree(){""!==this.searchTerm?this.filter(this.searchTerm):this.refreshTree()}prepareDataForVisibleNodes(){const e={};this.nodes.forEach((t,s)=>{t.expanded||(e[s]=!0)}),this.data.nodes=this.nodes.filter(t=>!0!==t.hidden&&!t.parents.some(t=>Boolean(e[t]))),this.data.links=[];let t=0;this.data.nodes.forEach((e,s)=>{e.x=e.depth*this.settings.indentWidth,e.readableRootline&&(t+=this.settings.nodeHeight),e.y=s*this.settings.nodeHeight+t,void 0!==e.parents[0]&&this.data.links.push({source:this.nodes[e.parents[0]],target:e}),this.settings.showIcons&&(this.fetchIcon(e.icon),this.fetchIcon(e.overlayIcon),e.locked&&this.fetchIcon("warning-in-use"))}),this.svg.attr("height",this.data.nodes.length*this.settings.nodeHeight+this.settings.nodeHeight/2+t)}fetchIcon(e,t=!0){e&&(e in this.icons||(this.icons[e]={identifier:e,icon:null},Icons.getIcon(e,Icons.sizes.small,null,null,MarkupIdentifiers.inline).then(s=>{let i=s.match(/<svg[\s\S]*<\/svg>/i);if(i){let t=document.createRange().createContextualFragment(i[0]);this.icons[e].icon=t.firstElementChild}t&&this.updateVisibleNodes()})))}updateVisibleNodes(){const e=Math.ceil(this.viewportHeight/this.settings.nodeHeight+1),t=Math.floor(Math.max(this.scrollTop-2*this.settings.nodeHeight,0)/this.settings.nodeHeight),s=this.data.nodes.slice(t,t+e),i=this.querySelector('[tabindex="0"]'),o=s.find(e=>e.checked);let n=this.nodesContainer.selectAll(".node").data(s,e=>e.stateIdentifier);const r=this.nodesBgContainer.selectAll(".node-bg").data(s,e=>e.stateIdentifier),a=this.nodesActionsContainer.selectAll(".node-action").data(s,e=>e.stateIdentifier);n.exit().remove(),r.exit().remove(),a.exit().remove(),this.updateNodeActions(a);const d=this.updateNodeBgClass(r);d.attr("class",(e,t)=>this.getNodeBgClass(e,t,d)).attr("style",e=>e.backgroundColor?"fill: "+e.backgroundColor+";":""),this.updateLinks(),n=this.enterSvgElements(n),n.attr("tabindex",(e,t)=>{if(void 0!==o){if(o===e)return"0"}else if(null===i){if(0===t)return"0"}else if(d3selection.select(i).datum()===e)return"0";return"-1"}).attr("transform",this.getNodeTransform).select(".node-name").html(e=>this.getNodeLabel(e)),n.select(".chevron").attr("transform",this.getChevronTransform).style("fill",this.getChevronColor).attr("class",this.getChevronClass),n.select(".toggle").attr("visibility",this.getToggleVisibility),this.settings.showIcons&&(n.select("use.node-icon").attr("xlink:href",this.getIconId),n.select("use.node-icon-overlay").attr("xlink:href",this.getIconOverlayId),n.select("use.node-icon-locked").attr("xlink:href",e=>"#icon-"+(e.locked?"warning-in-use":"")))}updateNodeBgClass(e){return e.enter().append("rect").merge(e).attr("width","100%").attr("height",this.settings.nodeHeight).attr("data-state-id",this.getNodeStateIdentifier).attr("transform",this.getNodeBgTransform).on("mouseover",(e,t)=>this.onMouseOverNode(t)).on("mouseout",(e,t)=>this.onMouseOutOfNode(t)).on("click",(e,t)=>{this.selectNode(t,!0),this.switchFocusNode(t)}).on("contextmenu",(e,t)=>{this.dispatchEvent(new CustomEvent("typo3:svg-tree:node-context",{detail:{node:t}}))})}getIconId(e){return"#icon-"+e.icon}getIconOverlayId(e){return"#icon-"+e.overlayIcon}selectNode(e,t=!0){this.isNodeSelectable(e)&&(this.disableSelectedNodes(),e.checked=!0,this.dispatchEvent(new CustomEvent("typo3:svg-tree:node-selected",{detail:{node:e,propagate:t}})),this.updateVisibleNodes())}filter(e){"string"==typeof e&&(this.searchTerm=e),this.nodesAddPlaceholder(),this.searchTerm&&this.settings.filterUrl?new AjaxRequest(this.settings.filterUrl+"&q="+this.searchTerm).get({cache:"no-cache"}).then(e=>e.resolve()).then(e=>{let t=Array.isArray(e)?e:[];t.length>0&&(""===this.unfilteredNodes&&(this.unfilteredNodes=JSON.stringify(this.nodes)),this.replaceData(t)),this.nodesRemovePlaceholder()}).catch(e=>{throw this.errorNotification(e,!1),this.nodesRemovePlaceholder(),e}):this.resetFilter()}resetFilter(){if(this.searchTerm="",this.unfilteredNodes.length>0){let e=this.getSelectedNodes()[0];if(void 0===e)return void this.refreshTree();this.nodes=JSON.parse(this.unfilteredNodes),this.unfilteredNodes="";const t=this.getNodeByIdentifier(e.stateIdentifier);t?(this.selectNode(t,!1),this.nodesRemovePlaceholder()):this.refreshTree()}else this.refreshTree();this.prepareDataForVisibleNodes(),this.updateVisibleNodes()}errorNotification(e=null,t=!1){if(Array.isArray(e))e.forEach(e=>{Notification.error(e.title,e.message)});else{let t=this.networkErrorTitle;e&&e.target&&(e.target.status||e.target.statusText)&&(t+=" - "+(e.target.status||"")+" "+(e.target.statusText||"")),Notification.error(t,this.networkErrorMessage)}t&&this.loadData()}connectedCallback(){super.connectedCallback(),this.addEventListener("resize",()=>this.updateView()),this.addEventListener("scroll",()=>this.updateView()),this.addEventListener("svg-tree:visible",()=>this.updateView()),window.addEventListener("resize",()=>{this.getClientRects().length>0&&this.updateView()})}getSelectedNodes(){return this.nodes.filter(e=>e.checked)}createRenderRoot(){return this}render(){return html` +var __decorate=function(e,t,s,i){var o,n=arguments.length,r=n<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,s,i);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(r=(n<3?o(r):n>3?o(t,s,r):o(t,s))||r);return n>3&&r&&Object.defineProperty(t,s,r),r};import{html,LitElement}from"lit";import{customElement,property,state}from"lit/decorators.js";import*as d3selection from"d3-selection";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Notification from"@typo3/backend/notification.js";import{KeyTypesEnum as KeyTypes}from"@typo3/backend/enum/key-types.js";import Icons from"@typo3/backend/icons.js";import Tooltip from"@typo3/backend/tooltip.js";import{MarkupIdentifiers}from"@typo3/backend/enum/icon-types.js";import{lll}from"@typo3/core/lit-helper.js";import DebounceEvent from"@typo3/core/event/debounce-event.js";import"@typo3/backend/element/icon-element.js";export class SvgTree extends LitElement{constructor(){super(...arguments),this.setup=null,this.settings={showIcons:!1,marginTop:15,nodeHeight:20,indentWidth:16,width:300,duration:400,dataUrl:"",filterUrl:"",defaultProperties:{},expandUpToLevel:null,actions:[]},this.isOverSvg=!1,this.svg=null,this.container=null,this.nodesContainer=null,this.nodesBgContainer=null,this.hoveredNode=null,this.nodes=[],this.textPosition=10,this.icons={},this.nodesActionsContainer=null,this.iconsContainer=null,this.linksContainer=null,this.data=new class{constructor(){this.links=[],this.nodes=[]}},this.viewportHeight=0,this.scrollBottom=0,this.searchTerm=null,this.unfilteredNodes="",this.networkErrorTitle=top.TYPO3.lang.tree_networkError,this.networkErrorMessage=top.TYPO3.lang.tree_networkErrorDescription,this.tooltipOptions={}}doSetup(e){Object.assign(this.settings,e),this.settings.showIcons&&(this.textPosition+=20),this.svg=d3selection.select(this).select("svg"),this.container=this.svg.select(".nodes-wrapper"),this.nodesBgContainer=this.container.select(".nodes-bg"),this.nodesActionsContainer=this.container.select(".nodes-actions"),this.linksContainer=this.container.select(".links"),this.nodesContainer=this.container.select(".nodes"),this.iconsContainer=this.svg.select("defs"),this.tooltipOptions={delay:50,trigger:"hover",placement:"right",container:void 0!==this.settings.id?"#"+this.settings.id:"body"},this.updateScrollPosition(),this.loadData(),this.dispatchEvent(new Event("svg-tree:initialized"))}switchFocus(e){if(null===e)return;e.parentNode.querySelectorAll("[tabindex]").forEach(e=>{e.setAttribute("tabindex","-1")}),e.setAttribute("tabindex","0"),e.focus()}switchFocusNode(e){this.switchFocus(this.getNodeElement(e))}getNodeElement(e){return this.querySelector("#identifier-"+this.getNodeStateIdentifier(e))}loadData(){this.nodesAddPlaceholder(),new AjaxRequest(this.settings.dataUrl).get({cache:"no-cache"}).then(e=>e.resolve()).then(e=>{const t=Array.isArray(e)?e:[];this.replaceData(t),this.nodesRemovePlaceholder(),this.updateScrollPosition(),this.updateVisibleNodes()}).catch(e=>{throw this.errorNotification(e,!1),this.nodesRemovePlaceholder(),e})}replaceData(e){this.setParametersNode(e),this.prepareDataForVisibleNodes(),this.nodesContainer.selectAll(".node").remove(),this.nodesBgContainer.selectAll(".node-bg").remove(),this.nodesActionsContainer.selectAll(".node-action").remove(),this.linksContainer.selectAll(".link").remove(),this.updateVisibleNodes()}setParametersNode(e=null){1===(e=(e=e||this.nodes).map((t,s)=>{if(void 0===t.command&&(t=Object.assign({},this.settings.defaultProperties,t)),t.expanded=null!==this.settings.expandUpToLevel?t.depth<this.settings.expandUpToLevel:Boolean(t.expanded),t.parents=[],t.parentsStateIdentifier=[],t.depth>0){let i=t.depth;for(let o=s;o>=0;o--){let s=e[o];s.depth<i&&(t.parents.push(o),t.parentsStateIdentifier.push(e[o].stateIdentifier),i=s.depth)}}return void 0===t.checked&&(t.checked=!1),t})).filter(e=>0===e.depth).length&&(e[0].expanded=!0);const t=new CustomEvent("typo3:svg-tree:nodes-prepared",{detail:{nodes:e},bubbles:!1});this.dispatchEvent(t),this.nodes=t.detail.nodes}nodesRemovePlaceholder(){const e=this.querySelector(".node-loader");e&&(e.style.display="none");const t=this.closest(".svg-tree"),s=t?.querySelector(".svg-tree-loader");s&&(s.style.display="none")}nodesAddPlaceholder(e=null){if(e){const t=this.querySelector(".node-loader");t&&(t.style.top=""+(e.y+this.settings.marginTop),t.style.display="block")}else{const e=this.closest(".svg-tree"),t=e?.querySelector(".svg-tree-loader");t&&(t.style.display="block")}}hideChildren(e){e.expanded=!1,this.setExpandedState(e),this.dispatchEvent(new CustomEvent("typo3:svg-tree:expand-toggle",{detail:{node:e}}))}showChildren(e){e.expanded=!0,this.setExpandedState(e),this.dispatchEvent(new CustomEvent("typo3:svg-tree:expand-toggle",{detail:{node:e}}))}setExpandedState(e){const t=this.getNodeElement(e);t&&(e.hasChildren?t.setAttribute("aria-expanded",e.expanded?"true":"false"):t.removeAttribute("aria-expanded"))}refreshTree(){this.loadData()}refreshOrFilterTree(){""!==this.searchTerm?this.filter(this.searchTerm):this.refreshTree()}prepareDataForVisibleNodes(){const e={};this.nodes.forEach((t,s)=>{t.expanded||(e[s]=!0)}),this.data.nodes=this.nodes.filter(t=>!0!==t.hidden&&!t.parents.some(t=>Boolean(e[t]))),this.data.links=[];let t=0;this.data.nodes.forEach((e,s)=>{e.x=e.depth*this.settings.indentWidth,e.readableRootline&&(t+=this.settings.nodeHeight),e.y=s*this.settings.nodeHeight+t,void 0!==e.parents[0]&&this.data.links.push({source:this.nodes[e.parents[0]],target:e}),this.settings.showIcons&&(this.fetchIcon(e.icon),this.fetchIcon(e.overlayIcon),e.locked&&this.fetchIcon("warning-in-use"))}),this.svg.attr("height",this.data.nodes.length*this.settings.nodeHeight+this.settings.nodeHeight/2+t)}fetchIcon(e,t=!0){e&&(e in this.icons||(this.icons[e]={identifier:e,icon:null},Icons.getIcon(e,Icons.sizes.small,null,null,MarkupIdentifiers.inline).then(s=>{let i=s.match(/<svg[\s\S]*<\/svg>/i);if(i){let t=document.createRange().createContextualFragment(i[0]);this.icons[e].icon=t.firstElementChild}t&&this.updateVisibleNodes()})))}updateVisibleNodes(){const e=Math.ceil(this.viewportHeight/this.settings.nodeHeight+1),t=Math.floor(Math.max(this.scrollTop-2*this.settings.nodeHeight,0)/this.settings.nodeHeight),s=this.data.nodes.slice(t,t+e),i=this.querySelector('[tabindex="0"]'),o=s.find(e=>e.checked);let n=this.nodesContainer.selectAll(".node").data(s,e=>e.stateIdentifier);const r=this.nodesBgContainer.selectAll(".node-bg").data(s,e=>e.stateIdentifier),a=this.nodesActionsContainer.selectAll(".node-action").data(s,e=>e.stateIdentifier);n.exit().remove(),r.exit().remove(),a.exit().remove(),this.updateNodeActions(a);const d=this.updateNodeBgClass(r);d.attr("class",(e,t)=>this.getNodeBgClass(e,t,d)).attr("style",e=>e.backgroundColor?"fill: "+e.backgroundColor+";":""),this.updateLinks(),n=this.enterSvgElements(n),n.attr("tabindex",(e,t)=>{if(void 0!==o){if(o===e)return"0"}else if(null===i){if(0===t)return"0"}else if(d3selection.select(i).datum()===e)return"0";return"-1"}).attr("transform",this.getNodeTransform).select(".node-name").html(e=>this.getNodeLabel(e)),n.select(".chevron").attr("transform",this.getChevronTransform).style("fill",this.getChevronColor).attr("class",this.getChevronClass),n.select(".toggle").attr("visibility",this.getToggleVisibility),this.settings.showIcons&&(n.select("use.node-icon").attr("xlink:href",this.getIconId),n.select("use.node-icon-overlay").attr("xlink:href",this.getIconOverlayId),n.select("use.node-icon-locked").attr("xlink:href",e=>"#icon-"+(e.locked?"warning-in-use":"")))}updateNodeBgClass(e){return e.enter().append("rect").merge(e).attr("width","100%").attr("height",this.settings.nodeHeight).attr("data-state-id",this.getNodeStateIdentifier).attr("transform",this.getNodeBgTransform).on("mouseover",(e,t)=>this.onMouseOverNode(t)).on("mouseout",(e,t)=>this.onMouseOutOfNode(t)).on("click",(e,t)=>{this.selectNode(t,!0),this.switchFocusNode(t)}).on("contextmenu",(e,t)=>{this.dispatchEvent(new CustomEvent("typo3:svg-tree:node-context",{detail:{node:t}}))})}getIconId(e){return"#icon-"+e.icon}getIconOverlayId(e){return"#icon-"+e.overlayIcon}selectNode(e,t=!0){this.isNodeSelectable(e)&&(this.disableSelectedNodes(),e.checked=!0,this.dispatchEvent(new CustomEvent("typo3:svg-tree:node-selected",{detail:{node:e,propagate:t}})),this.updateVisibleNodes())}filter(e){"string"==typeof e&&(this.searchTerm=e),this.nodesAddPlaceholder(),this.searchTerm&&this.settings.filterUrl?new AjaxRequest(this.settings.filterUrl+"&q="+this.searchTerm).get({cache:"no-cache"}).then(e=>e.resolve()).then(e=>{let t=Array.isArray(e)?e:[];t.length>0&&(""===this.unfilteredNodes&&(this.unfilteredNodes=JSON.stringify(this.nodes)),this.replaceData(t)),this.nodesRemovePlaceholder()}).catch(e=>{throw this.errorNotification(e,!1),this.nodesRemovePlaceholder(),e}):this.resetFilter()}resetFilter(){if(this.searchTerm="",this.unfilteredNodes.length>0){let e=this.getSelectedNodes()[0];if(void 0===e)return void this.refreshTree();this.nodes=JSON.parse(this.unfilteredNodes),this.unfilteredNodes="";const t=this.getNodeByIdentifier(e.stateIdentifier);t?(this.selectNode(t,!1),this.nodesRemovePlaceholder()):this.refreshTree()}else this.refreshTree();this.prepareDataForVisibleNodes(),this.updateVisibleNodes()}errorNotification(e=null,t=!1){if(Array.isArray(e))e.forEach(e=>{Notification.error(e.title,e.message)});else{let t=this.networkErrorTitle;e&&e.target&&(e.target.status||e.target.statusText)&&(t+=" - "+(e.target.status||"")+" "+(e.target.statusText||"")),Notification.error(t,this.networkErrorMessage)}t&&this.loadData()}connectedCallback(){super.connectedCallback(),this.addEventListener("resize",()=>this.updateView()),this.addEventListener("scroll",()=>this.updateView()),this.addEventListener("svg-tree:visible",()=>this.updateView()),window.addEventListener("resize",()=>{this.getClientRects().length>0&&this.updateView()})}getSelectedNodes(){return this.nodes.filter(e=>e.checked)}createRenderRoot(){return this}render(){return html` <div class="node-loader"> <typo3-backend-icon identifier="spinner-circle-light" size="small"></typo3-backend-icon> </div> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/switch-user.js b/typo3/sysext/backend/Resources/Public/JavaScript/switch-user.js new file mode 100644 index 0000000000000000000000000000000000000000..9a0f2a1643487f087b9e9964f8b253d7c920a91f --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/switch-user.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var Modes,__decorate=function(t,e,r,o){var i,s=arguments.length,c=s<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(t,e,r,o);else for(var n=t.length-1;n>=0;n--)(i=t[n])&&(c=(s<3?i(c):s>3?i(e,r,c):i(e,r))||c);return s>3&&c&&Object.defineProperty(e,r,c),c};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Notification from"@typo3/backend/notification.js";!function(t){t.switch="switch",t.exit="exit"}(Modes||(Modes={}));let SwitchUser=class extends LitElement{constructor(){super(),this.mode=Modes.switch,this.addEventListener("click",t=>{t.preventDefault(),this.mode===Modes.switch?this.handleSwitchUser():this.mode===Modes.exit&&this.handleExitSwitchUser()})}render(){return html`<slot></slot>`}handleSwitchUser(){this.targetUser?new AjaxRequest(TYPO3.settings.ajaxUrls.switch_user).post({targetUser:this.targetUser}).then(async t=>{const e=await t.resolve();!0===e.success&&e.url?top.window.location.href=e.url:Notification.error("Switching to user went wrong.")}):Notification.error("Switching to user went wrong.")}handleExitSwitchUser(){new AjaxRequest(TYPO3.settings.ajaxUrls.switch_user_exit).post({}).then(async t=>{const e=await t.resolve();!0===e.success&&e.url?top.window.location.href=e.url:Notification.error("Exiting current user went wrong.")})}};__decorate([property({type:String})],SwitchUser.prototype,"targetUser",void 0),__decorate([property({type:Modes})],SwitchUser.prototype,"mode",void 0),SwitchUser=__decorate([customElement("typo3-backend-switch-user")],SwitchUser); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/tabs.js b/typo3/sysext/backend/Resources/Public/JavaScript/tabs.js new file mode 100644 index 0000000000000000000000000000000000000000..18c5aac63d2c087a03078fe44b3757a90507ff40 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/tabs.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{Tab}from"bootstrap";import BrowserSession from"@typo3/backend/storage/browser-session.js";import Client from"@typo3/backend/storage/client.js";import DocumentService from"@typo3/core/document-service.js";class Tabs{static receiveActiveTab(e){return BrowserSession.get(e)||""}static storeActiveTab(e,t){BrowserSession.set(e,t)}constructor(){DocumentService.ready().then(()=>{document.querySelectorAll(".t3js-tabs").forEach(e=>{const t=Tabs.receiveActiveTab(e.id);t&&new Tab(document.querySelector('a[href="'+t+'"]')).show();"1"===e.dataset.storeLastTab&&e.addEventListener("show.bs.tab",e=>{const t=e.currentTarget.id,r=e.target.hash;Tabs.storeActiveTab(t,r)})})}),Client.unsetByPrefix("tabs-")}}export default new Tabs; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/toolbar.js b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar.js new file mode 100644 index 0000000000000000000000000000000000000000..456454edf5a429b54cde98e7714af14eca895b7e --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import RegularEvent from"@typo3/core/event/regular-event.js";class Toolbar{static initialize(){Toolbar.initializeEvents()}static initializeEvents(){new RegularEvent("click",()=>{const e=document.querySelector(".scaffold");e.classList.remove("scaffold-modulemenu-expanded","scaffold-search-expanded"),e.classList.toggle("scaffold-toolbar-expanded")}).bindTo(document.querySelector(".t3js-topbar-button-toolbar")),new RegularEvent("click",()=>{const e=document.querySelector(".scaffold");e.classList.remove("scaffold-modulemenu-expanded","scaffold-toolbar-expanded"),e.classList.toggle("scaffold-search-expanded")}).bindTo(document.querySelector(".t3js-topbar-button-search"))}}DocumentService.ready().then(Toolbar.initialize); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/clear-cache-menu.js b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/clear-cache-menu.js new file mode 100644 index 0000000000000000000000000000000000000000..61f9afc11f925d5e9e55243b7b91d686242caff6 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/clear-cache-menu.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Icons from"@typo3/backend/icons.js";import Notification from"@typo3/backend/notification.js";import Viewport from"@typo3/backend/viewport.js";var Identifiers;!function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-clearcachetoolbaritem",e.menuItemSelector="a.toolbar-cache-flush-action",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon"}(Identifiers||(Identifiers={}));class ClearCacheMenu{constructor(){this.initializeEvents=()=>{$(Identifiers.containerSelector).on("click",Identifiers.menuItemSelector,e=>{e.preventDefault();const t=$(e.currentTarget).attr("href");t&&this.clearCache(t)})},Viewport.Topbar.Toolbar.registerEvent(this.initializeEvents)}clearCache(e){$(Identifiers.containerSelector).removeClass("open");const t=$(Identifiers.toolbarIconSelector,Identifiers.containerSelector),o=t.clone();Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(e=>{t.replaceWith(e)}),new AjaxRequest(e).post({}).then(async e=>{const t=await e.resolve();!0===t.success?Notification.success(t.title,t.message):!1===t.success&&Notification.error(t.title,t.message)},()=>{Notification.error(TYPO3.lang["flushCaches.error"],TYPO3.lang["flushCaches.error.description"])}).finally(()=>{$(Identifiers.toolbarIconSelector,Identifiers.containerSelector).replaceWith(o)})}}export default new ClearCacheMenu; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/LiveSearch.js b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/live-search.js similarity index 62% rename from typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/LiveSearch.js rename to typo3/sysext/backend/Resources/Public/JavaScript/toolbar/live-search.js index 067e8704f3057485aa0797ca84981d10fbfc48c7..e012f3e0b296a320e064d5de09136641186e9872 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/LiveSearch.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/live-search.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -import $ from"jquery";import Viewport from"TYPO3/CMS/Backend/Viewport.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import"jquery/autocomplete.js";import"TYPO3/CMS/Backend/Input/Clearable.js";import{html}from"lit";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{renderHTML}from"TYPO3/CMS/Core/lit-helper.js";import{ModuleStateStorage}from"TYPO3/CMS/Backend/Storage/ModuleStateStorage.js";var Identifiers;!function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem",e.toolbarItem=".t3js-toolbar-item-search",e.dropdownToggle=".t3js-toolbar-search-dropdowntoggle",e.searchFieldSelector=".t3js-topbar-navigation-search-field",e.formSelector=".t3js-topbar-navigation-search"}(Identifiers||(Identifiers={}));class LiveSearch{constructor(){this.url=TYPO3.settings.ajaxUrls.livesearch,Viewport.Topbar.Toolbar.registerEvent(()=>{let e;this.registerAutocomplete(),this.registerEvents(),$(Identifiers.toolbarItem).removeAttr("style"),null!==(e=document.querySelector(Identifiers.searchFieldSelector))&&e.clearable({onClear:()=>{$(Identifiers.dropdownToggle).hasClass("show")&&$(Identifiers.dropdownToggle).dropdown("toggle")}})})}registerAutocomplete(){$(Identifiers.searchFieldSelector).autocomplete({serviceUrl:this.url,paramName:"q",dataType:"json",minChars:2,width:"100%",groupBy:"typeLabel",noCache:!0,containerClass:Identifiers.toolbarItem.substr(1,Identifiers.toolbarItem.length),appendTo:Identifiers.containerSelector+" .dropdown-menu",forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,triggerSelectOnValidInput:!1,preventBadQueries:!1,noSuggestionNotice:'<h3 class="dropdown-headline">'+TYPO3.lang.liveSearch_listEmptyText+"</h3><p>"+TYPO3.lang.liveSearch_helpTitle+"</p><hr><p>"+TYPO3.lang.liveSearch_helpDescription+"<br>"+TYPO3.lang.liveSearch_helpDescriptionPages+"</p>",transformResult:e=>({suggestions:$.map(e,e=>({value:e.title,data:e}))}),formatGroup:(e,t,o)=>renderHTML(html` +import $ from"jquery";import Viewport from"@typo3/backend/viewport.js";import Icons from"@typo3/backend/icons.js";import"jquery/autocomplete.js";import"@typo3/backend/input/clearable.js";import{html}from"lit";import{unsafeHTML}from"lit/directives/unsafe-html.js";import{renderHTML}from"@typo3/core/lit-helper.js";import{ModuleStateStorage}from"@typo3/backend/storage/module-state-storage.js";var Identifiers;!function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem",e.toolbarItem=".t3js-toolbar-item-search",e.dropdownToggle=".t3js-toolbar-search-dropdowntoggle",e.searchFieldSelector=".t3js-topbar-navigation-search-field",e.formSelector=".t3js-topbar-navigation-search"}(Identifiers||(Identifiers={}));class LiveSearch{constructor(){this.url=TYPO3.settings.ajaxUrls.livesearch,Viewport.Topbar.Toolbar.registerEvent(()=>{let e;this.registerAutocomplete(),this.registerEvents(),$(Identifiers.toolbarItem).removeAttr("style"),null!==(e=document.querySelector(Identifiers.searchFieldSelector))&&e.clearable({onClear:()=>{$(Identifiers.dropdownToggle).hasClass("show")&&$(Identifiers.dropdownToggle).dropdown("toggle")}})})}registerAutocomplete(){$(Identifiers.searchFieldSelector).autocomplete({serviceUrl:this.url,paramName:"q",dataType:"json",minChars:2,width:"100%",groupBy:"typeLabel",noCache:!0,containerClass:Identifiers.toolbarItem.substr(1,Identifiers.toolbarItem.length),appendTo:Identifiers.containerSelector+" .dropdown-menu",forceFixPosition:!1,preserveInput:!0,showNoSuggestionNotice:!0,triggerSelectOnValidInput:!1,preventBadQueries:!1,noSuggestionNotice:'<h3 class="dropdown-headline">'+TYPO3.lang.liveSearch_listEmptyText+"</h3><p>"+TYPO3.lang.liveSearch_helpTitle+"</p><hr><p>"+TYPO3.lang.liveSearch_helpDescription+"<br>"+TYPO3.lang.liveSearch_helpDescriptionPages+"</p>",transformResult:e=>({suggestions:$.map(e,e=>({value:e.title,data:e}))}),formatGroup:(e,t,o)=>renderHTML(html` ${o>0?html`<hr>`:""} <h3 class="dropdown-headline">${t}</h3> `),formatResult:e=>renderHTML(html` diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/shortcut-menu.js b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/shortcut-menu.js new file mode 100644 index 0000000000000000000000000000000000000000..1999882457bb14e52593003d19fb5869e99d310d --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/shortcut-menu.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Icons from"@typo3/backend/icons.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import Viewport from"@typo3/backend/viewport.js";import SecurityUtility from"@typo3/core/security-utility.js";import{ModuleStateStorage}from"@typo3/backend/storage/module-state-storage.js";var Identifiers;!function(t){t.containerSelector="#typo3-cms-backend-backend-toolbaritems-shortcuttoolbaritem",t.toolbarIconSelector=".dropdown-toggle span.icon",t.toolbarMenuSelector=".dropdown-menu",t.shortcutItemSelector=".t3js-topbar-shortcut",t.shortcutJumpSelector=".t3js-shortcut-jump",t.shortcutDeleteSelector=".t3js-shortcut-delete",t.shortcutEditSelector=".t3js-shortcut-edit",t.shortcutFormTitleSelector='input[name="shortcut-title"]',t.shortcutFormGroupSelector='select[name="shortcut-group"]',t.shortcutFormSaveSelector=".shortcut-form-save",t.shortcutFormCancelSelector=".shortcut-form-cancel",t.shortcutFormSelector=".shortcut-form"}(Identifiers||(Identifiers={}));class ShortcutMenu{constructor(){this.initializeEvents=()=>{$(Identifiers.containerSelector).on("click",Identifiers.shortcutDeleteSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.deleteShortcut($(t.currentTarget).closest(Identifiers.shortcutItemSelector))}).on("click",Identifiers.shortcutFormGroupSelector,t=>{t.preventDefault(),t.stopImmediatePropagation()}).on("click",Identifiers.shortcutEditSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.editShortcut($(t.currentTarget).closest(Identifiers.shortcutItemSelector))}).on("click",Identifiers.shortcutFormSaveSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.saveShortcutForm($(t.currentTarget).closest(Identifiers.shortcutFormSelector))}).on("submit",Identifiers.shortcutFormSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.saveShortcutForm($(t.currentTarget).closest(Identifiers.shortcutFormSelector))}).on("click",Identifiers.shortcutFormCancelSelector,t=>{t.preventDefault(),t.stopImmediatePropagation(),this.refreshMenu()}).on("click",Identifiers.shortcutJumpSelector,t=>{t.preventDefault(),t.stopImmediatePropagation();const e=$(t.currentTarget).data("pageid");e&&ModuleStateStorage.updateWithCurrentMount("web",e,!0);const r=document.querySelector("typo3-backend-module-router");r.setAttribute("endpoint",$(t.currentTarget).attr("href")),r.setAttribute("module",$(t.currentTarget).data("module"))})},Viewport.Topbar.Toolbar.registerEvent(this.initializeEvents)}createShortcut(t,e,r,o,s){void 0!==o&&Modal.confirm(TYPO3.lang["bookmark.create"],o).on("confirm.button.ok",o=>{const c=$(Identifiers.toolbarIconSelector,Identifiers.containerSelector),i=c.clone();Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(t=>{c.replaceWith(t)}),new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_create).post({routeIdentifier:t,arguments:e,displayName:r}).then(()=>{if(this.refreshMenu(),$(Identifiers.toolbarIconSelector,Identifiers.containerSelector).replaceWith(i),"object"==typeof s){const t=$(s).hasClass("dropdown-item"),e=new SecurityUtility;Icons.getIcon("actions-system-shortcut-active",Icons.sizes.small).then(r=>{$(s).html(r+(t?" "+e.encodeHtml(TYPO3.lang["labels.alreadyBookmarked"]):""))}),$(s).addClass(t?"disabled":"active"),$(s).attr("data-dispatch-disabled","disabled"),$(s).attr("title",TYPO3.lang["labels.alreadyBookmarked"])}}),$(o.currentTarget).trigger("modal-dismiss")}).on("confirm.button.cancel",t=>{$(t.currentTarget).trigger("modal-dismiss")})}deleteShortcut(t){Modal.confirm(TYPO3.lang["bookmark.delete"],TYPO3.lang["bookmark.confirmDelete"]).on("confirm.button.ok",e=>{new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_remove).post({shortcutId:t.data("shortcutid")}).then(()=>{this.refreshMenu()}),$(e.currentTarget).trigger("modal-dismiss")}).on("confirm.button.cancel",t=>{$(t.currentTarget).trigger("modal-dismiss")})}editShortcut(t){new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_editform).withQueryArguments({shortcutId:t.data("shortcutid"),shortcutGroup:t.data("shortcutgroup")}).get({cache:"no-cache"}).then(async t=>{$(Identifiers.containerSelector).find(Identifiers.toolbarMenuSelector).html(await t.resolve())})}saveShortcutForm(t){new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_saveform).post({shortcutId:t.data("shortcutid"),shortcutTitle:t.find(Identifiers.shortcutFormTitleSelector).val(),shortcutGroup:t.find(Identifiers.shortcutFormGroupSelector).val()}).then(()=>{Notification.success(TYPO3.lang["bookmark.savedTitle"],TYPO3.lang["bookmark.savedMessage"]),this.refreshMenu()})}refreshMenu(){new AjaxRequest(TYPO3.settings.ajaxUrls.shortcut_list).get({cache:"no-cache"}).then(async t=>{$(Identifiers.toolbarMenuSelector,Identifiers.containerSelector).html(await t.resolve())})}}top.TYPO3.ShortcutMenu&&"object"==typeof top.TYPO3.ShortcutMenu||(top.TYPO3.ShortcutMenu=new ShortcutMenu);const shortcutMenuObject=top.TYPO3.ShortcutMenu;export default shortcutMenuObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/system-information-menu.js b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/system-information-menu.js new file mode 100644 index 0000000000000000000000000000000000000000..c33e39e8a7cbb7df049a213dc9c75930b5e0d7be --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/toolbar/system-information-menu.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Icons from"@typo3/backend/icons.js";import PersistentStorage from"@typo3/backend/storage/persistent.js";import Viewport from"@typo3/backend/viewport.js";var Identifiers;!function(e){e.containerSelector="#typo3-cms-backend-backend-toolbaritems-systeminformationtoolbaritem",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon",e.menuContainerSelector=".dropdown-menu",e.moduleLinks=".t3js-systeminformation-module",e.counter=".t3js-systeminformation-counter"}(Identifiers||(Identifiers={}));class SystemInformationMenu{constructor(){this.timer=null,this.updateMenu=()=>{const e=$(Identifiers.toolbarIconSelector,Identifiers.containerSelector),t=e.clone(),o=$(Identifiers.containerSelector).find(Identifiers.menuContainerSelector);null!==this.timer&&(clearTimeout(this.timer),this.timer=null),Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(t=>{e.replaceWith(t)}),new AjaxRequest(TYPO3.settings.ajaxUrls.systeminformation_render).get().then(async e=>{o.html(await e.resolve()),SystemInformationMenu.updateCounter(),$(Identifiers.moduleLinks).on("click",this.openModule)}).finally(()=>{$(Identifiers.toolbarIconSelector,Identifiers.containerSelector).replaceWith(t),this.timer=setTimeout(this.updateMenu,3e5)})},Viewport.Topbar.Toolbar.registerEvent(this.updateMenu)}static updateCounter(){const e=$(Identifiers.containerSelector).find(Identifiers.menuContainerSelector).find(".t3js-systeminformation-container"),t=$(Identifiers.counter),o=e.data("count"),n=e.data("severityclass");t.text(o).toggle(parseInt(o,10)>0),t.removeClass(),t.addClass("t3js-systeminformation-counter toolbar-item-badge badge rounded-pill"),""!==n&&t.addClass(n)}openModule(e){e.preventDefault(),e.stopPropagation();let t={};const o={},n=$(e.currentTarget).data("modulename"),r=$(e.currentTarget).data("moduleparams"),i=Math.floor((new Date).getTime()/1e3);PersistentStorage.isset("systeminformation")&&(t=JSON.parse(PersistentStorage.get("systeminformation"))),o[n]={lastAccess:i},$.extend(!0,t,o);PersistentStorage.set("systeminformation",JSON.stringify(t)).done(()=>{TYPO3.ModuleMenu.App.showModule(n,r),Viewport.Topbar.refresh()})}}export default new SystemInformationMenu; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/tooltip.js b/typo3/sysext/backend/Resources/Public/JavaScript/tooltip.js new file mode 100644 index 0000000000000000000000000000000000000000..5487ea4ba56f69484f20892f4d3c5fc17d949103 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/tooltip.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{Tooltip as BootstrapTooltip}from"bootstrap";import DocumentService from"@typo3/core/document-service.js";class Tooltip{static applyAttributes(t,o){for(const[e,i]of Object.entries(t))o.setAttribute(e,i)}constructor(){DocumentService.ready().then(()=>{this.initialize('[data-bs-toggle="tooltip"]')})}initialize(t,o={}){0===Object.entries(o).length&&(o={container:"body",trigger:"hover",delay:{show:500,hide:100}});const e=document.querySelectorAll(t);for(const t of e)BootstrapTooltip.getOrCreateInstance(t,o)}show(t,o){const e={"data-bs-placement":"auto",title:o};if(t instanceof NodeList)for(const o of t)Tooltip.applyAttributes(e,o),BootstrapTooltip.getInstance(o).show();else if(t instanceof HTMLElement)return Tooltip.applyAttributes(e,t),void BootstrapTooltip.getInstance(t).show()}hide(t){if(t instanceof NodeList)for(const o of t){const t=BootstrapTooltip.getInstance(o);null!==t&&t.hide()}else t instanceof HTMLElement&&BootstrapTooltip.getInstance(t).hide()}}const tooltipObject=new Tooltip;TYPO3.Tooltip=tooltipObject;export default tooltipObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/DragDrop.js b/typo3/sysext/backend/Resources/Public/JavaScript/tree/drag-drop.js similarity index 95% rename from typo3/sysext/backend/Resources/Public/JavaScript/Tree/DragDrop.js rename to typo3/sysext/backend/Resources/Public/JavaScript/tree/drag-drop.js index ea9b5eb27670bb8f5479ad3b715b2ebad5d71f3c..0d0ac4768ec5ada6a87ce0f8da5863d8ea4a0b95 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/DragDrop.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/tree/drag-drop.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -import{html}from"lit";import{renderNodes}from"TYPO3/CMS/Core/lit-helper.js";import*as d3drag from"d3-drag";import*as d3selection from"d3-selection";class DraggableTemplate{static get(e,t){return html`<div class="node-dd node-dd--nodrop"> +import{html}from"lit";import{renderNodes}from"@typo3/core/lit-helper.js";import*as d3drag from"d3-drag";import*as d3selection from"d3-selection";class DraggableTemplate{static get(e,t){return html`<div class="node-dd node-dd--nodrop"> <div class="node-dd__ctrl-icon"></div> <div class="node-dd__text"> <span class="node-dd__icon"> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/tree/file-storage-browser.js b/typo3/sysext/backend/Resources/Public/JavaScript/tree/file-storage-browser.js new file mode 100644 index 0000000000000000000000000000000000000000..f1e48feb2bc9e9a5d42646af742ecaa1fc202048 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/tree/file-storage-browser.js @@ -0,0 +1,25 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var __decorate=function(e,t,r,o){var i,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,r,s):i(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};import{html,LitElement}from"lit";import{customElement,query}from"lit/decorators.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import ElementBrowser from"@typo3/recordlist/element-browser.js";import LinkBrowser from"@typo3/recordlist/link-browser.js";import"@typo3/backend/element/icon-element.js";import Persistent from"@typo3/backend/storage/persistent.js";import{FileStorageTree}from"@typo3/backend/tree/file-storage-tree.js";const componentName="typo3-backend-component-filestorage-browser";let FileStorageBrowserTree=class extends FileStorageTree{updateNodeActions(e){const t=super.updateNodeActions(e);if(this.settings.actions.includes("link")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.linkItem(t)});this.createIconAreaForAction(e,"actions-link")}else if(this.settings.actions.includes("select")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.selectItem(t)});this.createIconAreaForAction(e,"actions-link")}return t}linkItem(e){LinkBrowser.finalizeFunction("t3://folder?storage="+e.storage+"&identifier="+e.pathIdentifier)}selectItem(e){ElementBrowser.insertElement(e.itemType,e.identifier,e.name,e.identifier,!0)}};FileStorageBrowserTree=__decorate([customElement("typo3-backend-component-filestorage-browser-tree")],FileStorageBrowserTree);let FileStorageBrowser=class extends LitElement{constructor(){super(...arguments),this.activeFolder="",this.actions=[],this.triggerRender=()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))},this.selectActiveNode=e=>{let t=e.detail.nodes;e.detail.nodes=t.map(e=>(decodeURIComponent(e.identifier)===this.activeFolder&&(e.checked=!0),e))},this.toggleExpandState=e=>{const t=e.detail.node;t&&Persistent.set("BackendComponents.States.FileStorageTree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadFolderDetails=e=>{const t=e.detail.node;if(!t.checked)return;let r=document.location.href+"&contentOnly=1&expandFolder="+t.identifier;new AjaxRequest(r).get().then(e=>e.resolve()).then(e=>{document.querySelector(".element-browser-main-content .element-browser-body").innerHTML=e})}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:navigation:resized",this.triggerRender)}disconnectedCallback(){document.removeEventListener("typo3:navigation:resized",this.triggerRender),super.disconnectedCallback()}firstUpdated(){this.activeFolder=this.getAttribute("active-folder")||""}createRenderRoot(){return this}render(){this.hasAttribute("tree-actions")&&this.getAttribute("tree-actions").length&&(this.actions=JSON.parse(this.getAttribute("tree-actions")));const e={dataUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_data,filterUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_filter,showIcons:!0,actions:this.actions};return html` + <div class="svg-tree"> + <div> + <typo3-backend-tree-toolbar .tree="${this.tree}" class="svg-toolbar"></typo3-backend-tree-toolbar> + <div class="navigation-tree-container"> + <typo3-backend-component-filestorage-browser-tree class="svg-tree-wrapper" .setup=${e} @svg-tree:initialized=${()=>{this.tree.dispatchEvent(new Event("svg-tree:visible")),this.tree.addEventListener("typo3:svg-tree:expand-toggle",this.toggleExpandState),this.tree.addEventListener("typo3:svg-tree:node-selected",this.loadFolderDetails),this.tree.addEventListener("typo3:svg-tree:nodes-prepared",this.selectActiveNode);this.querySelector("typo3-backend-tree-toolbar").tree=this.tree}}></typo3-backend-component-page-browser-tree> + </div> + </div> + <div class="svg-tree-loader"> + <typo3-backend-icon identifier="spinner-circle-light" size="large"></typo3-backend-icon> + </div> + </div> + `}};__decorate([query(".svg-tree-wrapper")],FileStorageBrowser.prototype,"tree",void 0),FileStorageBrowser=__decorate([customElement(componentName)],FileStorageBrowser);export{FileStorageBrowser}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/FileStorageTreeContainer.js b/typo3/sysext/backend/Resources/Public/JavaScript/tree/file-storage-tree-container.js similarity index 66% rename from typo3/sysext/backend/Resources/Public/JavaScript/Tree/FileStorageTreeContainer.js rename to typo3/sysext/backend/Resources/Public/JavaScript/tree/file-storage-tree-container.js index 1a46fa088eb205bf8e0d105ccbeaa58729f3e7ef..8647237e55cc52b06a422f57c2e6f6f6e2ed4d02 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/FileStorageTreeContainer.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/tree/file-storage-tree-container.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(e,t,r,o){var i,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,r,s):i(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};import{html,LitElement}from"lit";import{customElement,query}from"lit/decorators.js";import{FileStorageTree}from"TYPO3/CMS/Backend/Tree/FileStorageTree.js";import"TYPO3/CMS/Backend/Element/IconElement.js";import Persistent from"TYPO3/CMS/Backend/Storage/Persistent.js";import ContextMenu from"TYPO3/CMS/Backend/ContextMenu.js";import{DragDrop,DraggablePositionEnum}from"TYPO3/CMS/Backend/Tree/DragDrop.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import{ModuleStateStorage}from"TYPO3/CMS/Backend/Storage/ModuleStateStorage.js";import{getRecordFromName}from"TYPO3/CMS/Backend/Module.js";export const navigationComponentName="typo3-backend-navigation-component-filestoragetree";let EditableFileStorageTree=class extends FileStorageTree{constructor(){super(),this.actionHandler=new FileStorageTreeActions(this)}updateNodeBgClass(e){return super.updateNodeBgClass.call(this,e).call(this.initializeDragForNode())}nodesUpdate(e){return super.nodesUpdate.call(this,e).call(this.initializeDragForNode())}initializeDragForNode(){return this.actionHandler.connectDragHandler(new FileStorageTreeNodeDragHandler(this,this.actionHandler))}};EditableFileStorageTree=__decorate([customElement("typo3-backend-navigation-component-filestorage-tree")],EditableFileStorageTree);let FileStorageTreeNavigationComponent=class extends LitElement{constructor(){super(...arguments),this.refresh=()=>{this.tree.refreshOrFilterTree()},this.selectFirstNode=()=>{const e=this.tree.nodes[0];e&&this.tree.selectNode(e,!0)},this.treeUpdateRequested=e=>{const t=encodeURIComponent(e.detail.payload.identifier);let r=this.tree.nodes.filter(e=>e.identifier===t)[0];r&&0===this.tree.getSelectedNodes().filter(e=>e.identifier===r.identifier).length&&this.tree.selectNode(r,!1)},this.toggleExpandState=e=>{const t=e.detail.node;t&&Persistent.set("BackendComponents.States.FileStorageTree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadContent=e=>{const t=e.detail.node;if(!t?.checked)return;if(ModuleStateStorage.update("file",t.identifier,!0),!1===e.detail.propagate)return;const r=top.TYPO3.ModuleMenu.App;let o=getRecordFromName(r.getCurrentModule()).link;o+=o.includes("?")?"&":"?",top.TYPO3.Backend.ContentContainer.setUrl(o+"id="+t.identifier)},this.showContextMenu=e=>{const t=e.detail.node;t&&ContextMenu.show(t.itemType,decodeURIComponent(t.identifier),"tree","","",this.tree.getNodeElement(t))},this.selectActiveNode=e=>{const t=ModuleStateStorage.current("file").selection;let r=e.detail.nodes;e.detail.nodes=r.map(e=>(e.identifier===t&&(e.checked=!0),e))}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:filestoragetree:refresh",this.refresh),document.addEventListener("typo3:filestoragetree:selectFirstNode",this.selectFirstNode),document.addEventListener("typo3:filelist:treeUpdateRequested",this.treeUpdateRequested)}disconnectedCallback(){document.removeEventListener("typo3:filestoragetree:refresh",this.refresh),document.removeEventListener("typo3:filestoragetree:selectFirstNode",this.selectFirstNode),document.removeEventListener("typo3:filelist:treeUpdateRequested",this.treeUpdateRequested),super.disconnectedCallback()}createRenderRoot(){return this}render(){const e={dataUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_data,filterUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_filter,showIcons:!0};return html` +var __decorate=function(e,t,r,o){var i,n=arguments.length,s=n<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,o);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(n<3?i(s):n>3?i(t,r,s):i(t,r))||s);return n>3&&s&&Object.defineProperty(t,r,s),s};import{html,LitElement}from"lit";import{customElement,query}from"lit/decorators.js";import{FileStorageTree}from"@typo3/backend/tree/file-storage-tree.js";import"@typo3/backend/element/icon-element.js";import Persistent from"@typo3/backend/storage/persistent.js";import ContextMenu from"@typo3/backend/context-menu.js";import{DragDrop,DraggablePositionEnum}from"@typo3/backend/tree/drag-drop.js";import Modal from"@typo3/backend/modal.js";import Severity from"@typo3/backend/severity.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{ModuleStateStorage}from"@typo3/backend/storage/module-state-storage.js";import{getRecordFromName}from"@typo3/backend/module.js";export const navigationComponentName="typo3-backend-navigation-component-filestoragetree";let EditableFileStorageTree=class extends FileStorageTree{constructor(){super(),this.actionHandler=new FileStorageTreeActions(this)}updateNodeBgClass(e){return super.updateNodeBgClass.call(this,e).call(this.initializeDragForNode())}nodesUpdate(e){return super.nodesUpdate.call(this,e).call(this.initializeDragForNode())}initializeDragForNode(){return this.actionHandler.connectDragHandler(new FileStorageTreeNodeDragHandler(this,this.actionHandler))}};EditableFileStorageTree=__decorate([customElement("typo3-backend-navigation-component-filestorage-tree")],EditableFileStorageTree);let FileStorageTreeNavigationComponent=class extends LitElement{constructor(){super(...arguments),this.refresh=()=>{this.tree.refreshOrFilterTree()},this.selectFirstNode=()=>{const e=this.tree.nodes[0];e&&this.tree.selectNode(e,!0)},this.treeUpdateRequested=e=>{const t=encodeURIComponent(e.detail.payload.identifier);let r=this.tree.nodes.filter(e=>e.identifier===t)[0];r&&0===this.tree.getSelectedNodes().filter(e=>e.identifier===r.identifier).length&&this.tree.selectNode(r,!1)},this.toggleExpandState=e=>{const t=e.detail.node;t&&Persistent.set("BackendComponents.States.FileStorageTree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadContent=e=>{const t=e.detail.node;if(!t?.checked)return;if(ModuleStateStorage.update("file",t.identifier,!0),!1===e.detail.propagate)return;const r=top.TYPO3.ModuleMenu.App;let o=getRecordFromName(r.getCurrentModule()).link;o+=o.includes("?")?"&":"?",top.TYPO3.Backend.ContentContainer.setUrl(o+"id="+t.identifier)},this.showContextMenu=e=>{const t=e.detail.node;t&&ContextMenu.show(t.itemType,decodeURIComponent(t.identifier),"tree","","",this.tree.getNodeElement(t))},this.selectActiveNode=e=>{const t=ModuleStateStorage.current("file").selection;let r=e.detail.nodes;e.detail.nodes=r.map(e=>(e.identifier===t&&(e.checked=!0),e))}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:filestoragetree:refresh",this.refresh),document.addEventListener("typo3:filestoragetree:selectFirstNode",this.selectFirstNode),document.addEventListener("typo3:filelist:treeUpdateRequested",this.treeUpdateRequested)}disconnectedCallback(){document.removeEventListener("typo3:filestoragetree:refresh",this.refresh),document.removeEventListener("typo3:filestoragetree:selectFirstNode",this.selectFirstNode),document.removeEventListener("typo3:filelist:treeUpdateRequested",this.treeUpdateRequested),super.disconnectedCallback()}createRenderRoot(){return this}render(){const e={dataUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_data,filterUrl:top.TYPO3.settings.ajaxUrls.filestorage_tree_filter,showIcons:!0};return html` <div id="typo3-filestoragetree" class="svg-tree"> <div> <typo3-backend-tree-toolbar .tree="${this.tree}" id="filestoragetree-toolbar" class="svg-toolbar"></typo3-backend-tree-toolbar> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/tree/file-storage-tree.js b/typo3/sysext/backend/Resources/Public/JavaScript/tree/file-storage-tree.js new file mode 100644 index 0000000000000000000000000000000000000000..99a8ba38110faff9357cd2a9850610bb71d6ee44 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/tree/file-storage-tree.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{SvgTree}from"@typo3/backend/svg-tree.js";export class FileStorageTree extends SvgTree{constructor(){super(),this.settings.defaultProperties={hasChildren:!1,nameSourceField:"title",itemType:"sys_file",prefix:"",suffix:"",locked:!1,loaded:!1,overlayIcon:"",selectable:!0,expanded:!1,checked:!1,backgroundColor:"",class:"",readableRootline:""}}showChildren(e){this.loadChildrenOfNode(e),super.showChildren(e)}getNodeTitle(e){return decodeURIComponent(e.name)}loadChildrenOfNode(e){if(e.loaded)return this.prepareDataForVisibleNodes(),void this.updateVisibleNodes();this.nodesAddPlaceholder(),new AjaxRequest(this.settings.dataUrl+"&parent="+e.identifier+"¤tDepth="+e.depth).get({cache:"no-cache"}).then(e=>e.resolve()).then(t=>{let o=Array.isArray(t)?t:[];const s=this.nodes.indexOf(e)+1;o.forEach((e,t)=>{this.nodes.splice(s+t,0,e)}),e.loaded=!0,this.setParametersNode(),this.prepareDataForVisibleNodes(),this.updateVisibleNodes(),this.nodesRemovePlaceholder(),this.switchFocusNode(e)}).catch(e=>{throw this.errorNotification(e,!1),this.nodesRemovePlaceholder(),e})}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/tree/page-browser.js b/typo3/sysext/backend/Resources/Public/JavaScript/tree/page-browser.js new file mode 100644 index 0000000000000000000000000000000000000000..d0b99b6b9743bd054614106f12556990f97a6472 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/tree/page-browser.js @@ -0,0 +1,38 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var __decorate=function(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s};import{html,LitElement}from"lit";import{customElement,property,query}from"lit/decorators.js";import{until}from"lit/directives/until.js";import{lll}from"@typo3/core/lit-helper.js";import{PageTree}from"@typo3/backend/page-tree/page-tree.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import ElementBrowser from"@typo3/recordlist/element-browser.js";import LinkBrowser from"@typo3/recordlist/link-browser.js";import"@typo3/backend/element/icon-element.js";import Persistent from"@typo3/backend/storage/persistent.js";const componentName="typo3-backend-component-page-browser";let PageBrowserTree=class extends PageTree{appendTextElement(e){return super.appendTextElement(e).attr("opacity",e=>this.settings.actions.includes("link")?this.isLinkable(e)?1:.5:1)}updateNodeActions(e){const t=super.updateNodeActions(e);if(this.settings.actions.includes("link")){this.fetchIcon("actions-link");const e=this.nodesActionsContainer.selectAll(".node-action").append("g").attr("visibility",e=>this.isLinkable(e)?"visible":"hidden").on("click",(e,t)=>{this.linkItem(t)});this.createIconAreaForAction(e,"actions-link")}else if(this.settings.actions.includes("select")){this.fetchIcon("actions-link");const e=t.append("g").on("click",(e,t)=>{this.selectItem(t)});this.createIconAreaForAction(e,"actions-link")}return t}linkItem(e){LinkBrowser.finalizeFunction("t3://page?uid="+e.identifier)}isLinkable(e){return!1===["199","254","255"].includes(String(e.type))}selectItem(e){ElementBrowser.insertElement(e.itemType,e.identifier,e.name,e.identifier,!0)}};PageBrowserTree=__decorate([customElement("typo3-backend-component-page-browser-tree")],PageBrowserTree);let PageBrowser=class extends LitElement{constructor(){super(...arguments),this.mountPointPath=null,this.activePageId=0,this.actions=[],this.configuration=null,this.triggerRender=()=>{this.tree.dispatchEvent(new Event("svg-tree:visible"))},this.selectActivePageInTree=e=>{let t=e.detail.nodes;e.detail.nodes=t.map(e=>(parseInt(e.identifier,10)===this.activePageId&&(e.checked=!0),e))},this.toggleExpandState=e=>{const t=e.detail.node;t&&Persistent.set("BackendComponents.States.Pagetree.stateHash."+t.stateIdentifier,t.expanded?"1":"0")},this.loadRecordsOfPage=e=>{const t=e.detail.node;if(!t.checked)return;let n=document.location.href+"&contentOnly=1&expandPage="+t.identifier;new AjaxRequest(n).get().then(e=>e.resolve()).then(e=>{document.querySelector(".element-browser-main-content .element-browser-body").innerHTML=e})},this.setMountPoint=e=>{this.setTemporaryMountPoint(e.detail.pageId)}}connectedCallback(){super.connectedCallback(),document.addEventListener("typo3:navigation:resized",this.triggerRender),document.addEventListener("typo3:pagetree:mountPoint",this.setMountPoint)}disconnectedCallback(){document.removeEventListener("typo3:navigation:resized",this.triggerRender),document.removeEventListener("typo3:pagetree:mountPoint",this.setMountPoint),super.disconnectedCallback()}firstUpdated(){this.activePageId=parseInt(this.getAttribute("active-page"),10),this.actions=JSON.parse(this.getAttribute("tree-actions"))}createRenderRoot(){return this}getConfiguration(){if(null!==this.configuration)return Promise.resolve(this.configuration);const e=top.TYPO3.settings.ajaxUrls.page_tree_browser_configuration,t=this.hasAttribute("alternative-entry-points")?JSON.parse(this.getAttribute("alternative-entry-points")):[];let n=new AjaxRequest(e);return t.length&&(n=n.withQueryArguments("alternativeEntryPoints="+encodeURIComponent(t))),n.get().then(async e=>{const t=await e.resolve("json");return t.actions=this.actions,this.configuration=t,this.mountPointPath=t.temporaryMountPoint||null,t})}render(){return html` + <div class="svg-tree"> + ${until(this.renderTree(),this.renderLoader())} + </div> + `}renderTree(){return this.getConfiguration().then(e=>html` + <div> + <typo3-backend-tree-toolbar .tree="${this.tree}" class="svg-toolbar"></typo3-backend-tree-toolbar> + <div class="navigation-tree-container"> + ${this.renderMountPoint()} + <typo3-backend-component-page-browser-tree id="typo3-pagetree-tree" class="svg-tree-wrapper" .setup=${e} @svg-tree:initialized=${()=>{this.tree.dispatchEvent(new Event("svg-tree:visible")),this.tree.addEventListener("typo3:svg-tree:expand-toggle",this.toggleExpandState),this.tree.addEventListener("typo3:svg-tree:node-selected",this.loadRecordsOfPage),this.tree.addEventListener("typo3:svg-tree:nodes-prepared",this.selectActivePageInTree);this.querySelector("typo3-backend-tree-toolbar").tree=this.tree}}></typo3-backend-component-page-browser-tree> + </div> + </div> + ${this.renderLoader()} + `)}renderLoader(){return html` + <div class="svg-tree-loader"> + <typo3-backend-icon identifier="spinner-circle-light" size="large"></typo3-backend-icon> + </div> + `}unsetTemporaryMountPoint(){this.mountPointPath=null,Persistent.unset("pageTree_temporaryMountPoint").then(()=>{this.tree.refreshTree()})}renderMountPoint(){return null===this.mountPointPath?html``:html` + <div class="node-mount-point"> + <div class="node-mount-point__icon"><typo3-backend-icon identifier="actions-document-info" size="small"></typo3-backend-icon></div> + <div class="node-mount-point__text">${this.mountPointPath}</div> + <div class="node-mount-point__icon mountpoint-close" @click="${()=>this.unsetTemporaryMountPoint()}" title="${lll("labels.temporaryDBmount")}"> + <typo3-backend-icon identifier="actions-close" size="small"></typo3-backend-icon> + </div> + </div> + `}setTemporaryMountPoint(e){new AjaxRequest(this.configuration.setTemporaryMountPointUrl).post("pid="+e,{headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"}}).then(e=>e.resolve()).then(e=>{e&&e.hasErrors?(this.tree.errorNotification(e.message,!0),this.tree.updateVisibleNodes()):(this.mountPointPath=e.mountPointPath,this.tree.refreshOrFilterTree())}).catch(e=>{this.tree.errorNotification(e,!0)})}};__decorate([property({type:String})],PageBrowser.prototype,"mountPointPath",void 0),__decorate([query(".svg-tree-wrapper")],PageBrowser.prototype,"tree",void 0),PageBrowser=__decorate([customElement(componentName)],PageBrowser);export{PageBrowser}; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Tree/TreeNode.js b/typo3/sysext/backend/Resources/Public/JavaScript/tree/tree-node.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Tree/TreeNode.js rename to typo3/sysext/backend/Resources/Public/JavaScript/tree/tree-node.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/user-pass-login.js b/typo3/sysext/backend/Resources/Public/JavaScript/user-pass-login.js new file mode 100644 index 0000000000000000000000000000000000000000..b66a878b5316f3c0b2ab224923e53298402fda50 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/user-pass-login.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Login from"@typo3/backend/login.js";class UserPassLogin{constructor(){this.resetPassword=()=>{const s=$(this.options.passwordField);s.val()&&($(Login.options.useridentField).val(s.val()),s.val(""))},this.showCapsLockWarning=s=>{$(s.target).parent().parent().find(".t3js-login-alert-capslock").toggleClass("hidden",!UserPassLogin.isCapslockEnabled(s))},this.toggleCopyright=s=>{" "===s.key&&s.target.click()},this.options={passwordField:".t3js-login-password-field",usernameField:".t3js-login-username-field",copyrightLink:"t3js-login-copyright-link"},Login.options.submitHandler=this.resetPassword;const s=$(this.options.usernameField),e=$(this.options.passwordField),o=document.getElementsByClassName(this.options.copyrightLink)[0];s.on("keypress",this.showCapsLockWarning),e.on("keypress",this.showCapsLockWarning),o.addEventListener("keydown",this.toggleCopyright);try{parent.opener&&parent.opener.TYPO3&&parent.opener.TYPO3.configuration&&parent.opener.TYPO3.configuration.username&&s.val(parent.opener.TYPO3.configuration.username)}catch(s){}""===s.val()?s.focus():e.focus()}static isCapslockEnabled(s){const e=s||window.event;if(!e)return!1;let o=-1;e.which?o=e.which:e.keyCode&&(o=e.keyCode);let i=!1;return e.shiftKey?i=e.shiftKey:e.modifiers&&(i=!!(4&e.modifiers)),o>=65&&o<=90&&!i||o>=97&&o<=122&&i}}export default new UserPassLogin; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Utility.js b/typo3/sysext/backend/Resources/Public/JavaScript/utility.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Utility.js rename to typo3/sysext/backend/Resources/Public/JavaScript/utility.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Utility/MessageUtility.js b/typo3/sysext/backend/Resources/Public/JavaScript/utility/message-utility.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Utility/MessageUtility.js rename to typo3/sysext/backend/Resources/Public/JavaScript/utility/message-utility.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Utility/TopLevelModuleImport.js b/typo3/sysext/backend/Resources/Public/JavaScript/utility/top-level-module-import.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/Utility/TopLevelModuleImport.js rename to typo3/sysext/backend/Resources/Public/JavaScript/utility/top-level-module-import.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/viewport.js b/typo3/sysext/backend/Resources/Public/JavaScript/viewport.js new file mode 100644 index 0000000000000000000000000000000000000000..fdca3adba14e65b102f247e57eb9999010feadbe --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/viewport.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import ContentContainer from"@typo3/backend/viewport/content-container.js";import ConsumerScope from"@typo3/backend/event/consumer-scope.js";import Loader from"@typo3/backend/viewport/loader.js";import NavigationContainer from"@typo3/backend/viewport/navigation-container.js";import Topbar from"@typo3/backend/viewport/topbar.js";class Viewport{constructor(){this.Loader=Loader,this.NavigationContainer=null,this.ContentContainer=null,this.consumerScope=ConsumerScope,this.Topbar=new Topbar,this.NavigationContainer=new NavigationContainer(this.consumerScope),this.ContentContainer=new ContentContainer(this.consumerScope)}}let viewportObject;top.TYPO3.Backend?viewportObject=top.TYPO3.Backend:(viewportObject=new Viewport,top.TYPO3.Backend=viewportObject);export default viewportObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/viewport/abstract-container.js b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/abstract-container.js new file mode 100644 index 0000000000000000000000000000000000000000..83cd4d573093eaa9697b5388e383e3a6cabf4747 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/abstract-container.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import ConsumerScope from"@typo3/backend/event/consumer-scope.js";export class AbstractContainer{constructor(o){this.consumerScope=ConsumerScope,this.consumerScope=o}} \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/viewport/content-container.js b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/content-container.js new file mode 100644 index 0000000000000000000000000000000000000000..4fd7a8cb3ed3814de2e6de387503f56a614b5658 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/content-container.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{ScaffoldIdentifierEnum}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import{AbstractContainer}from"@typo3/backend/viewport/abstract-container.js";import $ from"jquery";import ClientRequest from"@typo3/backend/event/client-request.js";import InteractionRequest from"@typo3/backend/event/interaction-request.js";import Loader from"@typo3/backend/viewport/loader.js";import Utility from"@typo3/backend/utility.js";import TriggerRequest from"@typo3/backend/event/trigger-request.js";class ContentContainer extends AbstractContainer{get(){return $(ScaffoldIdentifierEnum.contentModuleIframe)[0].contentWindow}beforeSetUrl(e){return this.consumerScope.invoke(new TriggerRequest("typo3.beforeSetUrl",e))}setUrl(e,t,r){let n;const o=this.resolveRouterElement();return null===o?(n=$.Deferred(),n.reject(),n):(t instanceof InteractionRequest||(t=new ClientRequest("typo3.setUrl",null)),n=this.consumerScope.invoke(new TriggerRequest("typo3.setUrl",t)),n.then(()=>{Loader.start(),o.setAttribute("endpoint",e),o.setAttribute("module",r||null),o.parentElement.addEventListener("typo3-module-loaded",()=>Loader.finish(),{once:!0})}),n)}getUrl(){return this.resolveRouterElement().getAttribute("endpoint")}refresh(e){let t;const r=this.resolveIFrameElement();return null===r?(t=$.Deferred(),t.reject(),t):(t=this.consumerScope.invoke(new TriggerRequest("typo3.refresh",e)),t.then(()=>{r.contentWindow.location.reload()}),t)}getIdFromUrl(){return this.getUrl?parseInt(Utility.getParameterFromUrl(this.getUrl(),"id"),10):0}resolveIFrameElement(){const e=$(ScaffoldIdentifierEnum.contentModuleIframe+":first");return 0===e.length?null:e.get(0)}resolveRouterElement(){return document.querySelector(ScaffoldIdentifierEnum.contentModuleRouter)}}export default ContentContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/viewport/loader.js b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/loader.js new file mode 100644 index 0000000000000000000000000000000000000000..a708969427a79915b319d0770656609c9f8676c8 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/loader.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{ScaffoldIdentifierEnum}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import NProgress from"nprogress";class Loader{static start(){NProgress.configure({parent:ScaffoldIdentifierEnum.contentModule,showSpinner:!1}),NProgress.start()}static finish(){NProgress.done()}}export default Loader; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/viewport/navigation-container.js b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/navigation-container.js new file mode 100644 index 0000000000000000000000000000000000000000..1b4c41dc742eadc2c630595eb045066fc095327e --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/navigation-container.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{ScaffoldIdentifierEnum}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import{AbstractContainer}from"@typo3/backend/viewport/abstract-container.js";import TriggerRequest from"@typo3/backend/event/trigger-request.js";class NavigationContainer extends AbstractContainer{constructor(t){super(t),this.activeComponentId=""}get parent(){return document.querySelector(ScaffoldIdentifierEnum.scaffold)}get container(){return document.querySelector(ScaffoldIdentifierEnum.contentNavigation)}get switcher(){return document.querySelector(ScaffoldIdentifierEnum.contentNavigationSwitcher)}showComponent(t){const e=this.container;if(this.show(t),t===this.activeComponentId)return;if(""!==this.activeComponentId){let t=e.querySelector("#navigationComponent-"+this.activeComponentId.replace(/[/@]/g,"_"));t&&(t.style.display="none")}const n="navigationComponent-"+t.replace(/[/@]/g,"_");if(1===e.querySelectorAll('[data-component="'+t+'"]').length)return this.show(t),void(this.activeComponentId=t);import(t+".js").then(o=>{if("string"==typeof o.navigationComponentName){const i=o.navigationComponentName,a=document.createElement(i);a.setAttribute("id",n),a.classList.add("scaffold-content-navigation-component"),a.dataset.component=t,e.append(a)}else{e.insertAdjacentHTML("beforeend",'<div class="scaffold-content-navigation-component" data-component="'+t+'" id="'+n+'"></div>');Object.values(o)[0].initialize("#"+n)}this.show(t),this.activeComponentId=t})}hide(t){const e=this.parent,n=this.switcher;e.classList.remove("scaffold-content-navigation-expanded"),e.classList.remove("scaffold-content-navigation-available"),t&&n&&(n.style.display="none")}show(t){const e=this.parent,n=this.container,o=this.switcher;if(n.querySelectorAll(ScaffoldIdentifierEnum.contentNavigationDataComponent).forEach(t=>t.style.display="none"),void 0!==typeof t){e.classList.add("scaffold-content-navigation-expanded"),e.classList.add("scaffold-content-navigation-available");const o=n.querySelector('[data-component="'+t+'"]');o&&(o.style.display=null)}o&&(o.style.display=null)}setUrl(t,e){const n=this.consumerScope.invoke(new TriggerRequest("typo3.setUrl",e));return n.then(()=>{this.parent.classList.add("scaffold-content-navigation-expanded")}),n}}export default NavigationContainer; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/ResizableNavigation.js b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/resizable-navigation.js similarity index 54% rename from typo3/sysext/backend/Resources/Public/JavaScript/Viewport/ResizableNavigation.js rename to typo3/sysext/backend/Resources/Public/JavaScript/viewport/resizable-navigation.js index 804c8267aed37b32bb7225751f57108979e9ea5b..338eb9bc42f7edab4d292020741b9f92281ae501 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Viewport/ResizableNavigation.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/resizable-navigation.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(t,e,i,n){var o,a=arguments.length,s=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(s=(a<3?o(s):a>3?o(e,i,s):o(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};import{html,LitElement}from"lit";import{customElement,property,state}from"lit/decorators.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";import Persistent from"TYPO3/CMS/Backend/Storage/Persistent.js";import"TYPO3/CMS/Backend/Element/IconElement.js";const selectorConverter={fromAttribute:t=>document.querySelector(t)};let ResizableNavigation=class extends LitElement{constructor(){super(...arguments),this.minimumWidth=250,this.resizing=!1,this.toggleNavigation=t=>{t instanceof MouseEvent&&2===t.button||(t.stopPropagation(),this.parentContainer.classList.toggle("scaffold-content-navigation-expanded"))},this.fallbackNavigationSizeIfNeeded=t=>{let e=t.currentTarget;0!==this.getNavigationWidth()&&e.outerWidth<this.getNavigationWidth()+this.getNavigationPosition().left+this.minimumWidth&&this.autoNavigationWidth()},this.handleMouseMove=t=>{this.resizeNavigation(t.clientX)},this.handleTouchMove=t=>{this.resizeNavigation(t.changedTouches[0].clientX)},this.resizeNavigation=t=>{let e=Math.round(t)-Math.round(this.getNavigationPosition().left);this.setNavigationWidth(e)},this.startResizeNavigation=t=>{t instanceof MouseEvent&&2===t.button||(t.stopPropagation(),this.resizing=!0,document.addEventListener("mousemove",this.handleMouseMove,!1),document.addEventListener("mouseup",this.stopResizeNavigation,!1),document.addEventListener("touchmove",this.handleTouchMove,!1),document.addEventListener("touchend",this.stopResizeNavigation,!1))},this.stopResizeNavigation=()=>{this.resizing=!1,document.removeEventListener("mousemove",this.handleMouseMove,!1),document.removeEventListener("mouseup",this.stopResizeNavigation,!1),document.removeEventListener("touchmove",this.handleTouchMove,!1),document.removeEventListener("touchend",this.stopResizeNavigation,!1),Persistent.set(this.persistenceIdentifier,this.getNavigationWidth()),document.dispatchEvent(new CustomEvent("typo3:navigation:resized"))}}connectedCallback(){super.connectedCallback();const t=this.initialWidth||parseInt(Persistent.get(this.persistenceIdentifier),10);this.setNavigationWidth(t),window.addEventListener("resize",this.fallbackNavigationSizeIfNeeded,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.fallbackNavigationSizeIfNeeded)}createRenderRoot(){return this}async firstUpdated(){await new Promise(t=>setTimeout(t,0)),this.querySelector(".scaffold-content-navigation-switcher-btn").addEventListener("touchstart",this.toggleNavigation,{passive:!0}),this.querySelector(".scaffold-content-navigation-drag").addEventListener("touchstart",this.startResizeNavigation,{passive:!0})}render(){return html` +var __decorate=function(t,e,i,n){var o,a=arguments.length,s=a<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var r=t.length-1;r>=0;r--)(o=t[r])&&(s=(a<3?o(s):a>3?o(e,i,s):o(e,i))||s);return a>3&&s&&Object.defineProperty(e,i,s),s};import{html,LitElement}from"lit";import{customElement,property,state}from"lit/decorators.js";import{lll}from"@typo3/core/lit-helper.js";import Persistent from"@typo3/backend/storage/persistent.js";import"@typo3/backend/element/icon-element.js";const selectorConverter={fromAttribute:t=>document.querySelector(t)};let ResizableNavigation=class extends LitElement{constructor(){super(...arguments),this.minimumWidth=250,this.resizing=!1,this.toggleNavigation=t=>{t instanceof MouseEvent&&2===t.button||(t.stopPropagation(),this.parentContainer.classList.toggle("scaffold-content-navigation-expanded"))},this.fallbackNavigationSizeIfNeeded=t=>{let e=t.currentTarget;0!==this.getNavigationWidth()&&e.outerWidth<this.getNavigationWidth()+this.getNavigationPosition().left+this.minimumWidth&&this.autoNavigationWidth()},this.handleMouseMove=t=>{this.resizeNavigation(t.clientX)},this.handleTouchMove=t=>{this.resizeNavigation(t.changedTouches[0].clientX)},this.resizeNavigation=t=>{let e=Math.round(t)-Math.round(this.getNavigationPosition().left);this.setNavigationWidth(e)},this.startResizeNavigation=t=>{t instanceof MouseEvent&&2===t.button||(t.stopPropagation(),this.resizing=!0,document.addEventListener("mousemove",this.handleMouseMove,!1),document.addEventListener("mouseup",this.stopResizeNavigation,!1),document.addEventListener("touchmove",this.handleTouchMove,!1),document.addEventListener("touchend",this.stopResizeNavigation,!1))},this.stopResizeNavigation=()=>{this.resizing=!1,document.removeEventListener("mousemove",this.handleMouseMove,!1),document.removeEventListener("mouseup",this.stopResizeNavigation,!1),document.removeEventListener("touchmove",this.handleTouchMove,!1),document.removeEventListener("touchend",this.stopResizeNavigation,!1),Persistent.set(this.persistenceIdentifier,this.getNavigationWidth()),document.dispatchEvent(new CustomEvent("typo3:navigation:resized"))}}connectedCallback(){super.connectedCallback();const t=this.initialWidth||parseInt(Persistent.get(this.persistenceIdentifier),10);this.setNavigationWidth(t),window.addEventListener("resize",this.fallbackNavigationSizeIfNeeded,{passive:!0})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.fallbackNavigationSizeIfNeeded)}createRenderRoot(){return this}async firstUpdated(){await new Promise(t=>setTimeout(t,0)),this.querySelector(".scaffold-content-navigation-switcher-btn").addEventListener("touchstart",this.toggleNavigation,{passive:!0}),this.querySelector(".scaffold-content-navigation-drag").addEventListener("touchstart",this.startResizeNavigation,{passive:!0})}render(){return html` <div class="scaffold-content-navigation-switcher"> <button @mouseup="${this.toggleNavigation}" class="btn btn-default btn-borderless scaffold-content-navigation-switcher-btn scaffold-content-navigation-switcher-open" role="button" title="${lll("viewport_navigation_show")}"> <typo3-backend-icon identifier="actions-chevron-right" size="small"></typo3-backend-icon> diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Storage/BrowserSession.js b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/toolbar.js similarity index 64% rename from typo3/sysext/backend/Resources/Public/JavaScript/Storage/BrowserSession.js rename to typo3/sysext/backend/Resources/Public/JavaScript/viewport/toolbar.js index 35846657c6fc3b6dda2e16639588954750421ab9..79d20a241d31e3f72ec0fe7b9dd697333d753294 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Storage/BrowserSession.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/toolbar.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -import AbstractClientStorage from"TYPO3/CMS/Backend/Storage/AbstractClientStorage.js";class BrowserSession extends AbstractClientStorage{constructor(){super(),this.storage=sessionStorage}}export default new BrowserSession; \ No newline at end of file +import{ScaffoldIdentifierEnum}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import $ from"jquery";class Toolbar{registerEvent(e){$(e),$(ScaffoldIdentifierEnum.header).on("t3-topbar-update",e)}}export default Toolbar; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/viewport/topbar.js b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/topbar.js new file mode 100644 index 0000000000000000000000000000000000000000..b707afe36182cb15a09287e28e16c99078db0fb7 --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/viewport/topbar.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{ScaffoldIdentifierEnum}from"@typo3/backend/enum/viewport/scaffold-identifier.js";import Toolbar from"@typo3/backend/viewport/toolbar.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";class Topbar{constructor(){this.Toolbar=new Toolbar}refresh(){new AjaxRequest(TYPO3.settings.ajaxUrls.topbar).get().then(async e=>{const o=await e.resolve(),r=document.querySelector(Topbar.topbarSelector);null!==r&&(r.innerHTML=o.topbar,r.dispatchEvent(new Event("t3-topbar-update")))})}}Topbar.topbarSelector=ScaffoldIdentifierEnum.header;export default Topbar; \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/WindowManager.js b/typo3/sysext/backend/Resources/Public/JavaScript/window-manager.js similarity index 100% rename from typo3/sysext/backend/Resources/Public/JavaScript/WindowManager.js rename to typo3/sysext/backend/Resources/Public/JavaScript/window-manager.js diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/wizard.js b/typo3/sysext/backend/Resources/Public/JavaScript/wizard.js new file mode 100644 index 0000000000000000000000000000000000000000..7949e1c681d9e2b951ba744d0050aa88a2a09d1f --- /dev/null +++ b/typo3/sysext/backend/Resources/Public/JavaScript/wizard.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{SeverityEnum}from"@typo3/backend/enum/severity.js";import $ from"jquery";import Modal from"@typo3/backend/modal.js";import Severity from"@typo3/backend/severity.js";import Icons from"@typo3/backend/icons.js";class Wizard{constructor(){this.setup={slides:[],settings:{},forceSelection:!0,$carousel:null},this.originalSetup=$.extend(!0,{},this.setup)}set(e,t){return this.setup.settings[e]=t,this}addSlide(e,t,s="",i=SeverityEnum.info,r){const a={identifier:e,title:t,content:s,severity:i,callback:r};return this.setup.slides.push(a),this}addFinalProcessingSlide(e){return e||(e=()=>{this.dismiss()}),Icons.getIcon("spinner-circle-dark",Icons.sizes.large,null,null).then(t=>{let s=$("<div />",{class:"text-center"}).append(t);this.addSlide("final-processing-slide",top.TYPO3.lang["wizard.processing.title"],s[0].outerHTML,Severity.info,e)})}show(){let e=this.generateSlides(),t=this.setup.slides[0];Modal.confirm(t.title,e,t.severity,[{text:top.TYPO3.lang["wizard.button.cancel"],active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{this.getComponent().trigger("wizard-dismiss")}},{text:top.TYPO3.lang["wizard.button.next"],btnClass:"btn-"+Severity.getCssClass(t.severity),name:"next"}]),this.setup.forceSelection&&this.lockNextStep(),this.addProgressBar(),this.initializeEvents(),this.getComponent().on("wizard-visible",()=>{this.runSlideCallback(t,this.setup.$carousel.find(".carousel-item").first())}).on("wizard-dismissed",()=>{this.setup=$.extend(!0,{},this.originalSetup)})}getComponent(){return null===this.setup.$carousel&&this.generateSlides(),this.setup.$carousel}dismiss(){Modal.dismiss()}lockNextStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="next"]');return e.prop("disabled",!0),e}unlockNextStep(){let e=this.setup.$carousel.closest(".modal").find('button[name="next"]');return e.prop("disabled",!1),e}setForceSelection(e){this.setup.forceSelection=e}initializeEvents(){let e=this.setup.$carousel.closest(".modal"),t=e.find(".modal-title"),s=e.find(".modal-footer"),i=s.find('button[name="next"]');i.on("click",()=>{this.setup.$carousel.carousel("next")}),this.setup.$carousel.on("slide.bs.carousel",()=>{let r=this.setup.$carousel.data("currentSlide")+1,a=this.setup.$carousel.data("currentIndex")+1;t.text(this.setup.slides[a].title),this.setup.$carousel.data("currentSlide",r),this.setup.$carousel.data("currentIndex",a),r>=this.setup.$carousel.data("realSlideCount")?(e.find(".modal-header .close").remove(),s.slideUp()):s.find(".progress-bar").width(this.setup.$carousel.data("initialStep")*r+"%").text(top.TYPO3.lang["wizard.progress"].replace("{0}",r).replace("{1}",this.setup.$carousel.data("slideCount"))),i.removeClass("btn-"+Severity.getCssClass(this.setup.slides[a-1].severity)).addClass("btn-"+Severity.getCssClass(this.setup.slides[a].severity)),e.removeClass("modal-severity-"+Severity.getCssClass(this.setup.slides[a-1].severity)).addClass("modal-severity-"+Severity.getCssClass(this.setup.slides[a].severity))}).on("slid.bs.carousel",e=>{let t=this.setup.$carousel.data("currentIndex"),s=this.setup.slides[t];this.runSlideCallback(s,$(e.relatedTarget)),this.setup.forceSelection&&this.lockNextStep()});let r=this.getComponent();r.on("wizard-dismiss",this.dismiss),Modal.currentModal.on("hidden.bs.modal",()=>{r.trigger("wizard-dismissed")}).on("shown.bs.modal",()=>{r.trigger("wizard-visible")})}runSlideCallback(e,t){"function"==typeof e.callback&&e.callback(t,this.setup.settings,e.identifier)}addProgressBar(){let e,t=this.setup.$carousel.find(".carousel-item").length,s=Math.max(1,t),i=this.setup.$carousel.closest(".modal").find(".modal-footer");e=Math.round(100/s),this.setup.$carousel.data("initialStep",e).data("slideCount",s).data("realSlideCount",t).data("currentIndex",0).data("currentSlide",1),s>1&&i.prepend($("<div />",{class:"progress"}).append($("<div />",{role:"progressbar",class:"progress-bar","aria-valuemin":0,"aria-valuenow":e,"aria-valuemax":100}).width(e+"%").text(top.TYPO3.lang["wizard.progress"].replace("{0}","1").replace("{1}",s))))}generateSlides(){if(null!==this.setup.$carousel)return this.setup.$carousel;let e='<div class="carousel slide" data-bs-ride="carousel" data-bs-interval="false"><div class="carousel-inner" role="listbox">';for(let t of Object.values(this.setup.slides)){let s=t.content;"object"==typeof s&&(s=s.html()),e+='<div class="carousel-item" data-bs-slide="'+t.identifier+'">'+s+"</div>"}return e+="</div></div>",this.setup.$carousel=$(e),this.setup.$carousel.find(".carousel-item").first().addClass("active"),this.setup.$carousel}}let wizardObject;try{window.opener&&window.opener.TYPO3&&window.opener.TYPO3.Wizard&&(wizardObject=window.opener.TYPO3.Wizard),parent&&parent.window.TYPO3&&parent.window.TYPO3.Wizard&&(wizardObject=parent.window.TYPO3.Wizard),top&&top.TYPO3&&top.TYPO3.Wizard&&(wizardObject=top.TYPO3.Wizard)}catch{}wizardObject||(wizardObject=new Wizard,"undefined"!=typeof TYPO3&&(TYPO3.Wizard=wizardObject));export default wizardObject; \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/Functional/Form/MfaInfoElementTest.php b/typo3/sysext/backend/Tests/Functional/Form/MfaInfoElementTest.php index df6d415b7486fc2ea9ffea3d100cb66658fc0f86..7589df96cc20d8497262f17401d4dc7d75759bfb 100644 --- a/typo3/sysext/backend/Tests/Functional/Form/MfaInfoElementTest.php +++ b/typo3/sysext/backend/Tests/Functional/Form/MfaInfoElementTest.php @@ -137,7 +137,7 @@ class MfaInfoElementTest extends FunctionalTestCase self::assertMatchesRegularExpression('/<button.*class="t3js-deactivate-mfa-button btn btn-danger "/s', $result['html']); // JavaScript is added self::assertInstanceOf(JavaScriptModuleInstruction::class, $result['requireJsModules'][0]); - self::assertSame('TYPO3/CMS/Backend/FormEngine/Element/MfaInfoElement.js', $result['requireJsModules'][0]->getName()); + self::assertSame('@typo3/backend/form-engine/element/mfa-info-element.js', $result['requireJsModules'][0]->getName()); } /** @@ -170,7 +170,7 @@ class MfaInfoElementTest extends FunctionalTestCase self::assertMatchesRegularExpression('/<button.*class="t3js-deactivate-mfa-button btn btn-danger "/s', $result['html']); // JavaScript is added self::assertInstanceOf(JavaScriptModuleInstruction::class, $result['requireJsModules'][0]); - self::assertSame('TYPO3/CMS/Backend/FormEngine/Element/MfaInfoElement.js', $result['requireJsModules'][0]->getName()); + self::assertSame('@typo3/backend/form-engine/element/mfa-info-element.js', $result['requireJsModules'][0]->getName()); } /** diff --git a/typo3/sysext/backend/Tests/JavaScript/BackendExceptionTest.js b/typo3/sysext/backend/Tests/JavaScript/BackendExceptionTest.js deleted file mode 100644 index 4f264a897e900e508d08ee1414ee8472b41f42cb..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/JavaScript/BackendExceptionTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{BackendException}from"TYPO3/CMS/Backend/BackendException.js";describe("TYPO3/CMS/Backend/BackendException",()=>{it("sets exception message",()=>{const e=new BackendException("some message");expect(e.message).toBe("some message")}),it("sets exception code",()=>{const e=new BackendException("",12345);expect(e.code).toBe(12345)})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/Element/ImmediateActionElementTest.js b/typo3/sysext/backend/Tests/JavaScript/Element/ImmediateActionElementTest.js deleted file mode 100644 index 45e68af1a6e5effa4beb073e8cf8283ac56238f6..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/JavaScript/Element/ImmediateActionElementTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{ImmediateActionElement}from"TYPO3/CMS/Backend/Element/ImmediateActionElement.js";import moduleMenuApp from"TYPO3/CMS/Backend/ModuleMenu.js";import viewportObject from"TYPO3/CMS/Backend/Viewport.js";describe("TYPO3/CMS/Backend/Element/ImmediateActionElement:",()=>{let e;beforeEach(()=>{e=document.createElement("div"),document.body.appendChild(e)}),afterEach(()=>{e.remove(),e=null}),it("dispatches action when created via constructor",async()=>{const t=viewportObject.Topbar,n={refresh:()=>{}};spyOn(n,"refresh").and.callThrough(),viewportObject.Topbar=n;const a=new ImmediateActionElement;a.setAttribute("action","TYPO3.Backend.Topbar.refresh"),expect(n.refresh).not.toHaveBeenCalled(),e.appendChild(a),await import("TYPO3/CMS/Backend/Viewport.js"),await new Promise(e=>setTimeout(e,100)),expect(n.refresh).toHaveBeenCalled(),viewportObject.Topbar=t}),it("dispatches action when created via createElement",async()=>{const t=viewportObject.Topbar,n={refresh:()=>{}};spyOn(n,"refresh").and.callThrough(),viewportObject.Topbar=n;const a=document.createElement("typo3-immediate-action");a.setAttribute("action","TYPO3.Backend.Topbar.refresh"),expect(n.refresh).not.toHaveBeenCalled(),e.appendChild(a),await import("TYPO3/CMS/Backend/Viewport.js"),await new Promise(e=>setTimeout(e,100)),expect(n.refresh).toHaveBeenCalled(),viewportObject.Topbar=t}),it("dispatches action when created from string",async()=>{const t=moduleMenuApp.App,n={refreshMenu:()=>{}};spyOn(n,"refreshMenu").and.callThrough(),moduleMenuApp.App=n;const a=document.createRange().createContextualFragment('<typo3-immediate-action action="TYPO3.ModuleMenu.App.refreshMenu"></typo3-immediate-action>').querySelector("typo3-immediate-action");expect(n.refreshMenu).not.toHaveBeenCalled(),e.appendChild(a),await import("TYPO3/CMS/Backend/ModuleMenu.js"),await new Promise(e=>setTimeout(e,100)),expect(n.refreshMenu).toHaveBeenCalled(),viewportObject.App=t}),it("dispatches action when created via innerHTML",async()=>{const t=moduleMenuApp.App,n={refreshMenu:()=>{}};spyOn(n,"refreshMenu").and.callThrough(),moduleMenuApp.App=n,e.innerHTML='<typo3-immediate-action action="TYPO3.ModuleMenu.App.refreshMenu"></typo3-immediate-action>',await import("TYPO3/CMS/Backend/ModuleMenu.js"),await new Promise(e=>setTimeout(e,100)),expect(n.refreshMenu).toHaveBeenCalled(),moduleMenuApp.App=t})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/FormEngineValidationTest.js b/typo3/sysext/backend/Tests/JavaScript/FormEngineValidationTest.js deleted file mode 100644 index 9e290425af2b3ecf72c1600d50844b704dc25fd9..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/JavaScript/FormEngineValidationTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import FormEngineValidation from"TYPO3/CMS/Backend/FormEngineValidation.js";describe("TYPO3/CMS/Backend/FormEngineValidationTest:",()=>{const e=[{description:"works for type date",type:"date",value:0,config:{},result:""},{description:"works for type date with timestamp",type:"date",value:1e7,config:{},result:"26-04-1970"},{description:"works for type date with iso date",type:"date",value:"2016-12-02T11:16:06+00:00",config:{},result:"02-12-2016"},{description:"works for type datetime",type:"datetime",value:0,config:{},result:""},{description:"works for type datetime with timestamp",type:"datetime",value:1e7,config:{},result:"17:46 26-04-1970"},{description:"works for type datetime with iso date",type:"datetime",value:"2016-12-02T11:16:06+00:00",config:{},result:"11:16 02-12-2016"},{description:"resolves to empty result for zero value",type:"datetime",value:0,config:{},result:""},{description:"resolves to empty result for invalid value",type:"datetime",value:"invalid",config:{},result:""},{description:"works for type time",type:"time",value:0,config:{},result:"00:00"},{description:"works for type time with timestamp",type:"time",value:1e7,config:{},result:"17:46"},{description:"works for type time with iso date",type:"time",value:"2016-12-02T11:16:06+00:00",config:{},result:"11:16"}];describe("tests for formatValue",()=>{using(e,(function(e){it(e.description,()=>{FormEngineValidation.initialize();const t=FormEngineValidation.formatValue(e.type,e.value,e.config);expect(t).toBe(e.result)})}))});const t=[{description:"works for command alpha with numeric value",command:"alpha",value:"1234",config:{},result:""},{description:"works for command alpha with string value",command:"alpha",value:"abc",config:{},result:"abc"},{description:"works for command alpha with alphanum input",command:"alpha",value:"abc123",config:{},result:"abc"},{description:"works for command alpha with alphanum input",command:"alpha",value:"123abc123",config:{},result:"abc"}];describe("test for processValue",()=>{using(t,(function(e){it(e.description,()=>{const t=FormEngineValidation.processValue(e.command,e.value,e.config);expect(t).toBe(e.result)})}))}),xdescribe("tests for validateField",()=>{}),describe("tests for trimExplode",()=>{it("works for comma as separator and list without spaces",()=>{expect(FormEngineValidation.trimExplode(",","foo,bar,baz")).toEqual(["foo","bar","baz"])}),it("works for comma as separator and list with spaces",()=>{expect(FormEngineValidation.trimExplode(","," foo , bar , baz ")).toEqual(["foo","bar","baz"])}),it("works for pipe as separator and list with spaces",()=>{expect(FormEngineValidation.trimExplode("|"," foo | bar | baz ")).toEqual(["foo","bar","baz"])})}),describe("tests for parseInt",()=>{it("works for value 0",()=>{expect(FormEngineValidation.parseInt(0)).toBe(0)}),it("works for value 1",()=>{expect(FormEngineValidation.parseInt(1)).toBe(1)}),it("works for value -1",()=>{expect(FormEngineValidation.parseInt(-1)).toBe(-1)}),it('works for value "0"',()=>{expect(FormEngineValidation.parseInt("0")).toBe(0)}),it('works for value "1"',()=>{expect(FormEngineValidation.parseInt("1")).toBe(1)}),it('works for value "-1"',()=>{expect(FormEngineValidation.parseInt("-1")).toBe(-1)}),it("works for value 0.5",()=>{expect(FormEngineValidation.parseInt(.5)).toBe(0)}),it('works for value "0.5"',()=>{expect(FormEngineValidation.parseInt("0.5")).toBe(0)}),it('works for value "foo"',()=>{expect(FormEngineValidation.parseInt("foo")).toBe(0)}),it("works for value true",()=>{expect(FormEngineValidation.parseInt(!0)).toBe(0)}),it("works for value false",()=>{expect(FormEngineValidation.parseInt(!1)).toBe(0)}),it("works for value null",()=>{expect(FormEngineValidation.parseInt(null)).toBe(0)})}),describe("tests for parseDouble",()=>{it("works for value 0",()=>{expect(FormEngineValidation.parseDouble(0)).toBe("0.00")}),it("works for value 1",()=>{expect(FormEngineValidation.parseDouble(1)).toBe("1.00")}),it("works for value -1",()=>{expect(FormEngineValidation.parseDouble(-1)).toBe("-1.00")}),it('works for value "0"',()=>{expect(FormEngineValidation.parseDouble("0")).toBe("0.00")}),it('works for value "1"',()=>{expect(FormEngineValidation.parseDouble("1")).toBe("1.00")}),it('works for value "-1"',()=>{expect(FormEngineValidation.parseDouble("-1")).toBe("-1.00")}),it("works for value 0.5",()=>{expect(FormEngineValidation.parseDouble(.5)).toBe("0.50")}),it('works for value "0.5"',()=>{expect(FormEngineValidation.parseDouble("0.5")).toBe("0.50")}),it('works for value "foo"',()=>{expect(FormEngineValidation.parseDouble("foo")).toBe("0.00")}),it("works for value true",()=>{expect(FormEngineValidation.parseDouble(!0)).toBe("0.00")}),it("works for value false",()=>{expect(FormEngineValidation.parseDouble(!1)).toBe("0.00")}),it("works for value null",()=>{expect(FormEngineValidation.parseDouble(null)).toBe("0.00")})}),describe("tests for btrim",()=>{const e=FormEngineValidation.btrim(" test ");it("works for string with whitespace in begin and end",()=>{expect(e).toBe(" test")})}),describe("tests for ltrim",()=>{const e=FormEngineValidation.ltrim(" test ");it("works for string with whitespace in begin and end",()=>{expect(e).toBe("test ")})}),xdescribe("tests for parseDateTime",()=>{}),xdescribe("tests for parseDate",()=>{}),xdescribe("tests for parseTime",()=>{}),xdescribe("tests for parseYear",()=>{}),describe("tests for getYear",()=>{const e=new Date;afterEach(()=>{jasmine.clock().mockDate(e)}),it("works for current date",()=>{const e=new Date;expect(FormEngineValidation.getYear(e)).toBe(e.getFullYear())}),it("works for year 2013",()=>{const e=new Date(2013,9,23);jasmine.clock().mockDate(e),expect(FormEngineValidation.getYear(e)).toBe(2013)})}),describe("tests for getDate",()=>{const e=new Date;afterEach(()=>{jasmine.clock().mockDate(e)}),xit("works for year 2013",()=>{const e=new Date(2013,9,23,13,13,13);jasmine.clock().mockDate(e),expect(FormEngineValidation.getDate(e)).toBe(1382479200)})}),describe("tests for splitStr",()=>{it("works for command and index",()=>{expect(FormEngineValidation.splitStr("foo,bar,baz",",",-1)).toBe("foo"),expect(FormEngineValidation.splitStr("foo,bar,baz",",",0)).toBe("foo"),expect(FormEngineValidation.splitStr("foo,bar,baz",",",1)).toBe("foo"),expect(FormEngineValidation.splitStr("foo,bar,baz",",",2)).toBe("bar"),expect(FormEngineValidation.splitStr("foo,bar,baz",",",3)).toBe("baz"),expect(FormEngineValidation.splitStr(" foo , bar , baz ",",",1)).toBe(" foo "),expect(FormEngineValidation.splitStr(" foo , bar , baz ",",",2)).toBe(" bar "),expect(FormEngineValidation.splitStr(" foo , bar , baz ",",",3)).toBe(" baz ")})}),xdescribe("tests for split",()=>{})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/GridEditorTest.js b/typo3/sysext/backend/Tests/JavaScript/GridEditorTest.js deleted file mode 100644 index c500ad9e568a83c23ef107bb01497e68093917cb..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/JavaScript/GridEditorTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{GridEditor}from"TYPO3/CMS/Backend/GridEditor.js";describe("TYPO3/CMS/Backend/GridEditorTest:",()=>{describe("tests for stripMarkup",()=>{it("works with string which contains html markup only",()=>{expect(GridEditor.stripMarkup("<b>'formula': \"x > y\"</b>")).toBe("'formula': \"x > y\"")}),it("works with string which contains html markup and normal text",()=>{expect(GridEditor.stripMarkup("<b>foo</b> bar")).toBe("foo bar")})})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/Hashing/Md5Test.js b/typo3/sysext/backend/Tests/JavaScript/Hashing/Md5Test.js deleted file mode 100644 index 3e23aa3bb1942de11df39a1b3b3caae7496156e3..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/JavaScript/Hashing/Md5Test.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Md5 from"TYPO3/CMS/Backend/Hashing/Md5.js";describe("TYPO3/CMS/Backend/Hashing/Md5:",()=>{describe("tests for hash",()=>{it("hashes a value as expected",()=>{expect(Md5.hash("Hello World")).toBe("b10a8db164e0754105b7a99be72e3fe5"),expect(Md5.hash("TYPO3 CMS is an Open Source Enterprise Content Management System with a large global community, backed by the approximately 900 members of the TYPO3 Association.")).toBe("65b0beb76ada01bd7b5f44fb37da6139")})})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/IconsTest.js b/typo3/sysext/backend/Tests/JavaScript/IconsTest.js deleted file mode 100644 index de999cbc001706de7883c083c80812165e229d3e..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/JavaScript/IconsTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Icons from"TYPO3/CMS/Backend/Icons.js";describe("TYPO3/CMS/Backend/IconsTest:",()=>{describe("tests for Icons object",()=>{it("has all sizes",()=>{expect(Icons.sizes.small).toBe("small"),expect(Icons.sizes.default).toBe("default"),expect(Icons.sizes.large).toBe("large"),expect(Icons.sizes.overlay).toBe("overlay")}),it("has all states",()=>{expect(Icons.states.default).toBe("default"),expect(Icons.states.disabled).toBe("disabled")}),it("has all markupIdentifiers",()=>{expect(Icons.markupIdentifiers.default).toBe("default"),expect(Icons.markupIdentifiers.inline).toBe("inline")})}),describe("tests for Icons::getIcon",()=>{beforeEach(()=>{spyOn(Icons,"getIcon"),Icons.getIcon("test",Icons.sizes.small,null,Icons.states.default,Icons.markupIdentifiers.default)}),it("tracks that the spy was called",()=>{expect(Icons.getIcon).toHaveBeenCalled()}),it("tracks all the arguments of its calls",()=>{expect(Icons.getIcon).toHaveBeenCalledWith("test",Icons.sizes.small,null,Icons.states.default,Icons.markupIdentifiers.default)}),xit("works get icon from remote server")}),describe("tests for Icons::putInCache",()=>{it("works for simply identifier and markup",()=>{const e=new Promise(e=>e());Icons.putInPromiseCache("foo",e),expect(Icons.getFromPromiseCache("foo")).toBe(e),expect(Icons.isPromiseCached("foo")).toBe(!0)})}),describe("tests for Icons::getFromPromiseCache",()=>{it("return undefined for uncached promise",()=>{expect(Icons.getFromPromiseCache("bar")).not.toBeDefined(),expect(Icons.isPromiseCached("bar")).toBe(!1)})})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/NotificationTest.js b/typo3/sysext/backend/Tests/JavaScript/NotificationTest.js deleted file mode 100644 index bfb24c748c65d7fea1894d92ce2b1255cfb03de2..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/JavaScript/NotificationTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DeferredAction from"TYPO3/CMS/Backend/ActionButton/DeferredAction.js";import ImmediateAction from"TYPO3/CMS/Backend/ActionButton/ImmediateAction.js";import Notification from"TYPO3/CMS/Backend/Notification.js";describe("TYPO3/CMS/Backend/Notification:",()=>{beforeEach(()=>{const e=document.getElementById("alert-container");for(;null!==e&&e.firstChild;)e.removeChild(e.firstChild)}),describe("can render notifications with dismiss after 1000ms",()=>{for(let e of[{method:Notification.notice,title:"Notice message",message:"This notification describes a notice",class:"alert-notice"},{method:Notification.info,title:"Info message",message:"This notification describes an informative action",class:"alert-info"},{method:Notification.success,title:"Success message",message:"This notification describes a successful action",class:"alert-success"},{method:Notification.warning,title:"Warning message",message:"This notification describes a harmful action",class:"alert-warning"},{method:Notification.error,title:"Error message",message:"This notification describes an erroneous action",class:"alert-danger"}])it("can render a notification of type "+e.class,async()=>{e.method(e.title,e.message,1),await document.querySelector("#alert-container typo3-notification-message:last-child").updateComplete;const t="div.alert."+e.class,o=document.querySelector(t);expect(o).not.toBe(null),expect(o.querySelector(".alert-title").textContent).toEqual(e.title),expect(o.querySelector(".alert-message").textContent).toEqual(e.message),await new Promise(e=>window.setTimeout(e,2e3)),expect(document.querySelector(t)).toBe(null)})}),it("can render action buttons",async()=>{Notification.info("Info message","Some text",1,[{label:"My action",action:new ImmediateAction(e=>e)},{label:"My other action",action:new DeferredAction(e=>e)}]),await document.querySelector("#alert-container typo3-notification-message:last-child").updateComplete;const e=document.querySelector("div.alert");expect(e.querySelector(".alert-actions")).not.toBe(null),expect(e.querySelectorAll(".alert-actions a").length).toEqual(2),expect(e.querySelectorAll(".alert-actions a")[0].textContent).toEqual("My action"),expect(e.querySelectorAll(".alert-actions a")[1].textContent).toEqual("My other action")}),it("immediate action is called",async()=>{const e={callback:()=>{}};spyOn(e,"callback").and.callThrough(),Notification.info("Info message","Some text",1,[{label:"My immediate action",action:new ImmediateAction(e.callback)}]),await document.querySelector("#alert-container typo3-notification-message:last-child").updateComplete;document.querySelector("div.alert").querySelector(".alert-actions a").click(),await document.querySelector("#alert-container typo3-notification-message:last-child").updateComplete,expect(e.callback).toHaveBeenCalled()})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/PopoverTest.js b/typo3/sysext/backend/Tests/JavaScript/PopoverTest.js deleted file mode 100644 index ad9cb7a8589e8efbd0848a3152ba800f48fe29c7..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/JavaScript/PopoverTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Popover from"TYPO3/CMS/Backend/Popover.js";describe("TYPO3/CMS/Backend/PopoverTest:",()=>{describe("initialize",()=>{const t=$("body"),e=$('<div data-bs-toggle="popover">');t.append(e),it("works with default selector",()=>{Popover.initialize(),expect(e[0].outerHTML).toBe('<div data-bs-toggle="popover" data-bs-original-title="" title=""></div>')});const o=$('<div data-bs-toggle="popover" data-title="foo">');t.append(o),it("works with default selector and title attribute",()=>{Popover.initialize(),expect(o[0].outerHTML).toBe('<div data-bs-toggle="popover" data-title="foo" data-bs-original-title="" title=""></div>')});const i=$('<div data-bs-toggle="popover" data-bs-content="foo">');t.append(i),it("works with default selector and content attribute",()=>{Popover.initialize(),expect(i[0].outerHTML).toBe('<div data-bs-toggle="popover" data-bs-content="foo" data-bs-original-title="" title=""></div>')});const a=$('<div class="t3js-popover">');t.append(a),it("works with custom selector",()=>{Popover.initialize(".t3js-popover"),expect(a[0].outerHTML).toBe('<div class="t3js-popover" data-bs-original-title="" title=""></div>')})}),describe("call setOptions",()=>{const t=$("body"),e=$('<div class="t3js-test-set-options" data-title="foo-title" data-bs-content="foo-content">');t.append(e),it("can set title",()=>{Popover.initialize(".t3js-test-set-options"),expect(e.attr("data-title")).toBe("foo-title"),expect(e.attr("data-bs-content")).toBe("foo-content"),expect(e.attr("data-bs-original-title")).toBe(""),expect(e.attr("title")).toBe(""),Popover.setOptions(e,{title:"bar-title"}),expect(e.attr("data-title")).toBe("foo-title"),expect(e.attr("data-bs-content")).toBe("foo-content"),expect(e.attr("data-bs-original-title")).toBe("bar-title"),expect(e.attr("title")).toBe("")});const o=$('<div class="t3js-test-set-options2" data-title="foo-title" data-bs-content="foo-content">');t.append(o),it("can set content",()=>{Popover.initialize(".t3js-test-set-options2"),Popover.show(o),expect(o.attr("data-title")).toBe("foo-title"),expect(o.attr("data-bs-content")).toBe("foo-content"),expect(o.attr("data-bs-original-title")).toBe(""),expect(o.attr("title")).toBe(""),Popover.setOptions(o,{content:"bar-content"}),expect(o.attr("data-title")).toBe("foo-title"),expect(o.attr("data-bs-content")).toBe("bar-content"),expect(o.attr("data-bs-original-title")).toBe("foo-title"),expect(o.attr("title")).toBe("")})})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/backend-exception-test.js b/typo3/sysext/backend/Tests/JavaScript/backend-exception-test.js new file mode 100644 index 0000000000000000000000000000000000000000..97877a94307058af829fd0de3d51b8af7f05c41a --- /dev/null +++ b/typo3/sysext/backend/Tests/JavaScript/backend-exception-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{BackendException}from"@typo3/backend/backend-exception.js";describe("@typo3/backend/backend-exception",()=>{it("sets exception message",()=>{const e=new BackendException("some message");expect(e.message).toBe("some message")}),it("sets exception code",()=>{const e=new BackendException("",12345);expect(e.code).toBe(12345)})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/element/immediate-action-element-test.js b/typo3/sysext/backend/Tests/JavaScript/element/immediate-action-element-test.js new file mode 100644 index 0000000000000000000000000000000000000000..87a4737a18b5c8499d65b733531f1f7fc46b31ba --- /dev/null +++ b/typo3/sysext/backend/Tests/JavaScript/element/immediate-action-element-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{ImmediateActionElement}from"@typo3/backend/element/immediate-action-element.js";import moduleMenuApp from"@typo3/backend/module-menu.js";import viewportObject from"@typo3/backend/viewport.js";describe("TYPO3/CMS/Backend/Element/ImmediateActionElement:",()=>{let e;beforeEach(()=>{e=document.createElement("div"),document.body.appendChild(e)}),afterEach(()=>{e.remove(),e=null}),it("dispatches action when created via constructor",async()=>{const t=viewportObject.Topbar,n={refresh:()=>{}};spyOn(n,"refresh").and.callThrough(),viewportObject.Topbar=n;const o=new ImmediateActionElement;o.setAttribute("action","TYPO3.Backend.Topbar.refresh"),expect(n.refresh).not.toHaveBeenCalled(),e.appendChild(o),await import("@typo3/backend/viewport.js"),await new Promise(e=>setTimeout(e,100)),expect(n.refresh).toHaveBeenCalled(),viewportObject.Topbar=t}),it("dispatches action when created via createElement",async()=>{const t=viewportObject.Topbar,n={refresh:()=>{}};spyOn(n,"refresh").and.callThrough(),viewportObject.Topbar=n;const o=document.createElement("typo3-immediate-action");o.setAttribute("action","TYPO3.Backend.Topbar.refresh"),expect(n.refresh).not.toHaveBeenCalled(),e.appendChild(o),await import("@typo3/backend/viewport.js"),await new Promise(e=>setTimeout(e,100)),expect(n.refresh).toHaveBeenCalled(),viewportObject.Topbar=t}),it("dispatches action when created from string",async()=>{const t=moduleMenuApp.App,n={refreshMenu:()=>{}};spyOn(n,"refreshMenu").and.callThrough(),moduleMenuApp.App=n;const o=document.createRange().createContextualFragment('<typo3-immediate-action action="TYPO3.ModuleMenu.App.refreshMenu"></typo3-immediate-action>').querySelector("typo3-immediate-action");expect(n.refreshMenu).not.toHaveBeenCalled(),e.appendChild(o),await import("@typo3/backend/module-menu.js"),await new Promise(e=>setTimeout(e,100)),expect(n.refreshMenu).toHaveBeenCalled(),viewportObject.App=t}),it("dispatches action when created via innerHTML",async()=>{const t=moduleMenuApp.App,n={refreshMenu:()=>{}};spyOn(n,"refreshMenu").and.callThrough(),moduleMenuApp.App=n,e.innerHTML='<typo3-immediate-action action="TYPO3.ModuleMenu.App.refreshMenu"></typo3-immediate-action>',await import("@typo3/backend/module-menu.js"),await new Promise(e=>setTimeout(e,100)),expect(n.refreshMenu).toHaveBeenCalled(),moduleMenuApp.App=t})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/form-engine-validation-test.js b/typo3/sysext/backend/Tests/JavaScript/form-engine-validation-test.js new file mode 100644 index 0000000000000000000000000000000000000000..578f21646eb2523d0ccb509ca76d7d8c3ee29bd1 --- /dev/null +++ b/typo3/sysext/backend/Tests/JavaScript/form-engine-validation-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import FormEngineValidation from"@typo3/backend/form-engine-validation.js";describe("TYPO3/CMS/Backend/FormEngineValidationTest:",()=>{const e=[{description:"works for type date",type:"date",value:0,config:{},result:""},{description:"works for type date with timestamp",type:"date",value:1e7,config:{},result:"26-04-1970"},{description:"works for type date with iso date",type:"date",value:"2016-12-02T11:16:06+00:00",config:{},result:"02-12-2016"},{description:"works for type datetime",type:"datetime",value:0,config:{},result:""},{description:"works for type datetime with timestamp",type:"datetime",value:1e7,config:{},result:"17:46 26-04-1970"},{description:"works for type datetime with iso date",type:"datetime",value:"2016-12-02T11:16:06+00:00",config:{},result:"11:16 02-12-2016"},{description:"resolves to empty result for zero value",type:"datetime",value:0,config:{},result:""},{description:"resolves to empty result for invalid value",type:"datetime",value:"invalid",config:{},result:""},{description:"works for type time",type:"time",value:0,config:{},result:"00:00"},{description:"works for type time with timestamp",type:"time",value:1e7,config:{},result:"17:46"},{description:"works for type time with iso date",type:"time",value:"2016-12-02T11:16:06+00:00",config:{},result:"11:16"}];describe("tests for formatValue",()=>{using(e,(function(e){it(e.description,()=>{FormEngineValidation.initialize();const t=FormEngineValidation.formatValue(e.type,e.value,e.config);expect(t).toBe(e.result)})}))});const t=[{description:"works for command alpha with numeric value",command:"alpha",value:"1234",config:{},result:""},{description:"works for command alpha with string value",command:"alpha",value:"abc",config:{},result:"abc"},{description:"works for command alpha with alphanum input",command:"alpha",value:"abc123",config:{},result:"abc"},{description:"works for command alpha with alphanum input",command:"alpha",value:"123abc123",config:{},result:"abc"}];describe("test for processValue",()=>{using(t,(function(e){it(e.description,()=>{const t=FormEngineValidation.processValue(e.command,e.value,e.config);expect(t).toBe(e.result)})}))}),xdescribe("tests for validateField",()=>{}),describe("tests for trimExplode",()=>{it("works for comma as separator and list without spaces",()=>{expect(FormEngineValidation.trimExplode(",","foo,bar,baz")).toEqual(["foo","bar","baz"])}),it("works for comma as separator and list with spaces",()=>{expect(FormEngineValidation.trimExplode(","," foo , bar , baz ")).toEqual(["foo","bar","baz"])}),it("works for pipe as separator and list with spaces",()=>{expect(FormEngineValidation.trimExplode("|"," foo | bar | baz ")).toEqual(["foo","bar","baz"])})}),describe("tests for parseInt",()=>{it("works for value 0",()=>{expect(FormEngineValidation.parseInt(0)).toBe(0)}),it("works for value 1",()=>{expect(FormEngineValidation.parseInt(1)).toBe(1)}),it("works for value -1",()=>{expect(FormEngineValidation.parseInt(-1)).toBe(-1)}),it('works for value "0"',()=>{expect(FormEngineValidation.parseInt("0")).toBe(0)}),it('works for value "1"',()=>{expect(FormEngineValidation.parseInt("1")).toBe(1)}),it('works for value "-1"',()=>{expect(FormEngineValidation.parseInt("-1")).toBe(-1)}),it("works for value 0.5",()=>{expect(FormEngineValidation.parseInt(.5)).toBe(0)}),it('works for value "0.5"',()=>{expect(FormEngineValidation.parseInt("0.5")).toBe(0)}),it('works for value "foo"',()=>{expect(FormEngineValidation.parseInt("foo")).toBe(0)}),it("works for value true",()=>{expect(FormEngineValidation.parseInt(!0)).toBe(0)}),it("works for value false",()=>{expect(FormEngineValidation.parseInt(!1)).toBe(0)}),it("works for value null",()=>{expect(FormEngineValidation.parseInt(null)).toBe(0)})}),describe("tests for parseDouble",()=>{it("works for value 0",()=>{expect(FormEngineValidation.parseDouble(0)).toBe("0.00")}),it("works for value 1",()=>{expect(FormEngineValidation.parseDouble(1)).toBe("1.00")}),it("works for value -1",()=>{expect(FormEngineValidation.parseDouble(-1)).toBe("-1.00")}),it('works for value "0"',()=>{expect(FormEngineValidation.parseDouble("0")).toBe("0.00")}),it('works for value "1"',()=>{expect(FormEngineValidation.parseDouble("1")).toBe("1.00")}),it('works for value "-1"',()=>{expect(FormEngineValidation.parseDouble("-1")).toBe("-1.00")}),it("works for value 0.5",()=>{expect(FormEngineValidation.parseDouble(.5)).toBe("0.50")}),it('works for value "0.5"',()=>{expect(FormEngineValidation.parseDouble("0.5")).toBe("0.50")}),it('works for value "foo"',()=>{expect(FormEngineValidation.parseDouble("foo")).toBe("0.00")}),it("works for value true",()=>{expect(FormEngineValidation.parseDouble(!0)).toBe("0.00")}),it("works for value false",()=>{expect(FormEngineValidation.parseDouble(!1)).toBe("0.00")}),it("works for value null",()=>{expect(FormEngineValidation.parseDouble(null)).toBe("0.00")})}),describe("tests for btrim",()=>{const e=FormEngineValidation.btrim(" test ");it("works for string with whitespace in begin and end",()=>{expect(e).toBe(" test")})}),describe("tests for ltrim",()=>{const e=FormEngineValidation.ltrim(" test ");it("works for string with whitespace in begin and end",()=>{expect(e).toBe("test ")})}),xdescribe("tests for parseDateTime",()=>{}),xdescribe("tests for parseDate",()=>{}),xdescribe("tests for parseTime",()=>{}),xdescribe("tests for parseYear",()=>{}),describe("tests for getYear",()=>{const e=new Date;afterEach(()=>{jasmine.clock().mockDate(e)}),it("works for current date",()=>{const e=new Date;expect(FormEngineValidation.getYear(e)).toBe(e.getFullYear())}),it("works for year 2013",()=>{const e=new Date(2013,9,23);jasmine.clock().mockDate(e),expect(FormEngineValidation.getYear(e)).toBe(2013)})}),describe("tests for getDate",()=>{const e=new Date;afterEach(()=>{jasmine.clock().mockDate(e)}),xit("works for year 2013",()=>{const e=new Date(2013,9,23,13,13,13);jasmine.clock().mockDate(e),expect(FormEngineValidation.getDate(e)).toBe(1382479200)})}),describe("tests for splitStr",()=>{it("works for command and index",()=>{expect(FormEngineValidation.splitStr("foo,bar,baz",",",-1)).toBe("foo"),expect(FormEngineValidation.splitStr("foo,bar,baz",",",0)).toBe("foo"),expect(FormEngineValidation.splitStr("foo,bar,baz",",",1)).toBe("foo"),expect(FormEngineValidation.splitStr("foo,bar,baz",",",2)).toBe("bar"),expect(FormEngineValidation.splitStr("foo,bar,baz",",",3)).toBe("baz"),expect(FormEngineValidation.splitStr(" foo , bar , baz ",",",1)).toBe(" foo "),expect(FormEngineValidation.splitStr(" foo , bar , baz ",",",2)).toBe(" bar "),expect(FormEngineValidation.splitStr(" foo , bar , baz ",",",3)).toBe(" baz ")})}),xdescribe("tests for split",()=>{})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/grid-editor-test.js b/typo3/sysext/backend/Tests/JavaScript/grid-editor-test.js new file mode 100644 index 0000000000000000000000000000000000000000..015725a6ca971ebf2015584db854d177e835bca1 --- /dev/null +++ b/typo3/sysext/backend/Tests/JavaScript/grid-editor-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{GridEditor}from"@typo3/backend/grid-editor.js";describe("TYPO3/CMS/Backend/GridEditorTest:",()=>{describe("tests for stripMarkup",()=>{it("works with string which contains html markup only",()=>{expect(GridEditor.stripMarkup("<b>'formula': \"x > y\"</b>")).toBe("'formula': \"x > y\"")}),it("works with string which contains html markup and normal text",()=>{expect(GridEditor.stripMarkup("<b>foo</b> bar")).toBe("foo bar")})})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/hashing/md5Test.js b/typo3/sysext/backend/Tests/JavaScript/hashing/md5Test.js new file mode 100644 index 0000000000000000000000000000000000000000..21d6e763453df46666e241a9e607a833733eb34a --- /dev/null +++ b/typo3/sysext/backend/Tests/JavaScript/hashing/md5Test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Md5 from"@typo3/backend/hashing/md5.js";describe("TYPO3/CMS/Backend/Hashing/Md5:",()=>{describe("tests for hash",()=>{it("hashes a value as expected",()=>{expect(Md5.hash("Hello World")).toBe("b10a8db164e0754105b7a99be72e3fe5"),expect(Md5.hash("TYPO3 CMS is an Open Source Enterprise Content Management System with a large global community, backed by the approximately 900 members of the TYPO3 Association.")).toBe("65b0beb76ada01bd7b5f44fb37da6139")})})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/icons-test.js b/typo3/sysext/backend/Tests/JavaScript/icons-test.js new file mode 100644 index 0000000000000000000000000000000000000000..d2cdf6d67f3211904bc6a9610591379bdc14fc22 --- /dev/null +++ b/typo3/sysext/backend/Tests/JavaScript/icons-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Icons from"@typo3/backend/icons.js";describe("TYPO3/CMS/Backend/IconsTest:",()=>{describe("tests for Icons object",()=>{it("has all sizes",()=>{expect(Icons.sizes.small).toBe("small"),expect(Icons.sizes.default).toBe("default"),expect(Icons.sizes.large).toBe("large"),expect(Icons.sizes.overlay).toBe("overlay")}),it("has all states",()=>{expect(Icons.states.default).toBe("default"),expect(Icons.states.disabled).toBe("disabled")}),it("has all markupIdentifiers",()=>{expect(Icons.markupIdentifiers.default).toBe("default"),expect(Icons.markupIdentifiers.inline).toBe("inline")})}),describe("tests for Icons::getIcon",()=>{beforeEach(()=>{spyOn(Icons,"getIcon"),Icons.getIcon("test",Icons.sizes.small,null,Icons.states.default,Icons.markupIdentifiers.default)}),it("tracks that the spy was called",()=>{expect(Icons.getIcon).toHaveBeenCalled()}),it("tracks all the arguments of its calls",()=>{expect(Icons.getIcon).toHaveBeenCalledWith("test",Icons.sizes.small,null,Icons.states.default,Icons.markupIdentifiers.default)}),xit("works get icon from remote server")}),describe("tests for Icons::putInCache",()=>{it("works for simply identifier and markup",()=>{const e=new Promise(e=>e());Icons.putInPromiseCache("foo",e),expect(Icons.getFromPromiseCache("foo")).toBe(e),expect(Icons.isPromiseCached("foo")).toBe(!0)})}),describe("tests for Icons::getFromPromiseCache",()=>{it("return undefined for uncached promise",()=>{expect(Icons.getFromPromiseCache("bar")).not.toBeDefined(),expect(Icons.isPromiseCached("bar")).toBe(!1)})})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/notification-test.js b/typo3/sysext/backend/Tests/JavaScript/notification-test.js new file mode 100644 index 0000000000000000000000000000000000000000..5338e92e0d31dfeac0d0ea2c1bef3f616f91c380 --- /dev/null +++ b/typo3/sysext/backend/Tests/JavaScript/notification-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DeferredAction from"@typo3/backend/action-button/deferred-action.js";import ImmediateAction from"@typo3/backend/action-button/immediate-action.js";import Notification from"@typo3/backend/notification.js";describe("TYPO3/CMS/Backend/Notification:",()=>{beforeEach(()=>{const e=document.getElementById("alert-container");for(;null!==e&&e.firstChild;)e.removeChild(e.firstChild)}),describe("can render notifications with dismiss after 1000ms",()=>{for(let e of[{method:Notification.notice,title:"Notice message",message:"This notification describes a notice",class:"alert-notice"},{method:Notification.info,title:"Info message",message:"This notification describes an informative action",class:"alert-info"},{method:Notification.success,title:"Success message",message:"This notification describes a successful action",class:"alert-success"},{method:Notification.warning,title:"Warning message",message:"This notification describes a harmful action",class:"alert-warning"},{method:Notification.error,title:"Error message",message:"This notification describes an erroneous action",class:"alert-danger"}])it("can render a notification of type "+e.class,async()=>{e.method(e.title,e.message,1),await document.querySelector("#alert-container typo3-notification-message:last-child").updateComplete;const t="div.alert."+e.class,o=document.querySelector(t);expect(o).not.toBe(null),expect(o.querySelector(".alert-title").textContent).toEqual(e.title),expect(o.querySelector(".alert-message").textContent).toEqual(e.message),await new Promise(e=>window.setTimeout(e,2e3)),expect(document.querySelector(t)).toBe(null)})}),it("can render action buttons",async()=>{Notification.info("Info message","Some text",1,[{label:"My action",action:new ImmediateAction(e=>e)},{label:"My other action",action:new DeferredAction(e=>e)}]),await document.querySelector("#alert-container typo3-notification-message:last-child").updateComplete;const e=document.querySelector("div.alert");expect(e.querySelector(".alert-actions")).not.toBe(null),expect(e.querySelectorAll(".alert-actions a").length).toEqual(2),expect(e.querySelectorAll(".alert-actions a")[0].textContent).toEqual("My action"),expect(e.querySelectorAll(".alert-actions a")[1].textContent).toEqual("My other action")}),it("immediate action is called",async()=>{const e={callback:()=>{}};spyOn(e,"callback").and.callThrough(),Notification.info("Info message","Some text",1,[{label:"My immediate action",action:new ImmediateAction(e.callback)}]),await document.querySelector("#alert-container typo3-notification-message:last-child").updateComplete;document.querySelector("div.alert").querySelector(".alert-actions a").click(),await document.querySelector("#alert-container typo3-notification-message:last-child").updateComplete,expect(e.callback).toHaveBeenCalled()})}); \ No newline at end of file diff --git a/typo3/sysext/backend/Tests/JavaScript/popover-test.js b/typo3/sysext/backend/Tests/JavaScript/popover-test.js new file mode 100644 index 0000000000000000000000000000000000000000..49522cb7ba622e3089956e4997399c3d5463f1c9 --- /dev/null +++ b/typo3/sysext/backend/Tests/JavaScript/popover-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Popover from"@typo3/backend/popover.js";describe("TYPO3/CMS/Backend/PopoverTest:",()=>{describe("initialize",()=>{const t=$("body"),e=$('<div data-bs-toggle="popover">');t.append(e),it("works with default selector",()=>{Popover.initialize(),expect(e[0].outerHTML).toBe('<div data-bs-toggle="popover" data-bs-original-title="" title=""></div>')});const o=$('<div data-bs-toggle="popover" data-title="foo">');t.append(o),it("works with default selector and title attribute",()=>{Popover.initialize(),expect(o[0].outerHTML).toBe('<div data-bs-toggle="popover" data-title="foo" data-bs-original-title="" title=""></div>')});const i=$('<div data-bs-toggle="popover" data-bs-content="foo">');t.append(i),it("works with default selector and content attribute",()=>{Popover.initialize(),expect(i[0].outerHTML).toBe('<div data-bs-toggle="popover" data-bs-content="foo" data-bs-original-title="" title=""></div>')});const a=$('<div class="t3js-popover">');t.append(a),it("works with custom selector",()=>{Popover.initialize(".t3js-popover"),expect(a[0].outerHTML).toBe('<div class="t3js-popover" data-bs-original-title="" title=""></div>')})}),describe("call setOptions",()=>{const t=$("body"),e=$('<div class="t3js-test-set-options" data-title="foo-title" data-bs-content="foo-content">');t.append(e),it("can set title",()=>{Popover.initialize(".t3js-test-set-options"),expect(e.attr("data-title")).toBe("foo-title"),expect(e.attr("data-bs-content")).toBe("foo-content"),expect(e.attr("data-bs-original-title")).toBe(""),expect(e.attr("title")).toBe(""),Popover.setOptions(e,{title:"bar-title"}),expect(e.attr("data-title")).toBe("foo-title"),expect(e.attr("data-bs-content")).toBe("foo-content"),expect(e.attr("data-bs-original-title")).toBe("bar-title"),expect(e.attr("title")).toBe("")});const o=$('<div class="t3js-test-set-options2" data-title="foo-title" data-bs-content="foo-content">');t.append(o),it("can set content",()=>{Popover.initialize(".t3js-test-set-options2"),Popover.show(o),expect(o.attr("data-title")).toBe("foo-title"),expect(o.attr("data-bs-content")).toBe("foo-content"),expect(o.attr("data-bs-original-title")).toBe(""),expect(o.attr("title")).toBe(""),Popover.setOptions(o,{content:"bar-content"}),expect(o.attr("data-title")).toBe("foo-title"),expect(o.attr("data-bs-content")).toBe("bar-content"),expect(o.attr("data-bs-original-title")).toBe("foo-title"),expect(o.attr("title")).toBe("")})})}); \ No newline at end of file diff --git a/typo3/sysext/belog/Classes/Controller/BackendLogController.php b/typo3/sysext/belog/Classes/Controller/BackendLogController.php index ce7ce3a290cd4ccf88b39924197e948c7c993dc6..ef6113d4683a1c0d30ca84256d3b4bb85b663b94 100644 --- a/typo3/sysext/belog/Classes/Controller/BackendLogController.php +++ b/typo3/sysext/belog/Classes/Controller/BackendLogController.php @@ -63,8 +63,8 @@ class BackendLogController extends ActionController $constraintConfiguration = $this->arguments->getArgument('constraint')->getPropertyMappingConfiguration(); $constraintConfiguration->allowAllProperties(); $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); - $pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/GlobalEventHandler.js'); - $pageRenderer->loadJavaScriptModule('TYPO3/CMS/Belog/BackendLog.js'); + $pageRenderer->loadJavaScriptModule('@typo3/backend/global-event-handler.js'); + $pageRenderer->loadJavaScriptModule('@typo3/belog/backend-log.js'); } /** diff --git a/typo3/sysext/belog/Configuration/JavaScriptModules.php b/typo3/sysext/belog/Configuration/JavaScriptModules.php index fc57c09a9f6c63d6dc2519a04d64548773ddadc7..c008596f3cb93ef3934dc06f8658a73e186d2c0f 100644 --- a/typo3/sysext/belog/Configuration/JavaScriptModules.php +++ b/typo3/sysext/belog/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Belog/' => 'EXT:belog/Resources/Public/JavaScript/', + '@typo3/belog/' => 'EXT:belog/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/belog/Resources/Public/JavaScript/BackendLog.js b/typo3/sysext/belog/Resources/Public/JavaScript/BackendLog.js deleted file mode 100644 index fec921b6aa38e0fefc156845df6be219d7eec5e5..0000000000000000000000000000000000000000 --- a/typo3/sysext/belog/Resources/Public/JavaScript/BackendLog.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import DateTimePicker from"TYPO3/CMS/Backend/DateTimePicker.js";import"TYPO3/CMS/Backend/Input/Clearable.js";class BackendLog{constructor(){this.clearableElements=null,this.dateTimePickerElements=null,DocumentService.ready().then(()=>{this.clearableElements=document.querySelectorAll(".t3js-clearable"),this.dateTimePickerElements=document.querySelectorAll(".t3js-datetimepicker"),this.initializeClearableElements(),this.initializeDateTimePickerElements()})}initializeClearableElements(){this.clearableElements.forEach(e=>e.clearable())}initializeDateTimePickerElements(){this.dateTimePickerElements.forEach(e=>DateTimePicker.initialize(e))}}export default new BackendLog; \ No newline at end of file diff --git a/typo3/sysext/belog/Resources/Public/JavaScript/backend-log.js b/typo3/sysext/belog/Resources/Public/JavaScript/backend-log.js new file mode 100644 index 0000000000000000000000000000000000000000..877b1681d2607ecddf4a7a9b66175842a1244002 --- /dev/null +++ b/typo3/sysext/belog/Resources/Public/JavaScript/backend-log.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import DateTimePicker from"@typo3/backend/date-time-picker.js";import"@typo3/backend/input/clearable.js";class BackendLog{constructor(){this.clearableElements=null,this.dateTimePickerElements=null,DocumentService.ready().then(()=>{this.clearableElements=document.querySelectorAll(".t3js-clearable"),this.dateTimePickerElements=document.querySelectorAll(".t3js-datetimepicker"),this.initializeClearableElements(),this.initializeDateTimePickerElements()})}initializeClearableElements(){this.clearableElements.forEach(e=>e.clearable())}initializeDateTimePickerElements(){this.dateTimePickerElements.forEach(e=>DateTimePicker.initialize(e))}}export default new BackendLog; \ No newline at end of file diff --git a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php index 56935e888370d3543ebeb7721acb85c4ca8751db..9c0cf005e1b6f91ecee41b85b15a803fbfde360b 100644 --- a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php +++ b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php @@ -113,9 +113,9 @@ class BackendUserController extends ActionController 'timeFormat' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm'], ]); // Load requireJS modules - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ContextMenu.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Modal.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Beuser/BackendUserListing.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-menu.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/modal.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/beuser/backend-user-listing.js'); } /** @@ -175,7 +175,7 @@ class BackendUserController extends ActionController ->setDisplayName(LocalizationUtility::translate('backendUsers', 'beuser')); $buttonBar->addButton($shortcutButton, ButtonBar::BUTTON_POSITION_RIGHT); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/SwitchUser.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/switch-user.js'); return $this->moduleTemplate->renderResponse('BackendUser/Index'); } diff --git a/typo3/sysext/beuser/Configuration/Backend/Modules.php b/typo3/sysext/beuser/Configuration/Backend/Modules.php index aaa0e4451dc5fd0b28d85db1f955fa65f5dfc750..d5f1f41314c7293622c6e83e6397cf6c8ce9cfde 100644 --- a/typo3/sysext/beuser/Configuration/Backend/Modules.php +++ b/typo3/sysext/beuser/Configuration/Backend/Modules.php @@ -13,7 +13,7 @@ return [ 'access' => 'admin', 'path' => '/module/system/permissions', 'iconIdentifier' => 'module-permission', - 'navigationComponent' => 'TYPO3/CMS/Backend/PageTree/PageTreeElement', + 'navigationComponent' => '@typo3/backend/page-tree/page-tree-element', 'labels' => 'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf', 'routes' => [ '_default' => [ diff --git a/typo3/sysext/beuser/Configuration/JavaScriptModules.php b/typo3/sysext/beuser/Configuration/JavaScriptModules.php index 1bce57fc28ed55b61d585cbb66c89de5099fac0c..e7c595c0b2dd6cebe1487de2fefbef8c33421a10 100644 --- a/typo3/sysext/beuser/Configuration/JavaScriptModules.php +++ b/typo3/sysext/beuser/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Beuser/' => 'EXT:beuser/Resources/Public/JavaScript/', + '@typo3/beuser/' => 'EXT:beuser/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/beuser/Resources/Private/Templates/Permission/Edit.html b/typo3/sysext/beuser/Resources/Private/Templates/Permission/Edit.html index 37abe7d8d009053469bc7e407c29950465209072..9d93abf24ed30a2d8fda758ba918d67e519c0ecb 100644 --- a/typo3/sysext/beuser/Resources/Private/Templates/Permission/Edit.html +++ b/typo3/sysext/beuser/Resources/Private/Templates/Permission/Edit.html @@ -9,8 +9,8 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Beuser/Permissions.js', - 1: 'TYPO3/CMS/Backend/Tooltip.js' + 0: '@typo3/beuser/permissions.js', + 1: '@typo3/backend/tooltip.js' }" /> diff --git a/typo3/sysext/beuser/Resources/Private/Templates/Permission/Index.html b/typo3/sysext/beuser/Resources/Private/Templates/Permission/Index.html index ba2f4f5b93388261ac2e65bc6365af61197c0b6f..e6981bb2081bb24ccec4269f76f8baad7348d945 100644 --- a/typo3/sysext/beuser/Resources/Private/Templates/Permission/Index.html +++ b/typo3/sysext/beuser/Resources/Private/Templates/Permission/Index.html @@ -12,8 +12,8 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Beuser/Permissions.js', - 1: 'TYPO3/CMS/Backend/Tooltip.js' + 0: '@typo3/beuser/permissions.js', + 1: '@typo3/backend/tooltip.js' }" /> diff --git a/typo3/sysext/beuser/Resources/Public/JavaScript/BackendUserListing.js b/typo3/sysext/beuser/Resources/Public/JavaScript/BackendUserListing.js deleted file mode 100644 index c19616da9665708c4d77039122976f01814ed955..0000000000000000000000000000000000000000 --- a/typo3/sysext/beuser/Resources/Public/JavaScript/BackendUserListing.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"TYPO3/CMS/Backend/Input/Clearable.js";class BackendUserListing{constructor(){let e;if(null!==(e=document.getElementById("tx_Beuser_username"))){const t=""!==e.value;e.clearable({onClear:e=>{t&&e.closest("form").submit()}})}}}export default new BackendUserListing; \ No newline at end of file diff --git a/typo3/sysext/beuser/Resources/Public/JavaScript/Permissions.js b/typo3/sysext/beuser/Resources/Public/JavaScript/Permissions.js deleted file mode 100644 index e1e71356c903e270f89e7bba6053d7f4a8895223..0000000000000000000000000000000000000000 --- a/typo3/sysext/beuser/Resources/Public/JavaScript/Permissions.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Tooltip from"TYPO3/CMS/Backend/Tooltip.js";class Permissions{constructor(){this.options={containerSelector:"#typo3-permissionList",editControllerSelector:"#PermissionControllerEdit"},this.ajaxUrl=TYPO3.settings.ajaxUrls.user_access_permissions,this.initializeCheckboxGroups(),this.initializeEvents()}static setPermissionCheckboxes(e,t){const a=document.querySelectorAll(`input[type="checkbox"][name^="${e}"]`);for(let e of a){const a=parseInt(e.value,10);e.checked=(t&a)===a}}static updatePermissionValue(e,t){let a=0;const o=document.querySelectorAll(`input[type="checkbox"][name^="${e}"]:checked`);for(let e of o)a|=parseInt(e.value,10);document.forms.namedItem("editform")[t].value=a|("check[perms_user]"===e?1:0)}setPermissions(e){let t=e.dataset.page,a=e.dataset.who;Tooltip.hide(document.querySelectorAll('[data-bs-toggle="tooltip"]')),new AjaxRequest(this.ajaxUrl).post({page:t,who:a,permissions:e.dataset.permissions,mode:e.dataset.mode,bits:e.dataset.bits}).then(async e=>{const o=await e.resolve();document.getElementById(t+"_"+a).outerHTML=o,Tooltip.initialize('[data-bs-toggle="tooltip"]')})}toggleEditLock(e){let t=e.dataset.page;new AjaxRequest(this.ajaxUrl).post({action:"toggle_edit_lock",page:t,editLockState:e.dataset.lockstate}).then(async e=>{document.getElementById("el_"+t).outerHTML=await e.resolve()})}changeOwner(e){let t=e.dataset.page;const a=document.getElementById("o_"+t);new AjaxRequest(this.ajaxUrl).post({action:"change_owner",page:t,ownerUid:e.dataset.owner,newOwnerUid:a.getElementsByTagName("select")[0].value}).then(async e=>{a.outerHTML=await e.resolve()})}showChangeOwnerSelector(e){let t=e.dataset.page;new AjaxRequest(this.ajaxUrl).post({action:"show_change_owner_selector",page:t,ownerUid:e.dataset.owner,username:e.dataset.username}).then(async e=>{document.getElementById("o_"+t).outerHTML=await e.resolve()})}restoreOwner(e){const t=e.dataset.page,a=e.dataset.username??e.dataset.ifNotSet,o=document.createElement("span");o.setAttribute("id","o_"+t);const n=document.createElement("button");n.classList.add("ug_selector","changeowner","btn","btn-link"),n.setAttribute("type","button"),n.setAttribute("data-page",t),n.setAttribute("data-owner",e.dataset.owner),n.setAttribute("data-username",a),n.innerText=a,o.appendChild(n);const s=document.getElementById("o_"+t);s.parentNode.replaceChild(o,s)}restoreGroup(e){const t=e.dataset.page,a=e.dataset.groupname??e.dataset.ifNotSet,o=document.createElement("span");o.setAttribute("id","g_"+t);const n=document.createElement("button");n.classList.add("ug_selector","changegroup","btn","btn-link"),n.setAttribute("type","button"),n.setAttribute("data-page",t),n.setAttribute("data-group-id",e.dataset.groupId),n.setAttribute("data-groupname",a),n.innerText=a,o.appendChild(n);const s=document.getElementById("g_"+t);s.parentNode.replaceChild(o,s)}changeGroup(e){let t=e.dataset.page;const a=document.getElementById("g_"+t);new AjaxRequest(this.ajaxUrl).post({action:"change_group",page:t,groupUid:e.dataset.groupId,newGroupUid:a.getElementsByTagName("select")[0].value}).then(async e=>{a.outerHTML=await e.resolve()})}showChangeGroupSelector(e){let t=e.dataset.page;new AjaxRequest(this.ajaxUrl).post({action:"show_change_group_selector",page:t,groupUid:e.dataset.groupId,groupname:e.dataset.groupname}).then(async e=>{document.getElementById("g_"+t).outerHTML=await e.resolve()})}initializeCheckboxGroups(){document.querySelectorAll("[data-checkbox-group]").forEach(e=>{const t=e.dataset.checkboxGroup,a=parseInt(e.value,10);Permissions.setPermissionCheckboxes(t,a)})}initializeEvents(){const e=document.querySelector(this.options.containerSelector),t=document.querySelector(this.options.editControllerSelector);null!==e&&(new RegularEvent("click",(e,t)=>{e.preventDefault(),this.setPermissions(t)}).delegateTo(e,".change-permission"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.toggleEditLock(t)}).delegateTo(e,".editlock"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.showChangeOwnerSelector(t)}).delegateTo(e,".changeowner"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.showChangeGroupSelector(t)}).delegateTo(e,".changegroup"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.restoreOwner(t)}).delegateTo(e,".restoreowner"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.changeOwner(t)}).delegateTo(e,".saveowner"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.restoreGroup(t)}).delegateTo(e,".restoregroup"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.changeGroup(t)}).delegateTo(e,".savegroup")),null!==t&&new RegularEvent("click",(e,t)=>{const a=t.dataset.checkChangePermissions.split(",").map(e=>e.trim());Permissions.updatePermissionValue.apply(this,a)}).delegateTo(t,"[data-check-change-permissions]")}}export default new Permissions; \ No newline at end of file diff --git a/typo3/sysext/beuser/Resources/Public/JavaScript/backend-user-listing.js b/typo3/sysext/beuser/Resources/Public/JavaScript/backend-user-listing.js new file mode 100644 index 0000000000000000000000000000000000000000..d2d978039ca9c39667811195bcb9151bf3ac3555 --- /dev/null +++ b/typo3/sysext/beuser/Resources/Public/JavaScript/backend-user-listing.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"@typo3/backend/input/clearable.js";class BackendUserListing{constructor(){let e;if(null!==(e=document.getElementById("tx_Beuser_username"))){const t=""!==e.value;e.clearable({onClear:e=>{t&&e.closest("form").submit()}})}}}export default new BackendUserListing; \ No newline at end of file diff --git a/typo3/sysext/beuser/Resources/Public/JavaScript/permissions.js b/typo3/sysext/beuser/Resources/Public/JavaScript/permissions.js new file mode 100644 index 0000000000000000000000000000000000000000..e281fdbe4b0eef6ac666fdf9cd566965675d7a57 --- /dev/null +++ b/typo3/sysext/beuser/Resources/Public/JavaScript/permissions.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import RegularEvent from"@typo3/core/event/regular-event.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Tooltip from"@typo3/backend/tooltip.js";class Permissions{constructor(){this.options={containerSelector:"#typo3-permissionList",editControllerSelector:"#PermissionControllerEdit"},this.ajaxUrl=TYPO3.settings.ajaxUrls.user_access_permissions,this.initializeCheckboxGroups(),this.initializeEvents()}static setPermissionCheckboxes(e,t){const a=document.querySelectorAll(`input[type="checkbox"][name^="${e}"]`);for(let e of a){const a=parseInt(e.value,10);e.checked=(t&a)===a}}static updatePermissionValue(e,t){let a=0;const o=document.querySelectorAll(`input[type="checkbox"][name^="${e}"]:checked`);for(let e of o)a|=parseInt(e.value,10);document.forms.namedItem("editform")[t].value=a|("check[perms_user]"===e?1:0)}setPermissions(e){let t=e.dataset.page,a=e.dataset.who;Tooltip.hide(document.querySelectorAll('[data-bs-toggle="tooltip"]')),new AjaxRequest(this.ajaxUrl).post({page:t,who:a,permissions:e.dataset.permissions,mode:e.dataset.mode,bits:e.dataset.bits}).then(async e=>{const o=await e.resolve();document.getElementById(t+"_"+a).outerHTML=o,Tooltip.initialize('[data-bs-toggle="tooltip"]')})}toggleEditLock(e){let t=e.dataset.page;new AjaxRequest(this.ajaxUrl).post({action:"toggle_edit_lock",page:t,editLockState:e.dataset.lockstate}).then(async e=>{document.getElementById("el_"+t).outerHTML=await e.resolve()})}changeOwner(e){let t=e.dataset.page;const a=document.getElementById("o_"+t);new AjaxRequest(this.ajaxUrl).post({action:"change_owner",page:t,ownerUid:e.dataset.owner,newOwnerUid:a.getElementsByTagName("select")[0].value}).then(async e=>{a.outerHTML=await e.resolve()})}showChangeOwnerSelector(e){let t=e.dataset.page;new AjaxRequest(this.ajaxUrl).post({action:"show_change_owner_selector",page:t,ownerUid:e.dataset.owner,username:e.dataset.username}).then(async e=>{document.getElementById("o_"+t).outerHTML=await e.resolve()})}restoreOwner(e){const t=e.dataset.page,a=e.dataset.username??e.dataset.ifNotSet,o=document.createElement("span");o.setAttribute("id","o_"+t);const n=document.createElement("button");n.classList.add("ug_selector","changeowner","btn","btn-link"),n.setAttribute("type","button"),n.setAttribute("data-page",t),n.setAttribute("data-owner",e.dataset.owner),n.setAttribute("data-username",a),n.innerText=a,o.appendChild(n);const s=document.getElementById("o_"+t);s.parentNode.replaceChild(o,s)}restoreGroup(e){const t=e.dataset.page,a=e.dataset.groupname??e.dataset.ifNotSet,o=document.createElement("span");o.setAttribute("id","g_"+t);const n=document.createElement("button");n.classList.add("ug_selector","changegroup","btn","btn-link"),n.setAttribute("type","button"),n.setAttribute("data-page",t),n.setAttribute("data-group-id",e.dataset.groupId),n.setAttribute("data-groupname",a),n.innerText=a,o.appendChild(n);const s=document.getElementById("g_"+t);s.parentNode.replaceChild(o,s)}changeGroup(e){let t=e.dataset.page;const a=document.getElementById("g_"+t);new AjaxRequest(this.ajaxUrl).post({action:"change_group",page:t,groupUid:e.dataset.groupId,newGroupUid:a.getElementsByTagName("select")[0].value}).then(async e=>{a.outerHTML=await e.resolve()})}showChangeGroupSelector(e){let t=e.dataset.page;new AjaxRequest(this.ajaxUrl).post({action:"show_change_group_selector",page:t,groupUid:e.dataset.groupId,groupname:e.dataset.groupname}).then(async e=>{document.getElementById("g_"+t).outerHTML=await e.resolve()})}initializeCheckboxGroups(){document.querySelectorAll("[data-checkbox-group]").forEach(e=>{const t=e.dataset.checkboxGroup,a=parseInt(e.value,10);Permissions.setPermissionCheckboxes(t,a)})}initializeEvents(){const e=document.querySelector(this.options.containerSelector),t=document.querySelector(this.options.editControllerSelector);null!==e&&(new RegularEvent("click",(e,t)=>{e.preventDefault(),this.setPermissions(t)}).delegateTo(e,".change-permission"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.toggleEditLock(t)}).delegateTo(e,".editlock"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.showChangeOwnerSelector(t)}).delegateTo(e,".changeowner"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.showChangeGroupSelector(t)}).delegateTo(e,".changegroup"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.restoreOwner(t)}).delegateTo(e,".restoreowner"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.changeOwner(t)}).delegateTo(e,".saveowner"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.restoreGroup(t)}).delegateTo(e,".restoregroup"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.changeGroup(t)}).delegateTo(e,".savegroup")),null!==t&&new RegularEvent("click",(e,t)=>{const a=t.dataset.checkChangePermissions.split(",").map(e=>e.trim());Permissions.updatePermissionValue.apply(this,a)}).delegateTo(t,"[data-check-change-permissions]")}}export default new Permissions; \ No newline at end of file diff --git a/typo3/sysext/core/Classes/Page/JavaScriptRenderer.php b/typo3/sysext/core/Classes/Page/JavaScriptRenderer.php index c59d7dfac36ae8d59c44a3d1dc938dca56147765..89f217d82d438519f3dfd970e6669df79b5f45ca 100644 --- a/typo3/sysext/core/Classes/Page/JavaScriptRenderer.php +++ b/typo3/sysext/core/Classes/Page/JavaScriptRenderer.php @@ -30,7 +30,7 @@ class JavaScriptRenderer public static function create(string $uri = null): self { $uri ??= PathUtility::getAbsoluteWebPath( - GeneralUtility::getFileAbsFileName('EXT:core/Resources/Public/JavaScript/JavaScriptItemHandler.js') + GeneralUtility::getFileAbsFileName('EXT:core/Resources/Public/JavaScript/java-script-item-handler.js') ); return GeneralUtility::makeInstance(static::class, $uri); } @@ -121,7 +121,7 @@ class JavaScriptRenderer public function renderImportMap(string $sitePath, string $nonce): string { if (!$this->isEmpty()) { - $this->importMap->includeImportsFor('TYPO3/CMS/Core/JavaScriptItemHandler.js'); + $this->importMap->includeImportsFor('@typo3/core/java-script-item-handler.js'); } return $this->importMap->render($sitePath, $nonce); } diff --git a/typo3/sysext/core/Classes/Page/PageRenderer.php b/typo3/sysext/core/Classes/Page/PageRenderer.php index caed139229e22663c8a11d58c9d410293a6a639d..7d9321eb5648d5c136dc89437bbb403b5ae6d804 100644 --- a/typo3/sysext/core/Classes/Page/PageRenderer.php +++ b/typo3/sysext/core/Classes/Page/PageRenderer.php @@ -437,7 +437,7 @@ class PageRenderer implements SingletonInterface $this->headerData = []; $this->footerData = []; $this->javaScriptRenderer = JavaScriptRenderer::create( - $this->getStreamlinedFileName('EXT:core/Resources/Public/JavaScript/JavaScriptItemHandler.js', true) + $this->getStreamlinedFileName('EXT:core/Resources/Public/JavaScript/java-script-item-handler.js', true) ); } @@ -1513,7 +1513,7 @@ class PageRenderer implements SingletonInterface ); $html .= sprintf( '<script src="%s">/* %s */</script>' . "\n", - htmlspecialchars($this->getStreamlinedFileName('EXT:core/Resources/Public/JavaScript/RequireJSConfigHandler.js', true)), + htmlspecialchars($this->getStreamlinedFileName('EXT:core/Resources/Public/JavaScript/require-jsconfig-handler.js', true)), (string)json_encode($requireJsConfig, JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_TAG) ); } else { diff --git a/typo3/sysext/core/Configuration/Backend/Modules.php b/typo3/sysext/core/Configuration/Backend/Modules.php index 2720629b337266a17606532073b403ce29bbf93b..8984f578e8bfcb091110eb43b33cd56fafbb7b52 100644 --- a/typo3/sysext/core/Configuration/Backend/Modules.php +++ b/typo3/sysext/core/Configuration/Backend/Modules.php @@ -7,7 +7,7 @@ return [ 'web' => [ 'labels' => 'LLL:EXT:core/Resources/Private/Language/locallang_mod_web.xlf', 'iconIdentifier' => 'modulegroup-web', - 'navigationComponent' => 'TYPO3/CMS/Backend/PageTree/PageTreeElement', + 'navigationComponent' => '@typo3/backend/page-tree/page-tree-element', ], 'site' => [ 'labels' => 'LLL:EXT:core/Resources/Private/Language/locallang_mod_site.xlf', @@ -17,7 +17,7 @@ return [ 'file' => [ 'labels' => 'LLL:EXT:core/Resources/Private/Language/locallang_mod_file.xlf', 'iconIdentifier' => 'modulegroup-file', - 'navigationComponent' => 'TYPO3/CMS/Backend/Tree/FileStorageTreeContainer', + 'navigationComponent' => '@typo3/backend/tree/file-storage-tree-container', ], 'user' => [ 'labels' => 'LLL:EXT:core/Resources/Private/Language/locallang_mod_usertools.xlf', diff --git a/typo3/sysext/core/Configuration/JavaScriptModules.php b/typo3/sysext/core/Configuration/JavaScriptModules.php index 716f4a68b37959b4b9d337df00a193f29d59a2b7..fdd50f51174fee4add2074a8fca531e82f98fdf3 100644 --- a/typo3/sysext/core/Configuration/JavaScriptModules.php +++ b/typo3/sysext/core/Configuration/JavaScriptModules.php @@ -3,7 +3,7 @@ return [ 'dependencies' => [], 'imports' => [ - 'TYPO3/CMS/Core/' => [ + '@typo3/core/' => [ 'path' => 'EXT:core/Resources/Public/JavaScript/', 'exclude' => [ 'EXT:core/Resources/Public/JavaScript/Contrib/', diff --git a/typo3/sysext/core/Resources/Private/Templates/Authentication/MfaProvider/Totp/Setup.html b/typo3/sysext/core/Resources/Private/Templates/Authentication/MfaProvider/Totp/Setup.html index 21f6074bf4d5e13558683988ddf84a185aa7fe4b..9c2618677e27152c4de01ef0fb3784c9caf6a2b6 100644 --- a/typo3/sysext/core/Resources/Private/Templates/Authentication/MfaProvider/Totp/Setup.html +++ b/typo3/sysext/core/Resources/Private/Templates/Authentication/MfaProvider/Totp/Setup.html @@ -3,7 +3,7 @@ xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true"> -<f:be.pageRenderer includeJavaScriptModules="{0: 'TYPO3/CMS/Core/Authentication/MfaProvider/Totp.js'}" /> +<f:be.pageRenderer includeJavaScriptModules="{0: '@typo3/core/authentication/mfa-provider/totp.js'}" /> <fieldset class="row"> <div class="col-lg-4"> diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Ajax/AjaxRequest.js b/typo3/sysext/core/Resources/Public/JavaScript/Ajax/AjaxRequest.js deleted file mode 100644 index 84043c9f7a4d50529f2388322a72b07d44dadea0..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Resources/Public/JavaScript/Ajax/AjaxRequest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{AjaxResponse}from"TYPO3/CMS/Core/Ajax/AjaxResponse.js";import{InputTransformer}from"TYPO3/CMS/Core/Ajax/InputTransformer.js";class AjaxRequest{constructor(e){this.queryArguments="",this.url=e,this.abortController=new AbortController}withQueryArguments(e){const t=this.clone();return t.queryArguments=(""!==t.queryArguments?"&":"")+InputTransformer.toSearchParams(e),t}async get(e={}){const t=await this.send({method:"GET",...e});return new AjaxResponse(t)}async post(e,t={}){const r={body:"string"==typeof e?e:InputTransformer.byHeader(e,t?.headers),cache:"no-cache",method:"POST"},n=await this.send({...r,...t});return new AjaxResponse(n)}async put(e,t={}){const r={body:"string"==typeof e?e:InputTransformer.byHeader(e,t?.headers),cache:"no-cache",method:"PUT"},n=await this.send({...r,...t});return new AjaxResponse(n)}async delete(e={},t={}){const r={cache:"no-cache",method:"DELETE"};"object"==typeof e&&Object.keys(e).length>0?r.body=InputTransformer.byHeader(e,t?.headers):"string"==typeof e&&e.length>0&&(r.body=e);const n=await this.send({...r,...t});return new AjaxResponse(n)}abort(){this.abortController.abort()}clone(){return Object.assign(Object.create(this),this)}async send(e={}){const t=await fetch(this.composeRequestUrl(),this.getMergedOptions(e));if(!t.ok)throw new AjaxResponse(t);return t}composeRequestUrl(){let e=this.url;if("?"===e.charAt(0)&&(e=window.location.origin+window.location.pathname+e),e=new URL(e,window.location.origin).toString(),""!==this.queryArguments){e+=(this.url.includes("?")?"&":"?")+this.queryArguments}return e}getMergedOptions(e){return{...AjaxRequest.defaultOptions,...e,signal:this.abortController.signal}}}AjaxRequest.defaultOptions={credentials:"same-origin"};export default AjaxRequest; \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Event/DebounceEvent.js b/typo3/sysext/core/Resources/Public/JavaScript/Event/DebounceEvent.js deleted file mode 100644 index fbb6ba7249abb4cc191a585250ae0e1438aa1bba..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Resources/Public/JavaScript/Event/DebounceEvent.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class DebounceEvent extends RegularEvent{constructor(e,t,l=250,n=!1){super(e,t),this.callback=this.debounce(this.callback,l,n)}debounce(e,t,l){let n=null;return function(...u){const c=l&&!n;clearTimeout(n),c?(e.apply(this,u),n=setTimeout(()=>{n=null},t)):n=setTimeout(()=>{n=null,l||e.apply(this,u)},t)}}}export default DebounceEvent; \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Event/RequestAnimationFrameEvent.js b/typo3/sysext/core/Resources/Public/JavaScript/Event/RequestAnimationFrameEvent.js deleted file mode 100644 index 3e7bc2a06b5f19bc22d2159bd4836bb680ddbf5d..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Resources/Public/JavaScript/Event/RequestAnimationFrameEvent.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class RequestAnimationFrameEvent extends RegularEvent{constructor(e,t){super(e,t),this.callback=this.req(this.callback)}req(e){let t=null;return()=>{const n=this,a=arguments;t&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame((function(){e.apply(n,a)}))}}}export default RequestAnimationFrameEvent; \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Event/ThrottleEvent.js b/typo3/sysext/core/Resources/Public/JavaScript/Event/ThrottleEvent.js deleted file mode 100644 index 7daf6c97da41add6b19f98dd13a0c7be83f9c61b..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Resources/Public/JavaScript/Event/ThrottleEvent.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class ThrottleEvent extends RegularEvent{constructor(t,e,r){super(t,e),this.callback=this.throttle(e,r)}throttle(t,e){let r=!1;return function(...l){r||(t.apply(this,l),r=!0,setTimeout(()=>{r=!1,t.apply(this,l)},e))}}}export default ThrottleEvent; \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/ajax/ajax-request.js b/typo3/sysext/core/Resources/Public/JavaScript/ajax/ajax-request.js new file mode 100644 index 0000000000000000000000000000000000000000..9a3d667ecf2a904a531a401767ecc8d479fe19cd --- /dev/null +++ b/typo3/sysext/core/Resources/Public/JavaScript/ajax/ajax-request.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{AjaxResponse}from"@typo3/core/ajax/ajax-response.js";import{InputTransformer}from"@typo3/core/ajax/input-transformer.js";class AjaxRequest{constructor(e){this.queryArguments="",this.url=e,this.abortController=new AbortController}withQueryArguments(e){const t=this.clone();return t.queryArguments=(""!==t.queryArguments?"&":"")+InputTransformer.toSearchParams(e),t}async get(e={}){const t=await this.send({method:"GET",...e});return new AjaxResponse(t)}async post(e,t={}){const r={body:"string"==typeof e?e:InputTransformer.byHeader(e,t?.headers),cache:"no-cache",method:"POST"},n=await this.send({...r,...t});return new AjaxResponse(n)}async put(e,t={}){const r={body:"string"==typeof e?e:InputTransformer.byHeader(e,t?.headers),cache:"no-cache",method:"PUT"},n=await this.send({...r,...t});return new AjaxResponse(n)}async delete(e={},t={}){const r={cache:"no-cache",method:"DELETE"};"object"==typeof e&&Object.keys(e).length>0?r.body=InputTransformer.byHeader(e,t?.headers):"string"==typeof e&&e.length>0&&(r.body=e);const n=await this.send({...r,...t});return new AjaxResponse(n)}abort(){this.abortController.abort()}clone(){return Object.assign(Object.create(this),this)}async send(e={}){const t=await fetch(this.composeRequestUrl(),this.getMergedOptions(e));if(!t.ok)throw new AjaxResponse(t);return t}composeRequestUrl(){let e=this.url;if("?"===e.charAt(0)&&(e=window.location.origin+window.location.pathname+e),e=new URL(e,window.location.origin).toString(),""!==this.queryArguments){e+=(this.url.includes("?")?"&":"?")+this.queryArguments}return e}getMergedOptions(e){return{...AjaxRequest.defaultOptions,...e,signal:this.abortController.signal}}}AjaxRequest.defaultOptions={credentials:"same-origin"};export default AjaxRequest; \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Ajax/AjaxResponse.js b/typo3/sysext/core/Resources/Public/JavaScript/ajax/ajax-response.js similarity index 100% rename from typo3/sysext/core/Resources/Public/JavaScript/Ajax/AjaxResponse.js rename to typo3/sysext/core/Resources/Public/JavaScript/ajax/ajax-response.js diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Ajax/InputTransformer.js b/typo3/sysext/core/Resources/Public/JavaScript/ajax/input-transformer.js similarity index 100% rename from typo3/sysext/core/Resources/Public/JavaScript/Ajax/InputTransformer.js rename to typo3/sysext/core/Resources/Public/JavaScript/ajax/input-transformer.js diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Ajax/SimpleResponseInterface.js b/typo3/sysext/core/Resources/Public/JavaScript/ajax/simple-response-interface.js similarity index 100% rename from typo3/sysext/core/Resources/Public/JavaScript/Ajax/SimpleResponseInterface.js rename to typo3/sysext/core/Resources/Public/JavaScript/ajax/simple-response-interface.js diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Authentication/MfaProvider/Totp.js b/typo3/sysext/core/Resources/Public/JavaScript/authentication/mfa-provider/totp.js similarity index 74% rename from typo3/sysext/core/Resources/Public/JavaScript/Authentication/MfaProvider/Totp.js rename to typo3/sysext/core/Resources/Public/JavaScript/authentication/mfa-provider/totp.js index d6ae6fef0ea759230ed5b94e233c3f36491ad04a..a27b9bdb3ce7bf3938798f6f48322bbde5032fd6 100644 --- a/typo3/sysext/core/Resources/Public/JavaScript/Authentication/MfaProvider/Totp.js +++ b/typo3/sysext/core/Resources/Public/JavaScript/authentication/mfa-provider/totp.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var Selectors,__decorate=function(t,e,o,r){var l,p=arguments.length,n=p<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,r);else for(var i=t.length-1;i>=0;i--)(l=t[i])&&(n=(p<3?l(n):p>3?l(e,o,n):l(e,o))||n);return p>3&&n&&Object.defineProperty(e,o,n),n};import{render,html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import Modal from"TYPO3/CMS/Backend/Modal.js";!function(t){t.modalBody=".t3js-modal-body"}(Selectors||(Selectors={}));let MfaTotpUrlButton=class extends LitElement{constructor(){super(),this.addEventListener("click",t=>{t.preventDefault(),this.showTotpAuthUrlModal()})}render(){return html`<slot></slot>`}showTotpAuthUrlModal(){Modal.advanced({title:this.title,content:"",buttons:[{trigger:()=>Modal.dismiss(),text:this.ok||"OK",active:!0,btnClass:"btn-default",name:"ok"}],callback:t=>{render(html` +var Selectors,__decorate=function(t,e,o,r){var l,p=arguments.length,n=p<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(t,e,o,r);else for(var i=t.length-1;i>=0;i--)(l=t[i])&&(n=(p<3?l(n):p>3?l(e,o,n):l(e,o))||n);return p>3&&n&&Object.defineProperty(e,o,n),n};import{render,html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import Modal from"@typo3/backend/modal.js";!function(t){t.modalBody=".t3js-modal-body"}(Selectors||(Selectors={}));let MfaTotpUrlButton=class extends LitElement{constructor(){super(),this.addEventListener("click",t=>{t.preventDefault(),this.showTotpAuthUrlModal()})}render(){return html`<slot></slot>`}showTotpAuthUrlModal(){Modal.advanced({title:this.title,content:"",buttons:[{trigger:()=>Modal.dismiss(),text:this.ok||"OK",active:!0,btnClass:"btn-default",name:"ok"}],callback:t=>{render(html` <p>${this.description}</p> <pre>${this.url}</pre> `,t[0].querySelector(Selectors.modalBody))}})}};__decorate([property({type:String})],MfaTotpUrlButton.prototype,"url",void 0),__decorate([property({type:String})],MfaTotpUrlButton.prototype,"title",void 0),__decorate([property({type:String})],MfaTotpUrlButton.prototype,"description",void 0),__decorate([property({type:String})],MfaTotpUrlButton.prototype,"ok",void 0),MfaTotpUrlButton=__decorate([customElement("typo3-mfa-totp-url-info-button")],MfaTotpUrlButton); \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/DocumentService.js b/typo3/sysext/core/Resources/Public/JavaScript/document-service.js similarity index 100% rename from typo3/sysext/core/Resources/Public/JavaScript/DocumentService.js rename to typo3/sysext/core/Resources/Public/JavaScript/document-service.js diff --git a/typo3/sysext/core/Resources/Public/JavaScript/event/debounce-event.js b/typo3/sysext/core/Resources/Public/JavaScript/event/debounce-event.js new file mode 100644 index 0000000000000000000000000000000000000000..bce0859a2b041e35d1c7d53e41106d21cd0dca4c --- /dev/null +++ b/typo3/sysext/core/Resources/Public/JavaScript/event/debounce-event.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import RegularEvent from"@typo3/core/event/regular-event.js";class DebounceEvent extends RegularEvent{constructor(e,t,l=250,n=!1){super(e,t),this.callback=this.debounce(this.callback,l,n)}debounce(e,t,l){let n=null;return function(...u){const c=l&&!n;clearTimeout(n),c?(e.apply(this,u),n=setTimeout(()=>{n=null},t)):n=setTimeout(()=>{n=null,l||e.apply(this,u)},t)}}}export default DebounceEvent; \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Event/EventInterface.js b/typo3/sysext/core/Resources/Public/JavaScript/event/event-interface.js similarity index 100% rename from typo3/sysext/core/Resources/Public/JavaScript/Event/EventInterface.js rename to typo3/sysext/core/Resources/Public/JavaScript/event/event-interface.js diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Event/RegularEvent.js b/typo3/sysext/core/Resources/Public/JavaScript/event/regular-event.js similarity index 100% rename from typo3/sysext/core/Resources/Public/JavaScript/Event/RegularEvent.js rename to typo3/sysext/core/Resources/Public/JavaScript/event/regular-event.js diff --git a/typo3/sysext/core/Resources/Public/JavaScript/event/request-animation-frame-event.js b/typo3/sysext/core/Resources/Public/JavaScript/event/request-animation-frame-event.js new file mode 100644 index 0000000000000000000000000000000000000000..4a4bfd2d1c57501405bd39791fc50f7dbba583e9 --- /dev/null +++ b/typo3/sysext/core/Resources/Public/JavaScript/event/request-animation-frame-event.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import RegularEvent from"@typo3/core/event/regular-event.js";class RequestAnimationFrameEvent extends RegularEvent{constructor(e,t){super(e,t),this.callback=this.req(this.callback)}req(e){let t=null;return()=>{const n=this,a=arguments;t&&window.cancelAnimationFrame(t),t=window.requestAnimationFrame((function(){e.apply(n,a)}))}}}export default RequestAnimationFrameEvent; \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/event/throttle-event.js b/typo3/sysext/core/Resources/Public/JavaScript/event/throttle-event.js new file mode 100644 index 0000000000000000000000000000000000000000..c8965ccc9d3f43b629c069ebc00bf3a514294228 --- /dev/null +++ b/typo3/sysext/core/Resources/Public/JavaScript/event/throttle-event.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import RegularEvent from"@typo3/core/event/regular-event.js";class ThrottleEvent extends RegularEvent{constructor(t,e,r){super(t,e),this.callback=this.throttle(e,r)}throttle(t,e){let r=!1;return function(...l){r||(t.apply(this,l),r=!0,setTimeout(()=>{r=!1,t.apply(this,l)},e))}}}export default ThrottleEvent; \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/JavaScriptItemHandler.js b/typo3/sysext/core/Resources/Public/JavaScript/java-script-item-handler.js similarity index 82% rename from typo3/sysext/core/Resources/Public/JavaScript/JavaScriptItemHandler.js rename to typo3/sysext/core/Resources/Public/JavaScript/java-script-item-handler.js index 82d10d85516dca129ef18ae7b71b0715e0b4899a..6fe5ffe8da3de105c4eb508e139014073bb28975 100644 --- a/typo3/sysext/core/Resources/Public/JavaScript/JavaScriptItemHandler.js +++ b/typo3/sysext/core/Resources/Public/JavaScript/java-script-item-handler.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -"use strict";if(document.currentScript){const t=document.currentScript.textContent.replace(/^\s*\/\*\s*|\s*\*\/\s*/g,""),e=JSON.parse(t);(t=>import(t).catch(()=>window.importShim(t)))("TYPO3/CMS/Core/JavaScriptItemProcessor.js").then(({JavaScriptItemProcessor:t})=>{(new t).processItems(e)})} \ No newline at end of file +"use strict";if(document.currentScript){const t=document.currentScript.textContent.replace(/^\s*\/\*\s*|\s*\*\/\s*/g,""),e=JSON.parse(t);(t=>import(t).catch(()=>window.importShim(t)))("@typo3/core/java-script-item-processor.js").then(({JavaScriptItemProcessor:t})=>{(new t).processItems(e)})} \ No newline at end of file diff --git a/typo3/sysext/core/Resources/Public/JavaScript/JavaScriptItemProcessor.js b/typo3/sysext/core/Resources/Public/JavaScript/java-script-item-processor.js similarity index 100% rename from typo3/sysext/core/Resources/Public/JavaScript/JavaScriptItemProcessor.js rename to typo3/sysext/core/Resources/Public/JavaScript/java-script-item-processor.js diff --git a/typo3/sysext/core/Resources/Public/JavaScript/RequireJSConfigHandler.js b/typo3/sysext/core/Resources/Public/JavaScript/require-jsconfig-handler.js similarity index 100% rename from typo3/sysext/core/Resources/Public/JavaScript/RequireJSConfigHandler.js rename to typo3/sysext/core/Resources/Public/JavaScript/require-jsconfig-handler.js diff --git a/typo3/sysext/core/Resources/Public/JavaScript/requirejs-loader.js b/typo3/sysext/core/Resources/Public/JavaScript/requirejs-loader.js index fe01928337d91afc496e0d5c6f9dc01ce95b648a..77adf3d7b997391c182610b25944aecd5276282a 100644 --- a/typo3/sysext/core/Resources/Public/JavaScript/requirejs-loader.js +++ b/typo3/sysext/core/Resources/Public/JavaScript/requirejs-loader.js @@ -160,7 +160,7 @@ req.load = function(context, name, url) { /* Shim to load module via ES6 if available, fallback to original loading otherwise */ - const esmName = name in importMap ? name : name + '.js'; + const esmName = name in importMap ? name : name.replace(/^TYPO3\/CMS\//, '@typo3/').replace(/[A-Z]+/g, str => '-' + str.toLowerCase()).replace(/(\/|^)-/g, '$1') + '.js'; if (isDefinedInImportMap(esmName)) { const importPromise = moduleImporter(esmName); importPromise.catch(function(e) { diff --git a/typo3/sysext/core/Resources/Public/JavaScript/SecurityUtility.js b/typo3/sysext/core/Resources/Public/JavaScript/security-utility.js similarity index 100% rename from typo3/sysext/core/Resources/Public/JavaScript/SecurityUtility.js rename to typo3/sysext/core/Resources/Public/JavaScript/security-utility.js diff --git a/typo3/sysext/core/Tests/Functional/Page/PageRendererTest.php b/typo3/sysext/core/Tests/Functional/Page/PageRendererTest.php index 3ecb076eca8c5d8ea8ea8b752b7e6cedfea5129c..f7f0ad0f7ee66c4ef2b2b9706777c4cbd69823bc 100644 --- a/typo3/sysext/core/Tests/Functional/Page/PageRendererTest.php +++ b/typo3/sysext/core/Tests/Functional/Page/PageRendererTest.php @@ -89,8 +89,8 @@ class PageRendererTest extends FunctionalTestCase $headerData = $expectedHeaderData = '<tag method="private" name="test" />'; $subject->addHeaderData($headerData); - $subject->loadJavaScriptModule('TYPO3/CMS/Core/Ajax/AjaxRequest.js'); - $expectedJavaScriptModuleString = '"type":"javaScriptModuleInstruction","payload":{"name":"TYPO3\\/CMS\\/Core\\/Ajax\\/AjaxRequest.js"'; + $subject->loadJavaScriptModule('@typo3/core/ajax/ajax-request.js'); + $expectedJavaScriptModuleString = '"type":"javaScriptModuleInstruction","payload":{"name":"@typo3\/core\/ajax\/ajax-request.js"'; $subject->addJsLibrary( 'test', @@ -263,7 +263,7 @@ class PageRendererTest extends FunctionalTestCase if ($requestType === SystemEnvironmentBuilder::REQUESTTYPE_FE) { $expectedInlineAssignmentsPrefix = 'var TYPO3 = Object.assign(TYPO3 || {}, Object.fromEntries(Object.entries({"settings":'; } else { - $expectedInlineAssignmentsPrefix = '<script src="typo3/sysext/core/Resources/Public/JavaScript/JavaScriptItemHandler.js?%i" async="async">/* [{"type":"globalAssignment","payload":{"TYPO3":{"settings":'; + $expectedInlineAssignmentsPrefix = '<script src="typo3/sysext/core/Resources/Public/JavaScript/java-script-item-handler.js?%i" async="async">/* [{"type":"globalAssignment","payload":{"TYPO3":{"settings":'; } $renderedString = $subject->render(); diff --git a/typo3/sysext/core/Tests/JavaScript/Ajax/AjaxRequestTest.js b/typo3/sysext/core/Tests/JavaScript/Ajax/AjaxRequestTest.js deleted file mode 100644 index 05bcbb10d17268b59362e1bfaae484f199da25dc..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Tests/JavaScript/Ajax/AjaxRequestTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";describe("TYPO3/CMS/Core/Ajax/AjaxRequest",()=>{let e;beforeEach(()=>{const t=new Promise((t,o)=>{e={resolve:t,reject:o}});spyOn(window,"fetch").and.returnValue(t)}),it("sends GET request",()=>{new AjaxRequest("https://example.com").get(),expect(window.fetch).toHaveBeenCalledWith("https://example.com/",jasmine.objectContaining({method:"GET"}))});for(let e of["POST","PUT","DELETE"])describe(`send a ${e} request`,()=>{for(let t of function*(){yield["object as payload",e,{foo:"bar",bar:"baz",nested:{works:"yes"}},()=>{const e=new FormData;return e.set("foo","bar"),e.set("bar","baz"),e.set("nested[works]","yes"),e},{}],yield["JSON object as payload",e,{foo:"bar",bar:"baz",nested:{works:"yes"}},()=>JSON.stringify({foo:"bar",bar:"baz",nested:{works:"yes"}}),{"Content-Type":"application/json"}],yield["JSON string as payload",e,JSON.stringify({foo:"bar",bar:"baz",nested:{works:"yes"}}),()=>JSON.stringify({foo:"bar",bar:"baz",nested:{works:"yes"}}),{"Content-Type":"application/json"}]}()){let[e,o,a,r,n]=t;const s=o.toLowerCase();it("with "+e,e=>{new AjaxRequest("https://example.com")[s](a,{headers:n}),expect(window.fetch).toHaveBeenCalledWith("https://example.com/",jasmine.objectContaining({method:o,body:r()})),e()})}});describe("send GET requests",()=>{for(let t of function*(){yield["plaintext","foobar huselpusel",{},(e,t)=>{expect("string"==typeof e).toBeTruthy(),expect(e).toEqual(t)}],yield["JSON",JSON.stringify({foo:"bar",baz:"bencer"}),{"Content-Type":"application/json"},(e,t)=>{expect("object"==typeof e).toBeTruthy(),expect(JSON.stringify(e)).toEqual(t)}],yield["JSON with utf-8",JSON.stringify({foo:"bar",baz:"bencer"}),{"Content-Type":"application/json; charset=utf-8"},(e,t)=>{expect("object"==typeof e).toBeTruthy(),expect(JSON.stringify(e)).toEqual(t)}]}()){let[o,a,r,n]=t;it("receives a "+o+" response",t=>{const o=new Response(a,{headers:r});e.resolve(o),new AjaxRequest("https://example.com").get().then(async e=>{const o=await e.resolve();expect(window.fetch).toHaveBeenCalledWith("https://example.com/",jasmine.objectContaining({method:"GET"})),n(o,a),t()})})}}),describe("send requests with different input urls",()=>{for(let e of function*(){yield["absolute url with domain","https://example.com",{},"https://example.com/"],yield["absolute url with domain, with query parameter","https://example.com",{foo:"bar",bar:{baz:"bencer"}},"https://example.com/?foo=bar&bar[baz]=bencer"],yield["absolute url without domain","/foo/bar",{},window.location.origin+"/foo/bar"],yield["absolute url without domain, with query parameter","/foo/bar",{foo:"bar",bar:{baz:"bencer"}},window.location.origin+"/foo/bar?foo=bar&bar[baz]=bencer"],yield["relative url without domain","foo/bar",{},window.location.origin+"/foo/bar"],yield["relative url without domain, with query parameter","foo/bar",{foo:"bar",bar:{baz:"bencer"}},window.location.origin+"/foo/bar?foo=bar&bar[baz]=bencer"],yield["fallback to current script if not defined","?foo=bar&baz=bencer",{},window.location.origin+window.location.pathname+"?foo=bar&baz=bencer"]}()){let[t,o,a,r]=e;it("with "+t,()=>{new AjaxRequest(o).withQueryArguments(a).get(),expect(window.fetch).toHaveBeenCalledWith(r,jasmine.objectContaining({method:"GET"}))})}}),describe("send requests with query arguments",()=>{for(let e of function*(){yield["single level of arguments",{foo:"bar",bar:"baz"},"https://example.com/?foo=bar&bar=baz"],yield["nested arguments",{foo:"bar",bar:{baz:"bencer"}},"https://example.com/?foo=bar&bar[baz]=bencer"],yield["string argument","hello=world&foo=bar","https://example.com/?hello=world&foo=bar"],yield["array of arguments",["foo=bar","husel=pusel"],"https://example.com/?foo=bar&husel=pusel"],yield["object with array",{foo:["bar","baz"]},"https://example.com/?foo[0]=bar&foo[1]=baz"],yield["complex object",{foo:"bar",nested:{husel:"pusel",bar:"baz",array:["5","6"]},array:["1","2"]},"https://example.com/?foo=bar&nested[husel]=pusel&nested[bar]=baz&nested[array][0]=5&nested[array][1]=6&array[0]=1&array[1]=2"],yield["complex, deeply nested object",{foo:"bar",nested:{husel:"pusel",bar:"baz",array:["5","6"],deep_nested:{husel:"pusel",bar:"baz",array:["5","6"]}},array:["1","2"]},"https://example.com/?foo=bar&nested[husel]=pusel&nested[bar]=baz&nested[array][0]=5&nested[array][1]=6&nested[deep_nested][husel]=pusel&nested[deep_nested][bar]=baz&nested[deep_nested][array][0]=5&nested[deep_nested][array][1]=6&array[0]=1&array[1]=2"]}()){let[t,o,a]=e;it("with "+t,()=>{new AjaxRequest("https://example.com/").withQueryArguments(o).get(),expect(window.fetch).toHaveBeenCalledWith(a,jasmine.objectContaining({method:"GET"}))})}})}); \ No newline at end of file diff --git a/typo3/sysext/core/Tests/JavaScript/Ajax/InputTransformerTest.js b/typo3/sysext/core/Tests/JavaScript/Ajax/InputTransformerTest.js deleted file mode 100644 index 2a66fda2baac60c474322887f270282b661c11b1..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Tests/JavaScript/Ajax/InputTransformerTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{InputTransformer}from"TYPO3/CMS/Core/Ajax/InputTransformer.js";describe("TYPO3/CMS/Core/Ajax/InputTransformer",()=>{it("converts object to FormData",()=>{const a=new FormData;a.set("foo","bar"),a.set("bar","baz"),a.set("nested[works]","yes"),expect(InputTransformer.toFormData({foo:"bar",bar:"baz",nested:{works:"yes"}})).toEqual(a)}),it("undefined values are removed in FormData",()=>{const a={foo:"bar",bar:"baz",removeme:void 0},r=new FormData;r.set("foo","bar"),r.set("bar","baz"),expect(InputTransformer.toFormData(a)).toEqual(r)}),it("converts object to SearchParams",()=>{expect(InputTransformer.toSearchParams({foo:"bar",bar:"baz",nested:{works:"yes"}})).toEqual("foo=bar&bar=baz&nested[works]=yes")}),it("merges array to SearchParams",()=>{expect(InputTransformer.toSearchParams(["foo=bar","bar=baz"])).toEqual("foo=bar&bar=baz")}),it("keeps string in SearchParams",()=>{expect(InputTransformer.toSearchParams("foo=bar&bar=baz")).toEqual("foo=bar&bar=baz")}),it("undefined values are removed in SearchParams",()=>{const a={foo:"bar",bar:"baz",removeme:void 0};expect(InputTransformer.toSearchParams(a)).toEqual("foo=bar&bar=baz")})}); \ No newline at end of file diff --git a/typo3/sysext/core/Tests/JavaScript/SecurityUtilityTest.js b/typo3/sysext/core/Tests/JavaScript/SecurityUtilityTest.js deleted file mode 100644 index 9f8682e0daa5e65743b188c73a27aa47228b0081..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Tests/JavaScript/SecurityUtilityTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";describe("TYPO3/CMS/Core/SecurityUtility",()=>{it("generates random hex value",()=>{for(let e of function*(){yield 1,yield 20,yield 39}()){const t=(new SecurityUtility).getRandomHexValue(e);expect(t.length).toBe(e)}}),it("throws SyntaxError on invalid length",()=>{for(let e of function*(){yield 0,yield-90,yield 10.3}())expect(()=>(new SecurityUtility).getRandomHexValue(e)).toThrowError(SyntaxError)}),it("encodes HTML",()=>{expect((new SecurityUtility).encodeHtml("<>\"'&")).toBe("<>"'&")}),it("removes HTML from string",()=>{expect((new SecurityUtility).stripHtml('<img src="" onerror="alert(\'1\')">oh noes')).toBe("oh noes"),expect((new SecurityUtility).encodeHtml("<>\"'&")).toBe("<>"'&")})}); \ No newline at end of file diff --git a/typo3/sysext/core/Tests/JavaScript/ajax/ajax-request-test.js b/typo3/sysext/core/Tests/JavaScript/ajax/ajax-request-test.js new file mode 100644 index 0000000000000000000000000000000000000000..e31f82a2a83a0eaab253b435b6d2c73e1a2992f0 --- /dev/null +++ b/typo3/sysext/core/Tests/JavaScript/ajax/ajax-request-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";describe("@typo3/core/ajax/ajax-request",()=>{let e;beforeEach(()=>{const t=new Promise((t,o)=>{e={resolve:t,reject:o}});spyOn(window,"fetch").and.returnValue(t)}),it("sends GET request",()=>{new AjaxRequest("https://example.com").get(),expect(window.fetch).toHaveBeenCalledWith("https://example.com/",jasmine.objectContaining({method:"GET"}))});for(let e of["POST","PUT","DELETE"])describe(`send a ${e} request`,()=>{for(let t of function*(){yield["object as payload",e,{foo:"bar",bar:"baz",nested:{works:"yes"}},()=>{const e=new FormData;return e.set("foo","bar"),e.set("bar","baz"),e.set("nested[works]","yes"),e},{}],yield["JSON object as payload",e,{foo:"bar",bar:"baz",nested:{works:"yes"}},()=>JSON.stringify({foo:"bar",bar:"baz",nested:{works:"yes"}}),{"Content-Type":"application/json"}],yield["JSON string as payload",e,JSON.stringify({foo:"bar",bar:"baz",nested:{works:"yes"}}),()=>JSON.stringify({foo:"bar",bar:"baz",nested:{works:"yes"}}),{"Content-Type":"application/json"}]}()){let[e,o,a,r,n]=t;const s=o.toLowerCase();it("with "+e,e=>{new AjaxRequest("https://example.com")[s](a,{headers:n}),expect(window.fetch).toHaveBeenCalledWith("https://example.com/",jasmine.objectContaining({method:o,body:r()})),e()})}});describe("send GET requests",()=>{for(let t of function*(){yield["plaintext","foobar huselpusel",{},(e,t)=>{expect("string"==typeof e).toBeTruthy(),expect(e).toEqual(t)}],yield["JSON",JSON.stringify({foo:"bar",baz:"bencer"}),{"Content-Type":"application/json"},(e,t)=>{expect("object"==typeof e).toBeTruthy(),expect(JSON.stringify(e)).toEqual(t)}],yield["JSON with utf-8",JSON.stringify({foo:"bar",baz:"bencer"}),{"Content-Type":"application/json; charset=utf-8"},(e,t)=>{expect("object"==typeof e).toBeTruthy(),expect(JSON.stringify(e)).toEqual(t)}]}()){let[o,a,r,n]=t;it("receives a "+o+" response",t=>{const o=new Response(a,{headers:r});e.resolve(o),new AjaxRequest("https://example.com").get().then(async e=>{const o=await e.resolve();expect(window.fetch).toHaveBeenCalledWith("https://example.com/",jasmine.objectContaining({method:"GET"})),n(o,a),t()})})}}),describe("send requests with different input urls",()=>{for(let e of function*(){yield["absolute url with domain","https://example.com",{},"https://example.com/"],yield["absolute url with domain, with query parameter","https://example.com",{foo:"bar",bar:{baz:"bencer"}},"https://example.com/?foo=bar&bar[baz]=bencer"],yield["absolute url without domain","/foo/bar",{},window.location.origin+"/foo/bar"],yield["absolute url without domain, with query parameter","/foo/bar",{foo:"bar",bar:{baz:"bencer"}},window.location.origin+"/foo/bar?foo=bar&bar[baz]=bencer"],yield["relative url without domain","foo/bar",{},window.location.origin+"/foo/bar"],yield["relative url without domain, with query parameter","foo/bar",{foo:"bar",bar:{baz:"bencer"}},window.location.origin+"/foo/bar?foo=bar&bar[baz]=bencer"],yield["fallback to current script if not defined","?foo=bar&baz=bencer",{},window.location.origin+window.location.pathname+"?foo=bar&baz=bencer"]}()){let[t,o,a,r]=e;it("with "+t,()=>{new AjaxRequest(o).withQueryArguments(a).get(),expect(window.fetch).toHaveBeenCalledWith(r,jasmine.objectContaining({method:"GET"}))})}}),describe("send requests with query arguments",()=>{for(let e of function*(){yield["single level of arguments",{foo:"bar",bar:"baz"},"https://example.com/?foo=bar&bar=baz"],yield["nested arguments",{foo:"bar",bar:{baz:"bencer"}},"https://example.com/?foo=bar&bar[baz]=bencer"],yield["string argument","hello=world&foo=bar","https://example.com/?hello=world&foo=bar"],yield["array of arguments",["foo=bar","husel=pusel"],"https://example.com/?foo=bar&husel=pusel"],yield["object with array",{foo:["bar","baz"]},"https://example.com/?foo[0]=bar&foo[1]=baz"],yield["complex object",{foo:"bar",nested:{husel:"pusel",bar:"baz",array:["5","6"]},array:["1","2"]},"https://example.com/?foo=bar&nested[husel]=pusel&nested[bar]=baz&nested[array][0]=5&nested[array][1]=6&array[0]=1&array[1]=2"],yield["complex, deeply nested object",{foo:"bar",nested:{husel:"pusel",bar:"baz",array:["5","6"],deep_nested:{husel:"pusel",bar:"baz",array:["5","6"]}},array:["1","2"]},"https://example.com/?foo=bar&nested[husel]=pusel&nested[bar]=baz&nested[array][0]=5&nested[array][1]=6&nested[deep_nested][husel]=pusel&nested[deep_nested][bar]=baz&nested[deep_nested][array][0]=5&nested[deep_nested][array][1]=6&array[0]=1&array[1]=2"]}()){let[t,o,a]=e;it("with "+t,()=>{new AjaxRequest("https://example.com/").withQueryArguments(o).get(),expect(window.fetch).toHaveBeenCalledWith(a,jasmine.objectContaining({method:"GET"}))})}})}); \ No newline at end of file diff --git a/typo3/sysext/core/Tests/JavaScript/ajax/input-transformer-test.js b/typo3/sysext/core/Tests/JavaScript/ajax/input-transformer-test.js new file mode 100644 index 0000000000000000000000000000000000000000..368f605617d62b5d7ac0153e245d3c205aac17d9 --- /dev/null +++ b/typo3/sysext/core/Tests/JavaScript/ajax/input-transformer-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{InputTransformer}from"@typo3/core/ajax/input-transformer.js";describe("@typo3/core/ajax/input-transformer",()=>{it("converts object to FormData",()=>{const a=new FormData;a.set("foo","bar"),a.set("bar","baz"),a.set("nested[works]","yes"),expect(InputTransformer.toFormData({foo:"bar",bar:"baz",nested:{works:"yes"}})).toEqual(a)}),it("undefined values are removed in FormData",()=>{const a={foo:"bar",bar:"baz",removeme:void 0},r=new FormData;r.set("foo","bar"),r.set("bar","baz"),expect(InputTransformer.toFormData(a)).toEqual(r)}),it("converts object to SearchParams",()=>{expect(InputTransformer.toSearchParams({foo:"bar",bar:"baz",nested:{works:"yes"}})).toEqual("foo=bar&bar=baz&nested[works]=yes")}),it("merges array to SearchParams",()=>{expect(InputTransformer.toSearchParams(["foo=bar","bar=baz"])).toEqual("foo=bar&bar=baz")}),it("keeps string in SearchParams",()=>{expect(InputTransformer.toSearchParams("foo=bar&bar=baz")).toEqual("foo=bar&bar=baz")}),it("undefined values are removed in SearchParams",()=>{const a={foo:"bar",bar:"baz",removeme:void 0};expect(InputTransformer.toSearchParams(a)).toEqual("foo=bar&bar=baz")})}); \ No newline at end of file diff --git a/typo3/sysext/core/Tests/JavaScript/security-utility-test.js b/typo3/sysext/core/Tests/JavaScript/security-utility-test.js new file mode 100644 index 0000000000000000000000000000000000000000..e5283a6447627c17806c462fef78410f9858d63c --- /dev/null +++ b/typo3/sysext/core/Tests/JavaScript/security-utility-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import SecurityUtility from"@typo3/core/security-utility.js";describe("@typo3/core/security-utility",()=>{it("generates random hex value",()=>{for(let t of function*(){yield 1,yield 20,yield 39}()){const e=(new SecurityUtility).getRandomHexValue(t);expect(e.length).toBe(t)}}),it("throws SyntaxError on invalid length",()=>{for(let t of function*(){yield 0,yield-90,yield 10.3}())expect(()=>(new SecurityUtility).getRandomHexValue(t)).toThrowError(SyntaxError)}),it("encodes HTML",()=>{expect((new SecurityUtility).encodeHtml("<>\"'&")).toBe("<>"'&")}),it("removes HTML from string",()=>{expect((new SecurityUtility).stripHtml('<img src="" onerror="alert(\'1\')">oh noes')).toBe("oh noes"),expect((new SecurityUtility).encodeHtml("<>\"'&")).toBe("<>"'&")})}); \ No newline at end of file diff --git a/typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package2/Configuration/JavaScriptModules.php b/typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package2/Configuration/JavaScriptModules.php index 5305ef0cceebe1d42dd0095fb7ca7a8532418430..30a712c5ae5df6530f99994dbe29ed42d15d7b02 100644 --- a/typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package2/Configuration/JavaScriptModules.php +++ b/typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package2/Configuration/JavaScriptModules.php @@ -5,6 +5,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Package2/' => 'EXT:package2/Resources/Public/JavaScript/', + '@typo3/package2/' => 'EXT:package2/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package3/Configuration/JavaScriptModules.php b/typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package3/Configuration/JavaScriptModules.php index 4e29b48d10d0700ab1ee6b5c15c1a8b27f20d4be..8c67cca2c6846d4424f376236fd5eea2a8eedf24 100644 --- a/typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package3/Configuration/JavaScriptModules.php +++ b/typo3/sysext/core/Tests/Unit/Page/Fixtures/ImportMap/package3/Configuration/JavaScriptModules.php @@ -6,7 +6,7 @@ return [ 'package2', ], 'imports' => [ - 'TYPO3/CMS/Package3/' => [ + '@typo3/package3/' => [ 'path' => 'EXT:package3/Resources/Public/JavaScript/', 'exclude' => [ 'EXT:package3/Resources/Public/JavaScript/Contrib/', @@ -16,6 +16,6 @@ return [ 'lib1' => 'EXT:package3/Resources/Public/JavaScript/Contrib/lib1.js', 'lib2' => 'EXT:package3/Resources/Public/JavaScript/Contrib/lib2.js', // overriding a file from EXT:package2 - 'TYPO3/CMS/Package2/File.js' => 'EXT:package3/Resources/Public/JavaScript/Overrides/Package2/File.js', + '@typo3/package2/File.js' => 'EXT:package3/Resources/Public/JavaScript/Overrides/Package2/File.js', ], ]; diff --git a/typo3/sysext/core/Tests/Unit/Page/ImportMapTest.php b/typo3/sysext/core/Tests/Unit/Page/ImportMapTest.php index ab51bf240fc223f0df22bbb640bc0149ce6486be..8a7d049dbe9638f42ea6f9a6b79d5ec353f1c68d 100644 --- a/typo3/sysext/core/Tests/Unit/Page/ImportMapTest.php +++ b/typo3/sysext/core/Tests/Unit/Page/ImportMapTest.php @@ -137,14 +137,14 @@ class ImportMapTest extends UnitTestCase $this->packages = ['package2', 'package3']; $importMap = new ImportMap($this->getPackages()); - $importMap->includeImportsFor('TYPO3/CMS/Package2/File.js'); + $importMap->includeImportsFor('@typo3/package2/File.js'); $output = $importMap->render('/', 'rAnd0m'); - self::assertStringContainsString('"TYPO3/CMS/Package2/File.js":"/Fixtures/ImportMap/package3/Resources/Public/JavaScript/Overrides/Package2/File.js?bust=', $output); + self::assertStringContainsString('"@typo3/package2/File.js":"/Fixtures/ImportMap/package3/Resources/Public/JavaScript/Overrides/Package2/File.js?bust=', $output); self::assertThat( $output, self::logicalNot( - self::stringContains('"TYPO3/CMS/Package2/File.js":"/Fixtures/ImportMap/package2/') + self::stringContains('"@typo3/package2/File.js":"/Fixtures/ImportMap/package2/') ) ); } @@ -156,7 +156,7 @@ class ImportMapTest extends UnitTestCase { $this->packages = ['core', 'package2']; $importMap = new ImportMap($this->getPackages()); - $importMap->includeImportsFor('TYPO3/CMS/Package2/File.js'); + $importMap->includeImportsFor('@typo3/package2/file.js'); $output = $importMap->render('/', 'rAnd0m'); self::assertStringContainsString('@typo3/core/', $output); @@ -169,7 +169,7 @@ class ImportMapTest extends UnitTestCase { $this->packages = ['core', 'package2', 'package4']; $importMap = new ImportMap($this->getPackages()); - $importMap->includeImportsFor('TYPO3/CMS/Package2/File.js'); + $importMap->includeImportsFor('@typo3/package2/file.js'); $output = $importMap->render('/', 'rAnd0m'); self::assertThat( @@ -188,7 +188,7 @@ class ImportMapTest extends UnitTestCase $this->packages = ['core', 'package2', 'package4']; $importMap = new ImportMap($this->getPackages()); $importMap->includeAllImports(); - $importMap->includeImportsFor('TYPO3/CMS/Package2/File.js'); + $importMap->includeImportsFor('@typo3/package2/file.js'); $output = $importMap->render('/', 'rAnd0m'); self::assertStringContainsString('@typo3/core/', $output); diff --git a/typo3/sysext/dashboard/Classes/Controller/DashboardController.php b/typo3/sysext/dashboard/Classes/Controller/DashboardController.php index 1ca71b71c33b02d236152aa6382c63d41ed95d42..c93755e46c928623e8892ee447fd7f0a35f73348 100644 --- a/typo3/sysext/dashboard/Classes/Controller/DashboardController.php +++ b/typo3/sysext/dashboard/Classes/Controller/DashboardController.php @@ -184,13 +184,13 @@ class DashboardController { $this->pageRenderer->loadJavaScriptModule('muuri'); $this->pageRenderer->loadJavaScriptModule('web-animate'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Dashboard/Grid.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Dashboard/WidgetContentCollector.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Dashboard/WidgetSelector.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Dashboard/WidgetRefresh.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Dashboard/WidgetRemover.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Dashboard/DashboardModal.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Dashboard/DashboardDelete.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/dashboard/grid.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/dashboard/widget-content-collector.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/dashboard/widget-selector.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/dashboard/widget-refresh.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/dashboard/widget-remover.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/dashboard/dashboard-modal.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/dashboard/dashboard-delete.js'); $this->pageRenderer->addCssFile('EXT:dashboard/Resources/Public/Css/dashboard.css'); } diff --git a/typo3/sysext/dashboard/Classes/Widgets/BarChartWidget.php b/typo3/sysext/dashboard/Classes/Widgets/BarChartWidget.php index 6f275ef9e24991bf73bb97d2a0c7545c1fc44162..717505cdfa899927e196b95d6319939a2ee82a07 100644 --- a/typo3/sysext/dashboard/Classes/Widgets/BarChartWidget.php +++ b/typo3/sysext/dashboard/Classes/Widgets/BarChartWidget.php @@ -104,8 +104,8 @@ class BarChartWidget implements WidgetInterface, RequestAwareWidgetInterface, Ev public function getJavaScriptModuleInstructions(): array { return [ - JavaScriptModuleInstruction::create('TYPO3/CMS/Dashboard/Contrib/chartjs.js'), - JavaScriptModuleInstruction::create('TYPO3/CMS/Dashboard/ChartInitializer.js'), + JavaScriptModuleInstruction::create('@typo3/dashboard/contrib/chartjs.js'), + JavaScriptModuleInstruction::create('@typo3/dashboard/chart-initializer.js'), ]; } diff --git a/typo3/sysext/dashboard/Classes/Widgets/DoughnutChartWidget.php b/typo3/sysext/dashboard/Classes/Widgets/DoughnutChartWidget.php index 903f1e1864f7823f856ec94a61ba2b2ef7d7c9e9..e06eec98e09d6127c8f9528f100c6e223031871a 100644 --- a/typo3/sysext/dashboard/Classes/Widgets/DoughnutChartWidget.php +++ b/typo3/sysext/dashboard/Classes/Widgets/DoughnutChartWidget.php @@ -90,8 +90,8 @@ class DoughnutChartWidget implements WidgetInterface, RequestAwareWidgetInterfac public function getJavaScriptModuleInstructions(): array { return [ - JavaScriptModuleInstruction::create('TYPO3/CMS/Dashboard/Contrib/chartjs.js'), - JavaScriptModuleInstruction::create('TYPO3/CMS/Dashboard/ChartInitializer.js'), + JavaScriptModuleInstruction::create('@typo3/dashboard/contrib/chartjs.js'), + JavaScriptModuleInstruction::create('@typo3/dashboard/chart-initializer.js'), ]; } diff --git a/typo3/sysext/dashboard/Configuration/JavaScriptModules.php b/typo3/sysext/dashboard/Configuration/JavaScriptModules.php index 2c8a08400a6f75353ce7c834d9a747fbf1bd3f38..44d6640da4bcc3a99441b439b1940c40f3b24eae 100644 --- a/typo3/sysext/dashboard/Configuration/JavaScriptModules.php +++ b/typo3/sysext/dashboard/Configuration/JavaScriptModules.php @@ -6,13 +6,13 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Dashboard/' => [ + '@typo3/dashboard/' => [ 'path' => 'EXT:dashboard/Resources/Public/JavaScript/', 'exclude' => [ 'EXT:dashboard/Resources/Public/JavaScript/Contrib/', ], ], - 'TYPO3/CMS/Dashboard/Contrib/chartjs.js' => 'EXT:dashboard/Resources/Public/JavaScript/Contrib/chartjs.js', + '@typo3/dashboard/contrib/chartjs.js' => 'EXT:dashboard/Resources/Public/JavaScript/Contrib/chartjs.js', 'muuri' => 'EXT:dashboard/Resources/Public/JavaScript/Contrib/muuri.js', 'web-animate' => 'EXT:dashboard/Resources/Public/JavaScript/Contrib/web-animate.js', ], diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/ChartInitializer.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/ChartInitializer.js deleted file mode 100644 index 3a3a2ac3e4a77728c0def3d954dc2bc8f7b5863e..0000000000000000000000000000000000000000 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/ChartInitializer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Chart from"TYPO3/CMS/Dashboard/Contrib/chartjs.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class ChartInitializer{constructor(){this.selector=".dashboard-item",this.initialize()}initialize(){new RegularEvent("widgetContentRendered",(function(t){t.preventDefault();const e=t.detail;if(void 0===e||void 0===e.graphConfig)return;let i,r=this.querySelector("canvas");null!==r&&(i=r.getContext("2d")),void 0!==i&&new Chart(i,e.graphConfig)})).delegateTo(document,this.selector)}}export default new ChartInitializer; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/DashboardDelete.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/DashboardDelete.js deleted file mode 100644 index 14200a4caea72e4e0954e847798443eb45635668..0000000000000000000000000000000000000000 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/DashboardDelete.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Modal from"TYPO3/CMS/Backend/Modal.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class DashboardDelete{constructor(){this.selector=".js-dashboard-delete",this.initialize()}initialize(){new RegularEvent("click",(function(e){e.preventDefault();Modal.confirm(this.dataset.modalTitle,this.dataset.modalQuestion,SeverityEnum.warning,[{text:this.dataset.modalCancel,active:!0,btnClass:"btn-default",name:"cancel"},{text:this.dataset.modalOk,btnClass:"btn-warning",name:"delete"}]).on("button.clicked",e=>{"delete"===e.target.getAttribute("name")&&(window.location.href=this.getAttribute("href")),Modal.dismiss()})})).delegateTo(document,this.selector)}}export default new DashboardDelete; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/DashboardModal.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/DashboardModal.js deleted file mode 100644 index a1ef4ed78120d83acdbc9e8ce565823355fda5be..0000000000000000000000000000000000000000 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/DashboardModal.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Modal from"TYPO3/CMS/Backend/Modal.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class DashboardModal{constructor(){this.selector=".js-dashboard-modal",this.initialize()}initialize(){new RegularEvent("click",(function(t){t.preventDefault();const e={type:Modal.types.default,title:this.dataset.modalTitle,size:Modal.sizes.medium,severity:SeverityEnum.notice,content:$(document.getElementById("dashboardModal-"+this.dataset.modalIdentifier).innerHTML),additionalCssClasses:["dashboard-modal"],callback:t=>{t.on("submit",".dashboardModal-form",e=>{t.trigger("modal-dismiss")}),t.on("button.clicked",e=>{if("save"===e.target.getAttribute("name")){t.find("form").trigger("submit")}else t.trigger("modal-dismiss")})},buttons:[{text:this.dataset.buttonCloseText,btnClass:"btn-default",name:"cancel"},{text:this.dataset.buttonOkText,active:!0,btnClass:"btn-warning",name:"save"}]};Modal.advanced(e)})).delegateTo(document,this.selector)}}export default new DashboardModal; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/Grid.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/Grid.js deleted file mode 100644 index 1dca30a61d95199e601e0f8acdb97dc4b57acda3..0000000000000000000000000000000000000000 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/Grid.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Muuri from"muuri";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class Grid{constructor(){this.selector=".dashboard-grid",this.initialize()}initialize(){const e={dragEnabled:!0,dragSortHeuristics:{sortInterval:50,minDragDistance:10,minBounceBackAngle:1},layoutDuration:400,layoutEasing:"ease",dragPlaceholder:{enabled:!0,duration:400,createElement:e=>e.getElement().cloneNode(!0)},dragSortPredicate:{action:"move",threshold:30},dragHandle:".js-dashboard-move-widget",dragReleaseDuration:400,dragReleaseEasing:"ease",layout:{fillGaps:!1,rounding:!1}};if(null!==document.querySelector(this.selector)){const t=new Muuri(this.selector,e);t.on("dragStart",()=>{document.querySelectorAll(".dashboard-item").forEach(e=>{e.classList.remove("dashboard-item--enableSelect")})}),t.on("dragReleaseEnd",()=>{document.querySelectorAll(".dashboard-item").forEach(e=>{e.classList.add("dashboard-item--enableSelect")}),this.saveItems(t)}),new RegularEvent("widgetContentRendered",()=>{t.refreshItems().layout()}).delegateTo(document,".dashboard-item")}}saveItems(e){let t=e.getItems().map((function(e){return[e.getElement().getAttribute("data-widget-key"),e.getElement().getAttribute("data-widget-hash")]}));new AjaxRequest(TYPO3.settings.ajaxUrls.dashboard_save_widget_positions).post({widgets:t}).then(async e=>{await e.resolve()})}}export default new Grid; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetContentCollector.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetContentCollector.js deleted file mode 100644 index 882740b8329a739d9701e20487f2dcf97f9a6b16..0000000000000000000000000000000000000000 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetContentCollector.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class WidgetContentCollector{constructor(){this.selector=".dashboard-item",this.initialize()}initialize(){this.registerEvents();document.querySelectorAll(this.selector).forEach(e=>{let t;t=new Event("widgetRefresh",{bubbles:!0}),e.dispatchEvent(t)})}registerEvents(){new RegularEvent("widgetRefresh",(e,t)=>{e.preventDefault(),this.getContentForWidget(t)}).delegateTo(document,this.selector)}getContentForWidget(e){const t=e.querySelector(".widget-waiting"),n=e.querySelector(".widget-content"),s=e.querySelector(".widget-error");t.classList.remove("hide"),n.classList.add("hide"),s.classList.add("hide");new AjaxRequest(TYPO3.settings.ajaxUrls.dashboard_get_widget_content).withQueryArguments({widget:e.dataset.widgetKey}).get().then(async s=>{const i=await s.resolve();let r;null!==n&&(n.innerHTML=i.content,n.classList.remove("hide")),null!==t&&t.classList.add("hide");const d={bubbles:!0};r=Object.keys(i.eventdata).length>0?new CustomEvent("widgetContentRendered",{...d,detail:i.eventdata}):new Event("widgetContentRendered",d),e.dispatchEvent(r)}).catch(n=>{null!==s&&s.classList.remove("hide"),null!==t&&t.classList.add("hide"),console.warn(`Error while retrieving widget [${e.dataset.widgetKey}] content: ${n.message}`)})}}export default new WidgetContentCollector; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetRemover.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetRemover.js deleted file mode 100644 index f5ff6040f4916fd5f24975555ecc37273ea7c7b9..0000000000000000000000000000000000000000 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetRemover.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Modal from"TYPO3/CMS/Backend/Modal.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class WidgetRemover{constructor(){this.selector=".js-dashboard-remove-widget",this.initialize()}initialize(){new RegularEvent("click",(function(e){e.preventDefault();Modal.confirm(this.dataset.modalTitle,this.dataset.modalQuestion,SeverityEnum.warning,[{text:this.dataset.modalCancel,active:!0,btnClass:"btn-default",name:"cancel"},{text:this.dataset.modalOk,btnClass:"btn-warning",name:"delete"}]).on("button.clicked",e=>{"delete"===e.target.getAttribute("name")&&(window.location.href=this.getAttribute("href")),Modal.dismiss()})})).delegateTo(document,this.selector)}}export default new WidgetRemover; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetSelector.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetSelector.js deleted file mode 100644 index c7d03c039c2512736902fa531dd0a205a06104e2..0000000000000000000000000000000000000000 --- a/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetSelector.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Modal from"TYPO3/CMS/Backend/Modal.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class WidgetSelector{constructor(){this.selector=".js-dashboard-addWidget",this.initialize()}initialize(){new RegularEvent("click",(function(e){e.preventDefault();const t={type:Modal.types.default,title:this.dataset.modalTitle,size:Modal.sizes.medium,severity:SeverityEnum.notice,content:$(document.getElementById("widgetSelector").innerHTML),additionalCssClasses:["dashboard-modal"],callback:e=>{e.on("click","a.dashboard-modal-item-block",t=>{e.trigger("modal-dismiss")})}};Modal.advanced(t)})).delegateTo(document,this.selector),document.querySelectorAll(this.selector).forEach(e=>{e.classList.remove("hide")})}}export default new WidgetSelector; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/chart-initializer.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/chart-initializer.js new file mode 100644 index 0000000000000000000000000000000000000000..5fee55df357ff3d27942869309736a4b574ae809 --- /dev/null +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/chart-initializer.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Chart from"@typo3/dashboard/contrib/chartjs.js";import RegularEvent from"@typo3/core/event/regular-event.js";class ChartInitializer{constructor(){this.selector=".dashboard-item",this.initialize()}initialize(){new RegularEvent("widgetContentRendered",(function(t){t.preventDefault();const e=t.detail;if(void 0===e||void 0===e.graphConfig)return;let r,i=this.querySelector("canvas");null!==i&&(r=i.getContext("2d")),void 0!==r&&new Chart(r,e.graphConfig)})).delegateTo(document,this.selector)}}export default new ChartInitializer; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/dashboard-delete.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/dashboard-delete.js new file mode 100644 index 0000000000000000000000000000000000000000..7523a7f56ba885bd209021872bdff1755dc90786 --- /dev/null +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/dashboard-delete.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Modal from"@typo3/backend/modal.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import RegularEvent from"@typo3/core/event/regular-event.js";class DashboardDelete{constructor(){this.selector=".js-dashboard-delete",this.initialize()}initialize(){new RegularEvent("click",(function(e){e.preventDefault();Modal.confirm(this.dataset.modalTitle,this.dataset.modalQuestion,SeverityEnum.warning,[{text:this.dataset.modalCancel,active:!0,btnClass:"btn-default",name:"cancel"},{text:this.dataset.modalOk,btnClass:"btn-warning",name:"delete"}]).on("button.clicked",e=>{"delete"===e.target.getAttribute("name")&&(window.location.href=this.getAttribute("href")),Modal.dismiss()})})).delegateTo(document,this.selector)}}export default new DashboardDelete; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/dashboard-modal.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/dashboard-modal.js new file mode 100644 index 0000000000000000000000000000000000000000..57a7f8cd7b8a1d4519d418423d3f108286aab286 --- /dev/null +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/dashboard-modal.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Modal from"@typo3/backend/modal.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import RegularEvent from"@typo3/core/event/regular-event.js";class DashboardModal{constructor(){this.selector=".js-dashboard-modal",this.initialize()}initialize(){new RegularEvent("click",(function(t){t.preventDefault();const e={type:Modal.types.default,title:this.dataset.modalTitle,size:Modal.sizes.medium,severity:SeverityEnum.notice,content:$(document.getElementById("dashboardModal-"+this.dataset.modalIdentifier).innerHTML),additionalCssClasses:["dashboard-modal"],callback:t=>{t.on("submit",".dashboardModal-form",e=>{t.trigger("modal-dismiss")}),t.on("button.clicked",e=>{if("save"===e.target.getAttribute("name")){t.find("form").trigger("submit")}else t.trigger("modal-dismiss")})},buttons:[{text:this.dataset.buttonCloseText,btnClass:"btn-default",name:"cancel"},{text:this.dataset.buttonOkText,active:!0,btnClass:"btn-warning",name:"save"}]};Modal.advanced(e)})).delegateTo(document,this.selector)}}export default new DashboardModal; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/grid.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/grid.js new file mode 100644 index 0000000000000000000000000000000000000000..2776c1623aea15b7d6321e4f8b25ed0dd6c8acb4 --- /dev/null +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/grid.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Muuri from"muuri";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import RegularEvent from"@typo3/core/event/regular-event.js";class Grid{constructor(){this.selector=".dashboard-grid",this.initialize()}initialize(){const e={dragEnabled:!0,dragSortHeuristics:{sortInterval:50,minDragDistance:10,minBounceBackAngle:1},layoutDuration:400,layoutEasing:"ease",dragPlaceholder:{enabled:!0,duration:400,createElement:e=>e.getElement().cloneNode(!0)},dragSortPredicate:{action:"move",threshold:30},dragHandle:".js-dashboard-move-widget",dragReleaseDuration:400,dragReleaseEasing:"ease",layout:{fillGaps:!1,rounding:!1}};if(null!==document.querySelector(this.selector)){const t=new Muuri(this.selector,e);t.on("dragStart",()=>{document.querySelectorAll(".dashboard-item").forEach(e=>{e.classList.remove("dashboard-item--enableSelect")})}),t.on("dragReleaseEnd",()=>{document.querySelectorAll(".dashboard-item").forEach(e=>{e.classList.add("dashboard-item--enableSelect")}),this.saveItems(t)}),new RegularEvent("widgetContentRendered",()=>{t.refreshItems().layout()}).delegateTo(document,".dashboard-item")}}saveItems(e){let t=e.getItems().map((function(e){return[e.getElement().getAttribute("data-widget-key"),e.getElement().getAttribute("data-widget-hash")]}));new AjaxRequest(TYPO3.settings.ajaxUrls.dashboard_save_widget_positions).post({widgets:t}).then(async e=>{await e.resolve()})}}export default new Grid; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-content-collector.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-content-collector.js new file mode 100644 index 0000000000000000000000000000000000000000..2573b1c26c07fdf3751e14a0a2bf62f3093ad812 --- /dev/null +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-content-collector.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import RegularEvent from"@typo3/core/event/regular-event.js";class WidgetContentCollector{constructor(){this.selector=".dashboard-item",this.initialize()}initialize(){this.registerEvents();document.querySelectorAll(this.selector).forEach(e=>{let t;t=new Event("widgetRefresh",{bubbles:!0}),e.dispatchEvent(t)})}registerEvents(){new RegularEvent("widgetRefresh",(e,t)=>{e.preventDefault(),this.getContentForWidget(t)}).delegateTo(document,this.selector)}getContentForWidget(e){const t=e.querySelector(".widget-waiting"),n=e.querySelector(".widget-content"),s=e.querySelector(".widget-error");t.classList.remove("hide"),n.classList.add("hide"),s.classList.add("hide");new AjaxRequest(TYPO3.settings.ajaxUrls.dashboard_get_widget_content).withQueryArguments({widget:e.dataset.widgetKey}).get().then(async s=>{const i=await s.resolve();let r;null!==n&&(n.innerHTML=i.content,n.classList.remove("hide")),null!==t&&t.classList.add("hide");const o={bubbles:!0};r=Object.keys(i.eventdata).length>0?new CustomEvent("widgetContentRendered",{...o,detail:i.eventdata}):new Event("widgetContentRendered",o),e.dispatchEvent(r)}).catch(n=>{null!==s&&s.classList.remove("hide"),null!==t&&t.classList.add("hide"),console.warn(`Error while retrieving widget [${e.dataset.widgetKey}] content: ${n.message}`)})}}export default new WidgetContentCollector; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetRefresh.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-refresh.js similarity index 100% rename from typo3/sysext/dashboard/Resources/Public/JavaScript/WidgetRefresh.js rename to typo3/sysext/dashboard/Resources/Public/JavaScript/widget-refresh.js diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-remover.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-remover.js new file mode 100644 index 0000000000000000000000000000000000000000..55db5b1184b7af8108c317923cc6afab11631cb0 --- /dev/null +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-remover.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Modal from"@typo3/backend/modal.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import RegularEvent from"@typo3/core/event/regular-event.js";class WidgetRemover{constructor(){this.selector=".js-dashboard-remove-widget",this.initialize()}initialize(){new RegularEvent("click",(function(e){e.preventDefault();Modal.confirm(this.dataset.modalTitle,this.dataset.modalQuestion,SeverityEnum.warning,[{text:this.dataset.modalCancel,active:!0,btnClass:"btn-default",name:"cancel"},{text:this.dataset.modalOk,btnClass:"btn-warning",name:"delete"}]).on("button.clicked",e=>{"delete"===e.target.getAttribute("name")&&(window.location.href=this.getAttribute("href")),Modal.dismiss()})})).delegateTo(document,this.selector)}}export default new WidgetRemover; \ No newline at end of file diff --git a/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-selector.js b/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-selector.js new file mode 100644 index 0000000000000000000000000000000000000000..47e73176768d5fdcd5586737515da0acfd6f01ba --- /dev/null +++ b/typo3/sysext/dashboard/Resources/Public/JavaScript/widget-selector.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Modal from"@typo3/backend/modal.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import RegularEvent from"@typo3/core/event/regular-event.js";class WidgetSelector{constructor(){this.selector=".js-dashboard-addWidget",this.initialize()}initialize(){new RegularEvent("click",(function(e){e.preventDefault();const t={type:Modal.types.default,title:this.dataset.modalTitle,size:Modal.sizes.medium,severity:SeverityEnum.notice,content:$(document.getElementById("widgetSelector").innerHTML),additionalCssClasses:["dashboard-modal"],callback:e=>{e.on("click","a.dashboard-modal-item-block",t=>{e.trigger("modal-dismiss")})}};Modal.advanced(t)})).delegateTo(document,this.selector),document.querySelectorAll(this.selector).forEach(e=>{e.classList.remove("hide")})}}export default new WidgetSelector; \ No newline at end of file diff --git a/typo3/sysext/extensionmanager/Classes/Controller/DistributionController.php b/typo3/sysext/extensionmanager/Classes/Controller/DistributionController.php index e61a45dbd433ea12b61c306b863bd5a1b1ae0127..89667f669dc01981a86d0232e7ef2fcbad9fcb16 100644 --- a/typo3/sysext/extensionmanager/Classes/Controller/DistributionController.php +++ b/typo3/sysext/extensionmanager/Classes/Controller/DistributionController.php @@ -52,7 +52,7 @@ class DistributionController extends AbstractController $view = $this->registerDocHeaderButtons($view); $view->assign('distributionActive', $active); $view->assign('extension', $extension); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Extensionmanager/DistributionImage.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/extensionmanager/distribution-image.js'); return $view->renderResponse('Distribution/Show'); } diff --git a/typo3/sysext/extensionmanager/Classes/Controller/ListController.php b/typo3/sysext/extensionmanager/Classes/Controller/ListController.php index a166d3a49576fd13b3c2766319c84ffe8d2fe973..ae26cd88c171517c4a4f150dc81359d7de38e61e 100644 --- a/typo3/sysext/extensionmanager/Classes/Controller/ListController.php +++ b/typo3/sysext/extensionmanager/Classes/Controller/ListController.php @@ -162,7 +162,7 @@ class ListController extends AbstractController */ protected function distributionsAction(bool $showUnsuitableDistributions = false): ResponseInterface { - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Extensionmanager/DistributionImage.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/extensionmanager/distribution-image.js'); $this->addComposerModeNotification(); $importExportInstalled = ExtensionManagementUtility::isLoaded('impexp'); $view = $this->initializeModuleTemplate($this->request); diff --git a/typo3/sysext/extensionmanager/Configuration/JavaScriptModules.php b/typo3/sysext/extensionmanager/Configuration/JavaScriptModules.php index 317c49db51d1a398b409c6af95673129bb89bf10..6086a8b683d875964452208772807af01205c91e 100644 --- a/typo3/sysext/extensionmanager/Configuration/JavaScriptModules.php +++ b/typo3/sysext/extensionmanager/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Extensionmanager/' => 'EXT:extensionmanager/Resources/Public/JavaScript/', + '@typo3/extensionmanager/' => 'EXT:extensionmanager/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/Distribution/Show.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/Distribution/Show.html index 24510fd8dfa138ef06ce7bc8af23d4c24e055b68..d663af0d155345f1ff0624381e850c3cbdd95e3a 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/Distribution/Show.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/Distribution/Show.html @@ -10,7 +10,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Extensionmanager/Main.js' + 0: '@typo3/extensionmanager/main.js' }" /> diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/ExtensionComposerStatus/Detail.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/ExtensionComposerStatus/Detail.html index 15c13a92ea9ae5d85e5645aa59d82e9104defaa6..532da2d6a68c7ce42d67a50cc161411047f07505 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/ExtensionComposerStatus/Detail.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/ExtensionComposerStatus/Detail.html @@ -10,7 +10,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Extensionmanager/Main.js' + 0: '@typo3/extensionmanager/main.js' }" /> diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/ExtensionComposerStatus/List.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/ExtensionComposerStatus/List.html index 18c0be14762a90fbfe991f4a020649a0fa100f2c..9ba48838038f92951b4492bbfc4ecdd8de678122 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/ExtensionComposerStatus/List.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/ExtensionComposerStatus/List.html @@ -11,7 +11,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Extensionmanager/Main.js' + 0: '@typo3/extensionmanager/main.js' }" /> diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Distributions.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Distributions.html index 654427d09be35304add943e9c15702131b2d25f5..80aeff2f6410f3d9edb421206b10ff795511d7a6 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Distributions.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Distributions.html @@ -10,7 +10,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Extensionmanager/Main.js' + 0: '@typo3/extensionmanager/main.js' }" /> diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html index 00fd2fb66a5f33918cb9753adb067abfb723fbbd..118e7cdd3eef6a54282087c21c0fad3dcf272bd0 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html @@ -11,7 +11,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Extensionmanager/Main.js' + 0: '@typo3/extensionmanager/main.js' }" /> diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html index b0669563e5adadfc58e024ff8de32ce9a30fb248..2bdf12b509b3dc50ddac51cfe5a51c4a895f6306 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/ShowAllVersions.html @@ -10,7 +10,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Extensionmanager/Main.js' + 0: '@typo3/extensionmanager/main.js' }" /> diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Ter.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Ter.html index 6bfa02fed48ea5a2c13908ac8fd3c8adc1f18be2..c01999eb15ebd74aa7f8a3202a1259aba3ee3f2a 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Ter.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/Ter.html @@ -11,7 +11,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Extensionmanager/Main.js' + 0: '@typo3/extensionmanager/main.js' }" /> diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/UnresolvedDependencies.html b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/UnresolvedDependencies.html index a356baba23c56dc0c942f53d8659b97749aba33a..fb57efddcb6fa058b2cbb7fa742f50dab07fd4c7 100644 --- a/typo3/sysext/extensionmanager/Resources/Private/Templates/List/UnresolvedDependencies.html +++ b/typo3/sysext/extensionmanager/Resources/Private/Templates/List/UnresolvedDependencies.html @@ -10,7 +10,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Extensionmanager/Main.js' + 0: '@typo3/extensionmanager/main.js' }" /> diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js deleted file mode 100644 index e1e94ff265a95506a8cb526f1f315d4a3a01e91c..0000000000000000000000000000000000000000 --- a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import NProgress from"nprogress";import Modal from"TYPO3/CMS/Backend/Modal.js";import Tooltip from"TYPO3/CMS/Backend/Tooltip.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";import ExtensionManagerRepository from"TYPO3/CMS/Extensionmanager/Repository.js";import ExtensionManagerUpdate from"TYPO3/CMS/Extensionmanager/Update.js";import ExtensionManagerUploadForm from"TYPO3/CMS/Extensionmanager/UploadForm.js";import Tablesort from"tablesort";import"tablesort.dotsep.js";import"TYPO3/CMS/Backend/Input/Clearable.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import DebounceEvent from"TYPO3/CMS/Core/Event/DebounceEvent.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";const securityUtility=new SecurityUtility;var ExtensionManagerIdentifier;!function(e){e.extensionlist="typo3-extension-list",e.searchField="#Tx_Extensionmanager_extensionkey"}(ExtensionManagerIdentifier||(ExtensionManagerIdentifier={}));class ExtensionManager{constructor(){const e=this;$(()=>{this.Update=new ExtensionManagerUpdate,this.UploadForm=new ExtensionManagerUploadForm,this.Repository=new ExtensionManagerRepository;const t=document.getElementById(ExtensionManagerIdentifier.extensionlist);let n;null!==t&&(new Tablesort(t),new RegularEvent("click",(function(t){t.preventDefault(),Modal.confirm(TYPO3.lang["extensionList.removalConfirmation.title"],TYPO3.lang["extensionList.removalConfirmation.question"],Severity.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{Modal.dismiss()}},{text:TYPO3.lang["button.remove"],btnClass:"btn-danger",trigger:()=>{e.removeExtensionFromDisk(this),Modal.dismiss()}}])})).delegateTo(t,".removeExtension")),$(document).on("click",".onClickMaskExtensionManager",()=>{NProgress.start()}).on("click","a[data-action=update-extension]",e=>{e.preventDefault(),NProgress.start(),new AjaxRequest($(e.currentTarget).attr("href")).get().then(this.updateExtension)}).on("change","input[name=unlockDependencyIgnoreButton]",e=>{$(".t3js-dependencies").toggleClass("disabled",!$(e.currentTarget).prop("checked"))}),null!==(n=document.querySelector(ExtensionManagerIdentifier.searchField))&&(new RegularEvent("submit",e=>{e.preventDefault()}).bindTo(n.closest("form")),new DebounceEvent("keyup",e=>{this.filterExtensions(e.target)},100).bindTo(n),n.clearable({onClear:e=>{this.filterExtensions(e)}})),$(document).on("click",".t3-button-action-installdistribution",()=>{NProgress.start()}),this.Repository.initDom(),this.Update.initializeEvents(),this.UploadForm.initializeEvents(),Tooltip.initialize("#typo3-extension-list [title]")})}static getUrlVars(){let e=[],t=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(let n of t){const[t,o]=n.split("=");e.push(t),e[t]=o}return e}filterExtensions(e){const t=document.querySelectorAll("[data-filterable]"),n=[];t.forEach(e=>{const t=Array.from(e.parentElement.children);n.push(t.indexOf(e))});const o=n.map(e=>`td:nth-child(${e+1})`).join(",");document.querySelectorAll("#typo3-extension-list tbody tr").forEach(t=>{const n=t.querySelectorAll(o),i=[];n.forEach(e=>{i.push(e.textContent.trim().replace(/\s+/g," "))}),t.classList.toggle("hidden",""!==e.value&&!RegExp(e.value,"i").test(i.join(":")))})}removeExtensionFromDisk(e){NProgress.start(),new AjaxRequest(e.href).get().then(()=>{location.reload()}).finally(()=>{NProgress.done()})}async updateExtension(e){let t=0;const n=await e.resolve(),o=$("<form>");$.each(n.updateComments,(e,n)=>{const i=$("<input>").attr({type:"radio",name:"version"}).val(e);0===t&&i.attr("checked","checked"),o.append([$("<h3>").append([i," "+securityUtility.encodeHtml(e)]),$("<div>").append(n.replace(/(\r\n|\n\r|\r|\n)/g,"\n").split(/\n/).map(e=>securityUtility.encodeHtml(e)).join("<br>"))]),t++});const i=$("<div>").append([$("<h1>").text(TYPO3.lang["extensionList.updateConfirmation.title"]),$("<h2>").text(TYPO3.lang["extensionList.updateConfirmation.message"]),o]);NProgress.done(),Modal.confirm(TYPO3.lang["extensionList.updateConfirmation.questionVersionComments"],i,Severity.warning,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{Modal.dismiss()}},{text:TYPO3.lang["button.updateExtension"],btnClass:"btn-warning",trigger:()=>{NProgress.start(),new AjaxRequest(n.url).withQueryArguments({tx_extensionmanager_tools_extensionmanagerextensionmanager:{version:$("input:radio[name=version]:checked",Modal.currentModal).val()}}).get().finally(()=>{location.reload()}),Modal.dismiss()}}])}}let extensionManagerObject=new ExtensionManager;void 0===TYPO3.ExtensionManager&&(TYPO3.ExtensionManager=extensionManagerObject);export default extensionManagerObject; \ No newline at end of file diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Repository.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Repository.js deleted file mode 100644 index ef957ae0b6c0c40f0cfe567f7d930fbc0e52e022..0000000000000000000000000000000000000000 --- a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Repository.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import NProgress from"nprogress";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import Tablesort from"tablesort";import"TYPO3/CMS/Backend/Input/Clearable.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class Repository{constructor(){this.downloadPath="",this.getDependencies=async e=>{const t=await e.resolve();NProgress.done(),t.hasDependencies?Modal.confirm(t.title,$(t.message),Severity.info,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{Modal.dismiss()}},{text:TYPO3.lang["button.resolveDependencies"],btnClass:"btn-info",trigger:()=>{this.getResolveDependenciesAndInstallResult(t.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+this.downloadPath),Modal.dismiss()}}]):t.hasErrors?Notification.error(t.title,t.message,15):this.getResolveDependenciesAndInstallResult(t.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+this.downloadPath)}}initDom(){NProgress.configure({parent:".module-loading-indicator",showSpinner:!1});const e=document.getElementById("terVersionTable"),t=document.getElementById("terSearchTable");null!==e&&new Tablesort(e),null!==t&&new Tablesort(t),this.bindDownload(),this.bindSearchFieldResetter()}bindDownload(){const e=this;new RegularEvent("click",(function(t){t.preventDefault();const n=this.closest("form"),o=n.dataset.href;e.downloadPath=n.querySelector("input.downloadPath:checked").value,NProgress.start(),new AjaxRequest(o).get().then(e.getDependencies)})).delegateTo(document,".downloadFromTer form.download button[type=submit]")}getResolveDependenciesAndInstallResult(e){NProgress.start(),new AjaxRequest(e).get().then(async e=>{const t=await e.raw().json();if(t.errorCount>0)Modal.confirm(t.errorTitle,$(t.errorMessage),Severity.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{Modal.dismiss()}},{text:TYPO3.lang["button.resolveDependenciesIgnore"],btnClass:"btn-danger disabled t3js-dependencies",trigger:e=>{$(e.currentTarget).hasClass("disabled")||(this.getResolveDependenciesAndInstallResult(t.skipDependencyUri),Modal.dismiss())}}]),Modal.currentModal.on("shown.bs.modal",()=>{const e=Modal.currentModal.find(".t3js-dependencies");$('input[name="unlockDependencyIgnoreButton"]',Modal.currentModal).on("change",t=>{e.toggleClass("disabled",!$(t.currentTarget).prop("checked"))})});else{let e=TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.message"+t.installationTypeLanguageKey].replace(/\{0\}/g,t.extension);e+="\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.header"]+": ",$.each(t.result,(t,n)=>{e+="\n\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.item"]+" "+t+": ",$.each(n,t=>{e+="\n* "+t})}),Notification.info(TYPO3.lang["extensionList.dependenciesResolveFlashMessage.title"+t.installationTypeLanguageKey].replace(/\{0\}/g,t.extension),e,15),top.TYPO3.ModuleMenu.App.refreshMenu()}}).finally(()=>{NProgress.done()})}bindSearchFieldResetter(){let e;if(null!==(e=document.querySelector('.typo3-extensionmanager-searchTerForm input[type="text"]'))){const t=""!==e.value;e.clearable({onClear:e=>{t&&e.closest("form").submit()}})}}}export default Repository; \ No newline at end of file diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Update.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Update.js deleted file mode 100644 index cfee6c2b79fec1982a2ccc72c837b3e5a9e6f9f9..0000000000000000000000000000000000000000 --- a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/Update.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import NProgress from"nprogress";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";var ExtensionManagerUpdateIdentifier;!function(e){e.extensionTable="#terTable",e.terUpdateAction=".update-from-ter",e.pagination=".pagination-wrap",e.splashscreen=".splash-receivedata",e.terTableWrapper="#terTableWrapper .table"}(ExtensionManagerUpdateIdentifier||(ExtensionManagerUpdateIdentifier={}));class ExtensionManagerUpdate{initializeEvents(){$(ExtensionManagerUpdateIdentifier.terUpdateAction).each((e,a)=>{const t=$(a),n=t.attr("action");t.attr("action","#"),t.on("submit",()=>(this.updateFromTer(n,!0),!1)),this.updateFromTer(n,!1)})}updateFromTer(e,a){a&&(e+="&tx_extensionmanager_tools_extensionmanagerextensionmanager%5BforceUpdateCheck%5D=1"),$(ExtensionManagerUpdateIdentifier.terUpdateAction).addClass("extensionmanager-is-hidden"),$(ExtensionManagerUpdateIdentifier.extensionTable).hide(),$(ExtensionManagerUpdateIdentifier.splashscreen).addClass("extensionmanager-is-shown"),$(ExtensionManagerUpdateIdentifier.terTableWrapper).addClass("extensionmanager-is-loading"),$(ExtensionManagerUpdateIdentifier.pagination).addClass("extensionmanager-is-loading");let t=!1;NProgress.start(),new AjaxRequest(e).get().then(async e=>{const a=await e.resolve();a.errorMessage.length&&Notification.error(TYPO3.lang["extensionList.updateFromTerFlashMessage.title"],a.errorMessage,10);const n=$(ExtensionManagerUpdateIdentifier.terUpdateAction+" .extension-list-last-updated");n.text(a.timeSinceLastUpdate),n.attr("title",TYPO3.lang["extensionList.updateFromTer.lastUpdate.timeOfLastUpdate"]+a.lastUpdateTime),a.updated&&(t=!0,window.location.replace(window.location.href))},async e=>{const a=e.response.statusText+"("+e.response.status+"): "+await e.response.text();Notification.warning(TYPO3.lang["extensionList.updateFromTerFlashMessage.title"],a,10)}).finally(()=>{NProgress.done(),t||($(ExtensionManagerUpdateIdentifier.splashscreen).removeClass("extensionmanager-is-shown"),$(ExtensionManagerUpdateIdentifier.terTableWrapper).removeClass("extensionmanager-is-loading"),$(ExtensionManagerUpdateIdentifier.pagination).removeClass("extensionmanager-is-loading"),$(ExtensionManagerUpdateIdentifier.terUpdateAction).removeClass("extensionmanager-is-hidden"),$(ExtensionManagerUpdateIdentifier.extensionTable).show())})}}export default ExtensionManagerUpdate; \ No newline at end of file diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/UploadForm.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/UploadForm.js deleted file mode 100644 index f36de2940fd63af4bbbe2f6c32083c1235f5b84c..0000000000000000000000000000000000000000 --- a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/UploadForm.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";class UploadForm{constructor(){this.expandedUploadFormClass="transformed"}initializeEvents(){$(document).on("click",".t3js-upload",e=>{const a=$(e.currentTarget),s=$(".extension-upload-form");e.preventDefault(),a.hasClass(this.expandedUploadFormClass)?(s.stop().slideUp(),a.removeClass(this.expandedUploadFormClass)):(a.addClass(this.expandedUploadFormClass),s.stop().slideDown(),new AjaxRequest(a.attr("href")).get().then(async e=>{s.find(".t3js-upload-form-target").html(await e.resolve())}))})}}export default UploadForm; \ No newline at end of file diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/DistributionImage.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/distribution-image.js similarity index 100% rename from typo3/sysext/extensionmanager/Resources/Public/JavaScript/DistributionImage.js rename to typo3/sysext/extensionmanager/Resources/Public/JavaScript/distribution-image.js diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/main.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/main.js new file mode 100644 index 0000000000000000000000000000000000000000..6d7390adee5155ae0d803c3a7d978dcfa8a4b098 --- /dev/null +++ b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/main.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import NProgress from"nprogress";import Modal from"@typo3/backend/modal.js";import Tooltip from"@typo3/backend/tooltip.js";import Severity from"@typo3/backend/severity.js";import SecurityUtility from"@typo3/core/security-utility.js";import ExtensionManagerRepository from"@typo3/extensionmanager/repository.js";import ExtensionManagerUpdate from"@typo3/extensionmanager/update.js";import ExtensionManagerUploadForm from"@typo3/extensionmanager/upload-form.js";import Tablesort from"tablesort";import"tablesort.dotsep.js";import"@typo3/backend/input/clearable.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import DebounceEvent from"@typo3/core/event/debounce-event.js";import RegularEvent from"@typo3/core/event/regular-event.js";const securityUtility=new SecurityUtility;var ExtensionManagerIdentifier;!function(e){e.extensionlist="typo3-extension-list",e.searchField="#Tx_Extensionmanager_extensionkey"}(ExtensionManagerIdentifier||(ExtensionManagerIdentifier={}));class ExtensionManager{constructor(){const e=this;$(()=>{this.Update=new ExtensionManagerUpdate,this.UploadForm=new ExtensionManagerUploadForm,this.Repository=new ExtensionManagerRepository;const t=document.getElementById(ExtensionManagerIdentifier.extensionlist);let n;null!==t&&(new Tablesort(t),new RegularEvent("click",(function(t){t.preventDefault(),Modal.confirm(TYPO3.lang["extensionList.removalConfirmation.title"],TYPO3.lang["extensionList.removalConfirmation.question"],Severity.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{Modal.dismiss()}},{text:TYPO3.lang["button.remove"],btnClass:"btn-danger",trigger:()=>{e.removeExtensionFromDisk(this),Modal.dismiss()}}])})).delegateTo(t,".removeExtension")),$(document).on("click",".onClickMaskExtensionManager",()=>{NProgress.start()}).on("click","a[data-action=update-extension]",e=>{e.preventDefault(),NProgress.start(),new AjaxRequest($(e.currentTarget).attr("href")).get().then(this.updateExtension)}).on("change","input[name=unlockDependencyIgnoreButton]",e=>{$(".t3js-dependencies").toggleClass("disabled",!$(e.currentTarget).prop("checked"))}),null!==(n=document.querySelector(ExtensionManagerIdentifier.searchField))&&(new RegularEvent("submit",e=>{e.preventDefault()}).bindTo(n.closest("form")),new DebounceEvent("keyup",e=>{this.filterExtensions(e.target)},100).bindTo(n),n.clearable({onClear:e=>{this.filterExtensions(e)}})),$(document).on("click",".t3-button-action-installdistribution",()=>{NProgress.start()}),this.Repository.initDom(),this.Update.initializeEvents(),this.UploadForm.initializeEvents(),Tooltip.initialize("#typo3-extension-list [title]")})}static getUrlVars(){let e=[],t=window.location.href.slice(window.location.href.indexOf("?")+1).split("&");for(let n of t){const[t,o]=n.split("=");e.push(t),e[t]=o}return e}filterExtensions(e){const t=document.querySelectorAll("[data-filterable]"),n=[];t.forEach(e=>{const t=Array.from(e.parentElement.children);n.push(t.indexOf(e))});const o=n.map(e=>`td:nth-child(${e+1})`).join(",");document.querySelectorAll("#typo3-extension-list tbody tr").forEach(t=>{const n=t.querySelectorAll(o),i=[];n.forEach(e=>{i.push(e.textContent.trim().replace(/\s+/g," "))}),t.classList.toggle("hidden",""!==e.value&&!RegExp(e.value,"i").test(i.join(":")))})}removeExtensionFromDisk(e){NProgress.start(),new AjaxRequest(e.href).get().then(()=>{location.reload()}).finally(()=>{NProgress.done()})}async updateExtension(e){let t=0;const n=await e.resolve(),o=$("<form>");$.each(n.updateComments,(e,n)=>{const i=$("<input>").attr({type:"radio",name:"version"}).val(e);0===t&&i.attr("checked","checked"),o.append([$("<h3>").append([i," "+securityUtility.encodeHtml(e)]),$("<div>").append(n.replace(/(\r\n|\n\r|\r|\n)/g,"\n").split(/\n/).map(e=>securityUtility.encodeHtml(e)).join("<br>"))]),t++});const i=$("<div>").append([$("<h1>").text(TYPO3.lang["extensionList.updateConfirmation.title"]),$("<h2>").text(TYPO3.lang["extensionList.updateConfirmation.message"]),o]);NProgress.done(),Modal.confirm(TYPO3.lang["extensionList.updateConfirmation.questionVersionComments"],i,Severity.warning,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{Modal.dismiss()}},{text:TYPO3.lang["button.updateExtension"],btnClass:"btn-warning",trigger:()=>{NProgress.start(),new AjaxRequest(n.url).withQueryArguments({tx_extensionmanager_tools_extensionmanagerextensionmanager:{version:$("input:radio[name=version]:checked",Modal.currentModal).val()}}).get().finally(()=>{location.reload()}),Modal.dismiss()}}])}}let extensionManagerObject=new ExtensionManager;void 0===TYPO3.ExtensionManager&&(TYPO3.ExtensionManager=extensionManagerObject);export default extensionManagerObject; \ No newline at end of file diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/repository.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/repository.js new file mode 100644 index 0000000000000000000000000000000000000000..adc3e0f7a45efa21ded7076aaf3b02ac736f029b --- /dev/null +++ b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/repository.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import NProgress from"nprogress";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import Severity from"@typo3/backend/severity.js";import Tablesort from"tablesort";import"@typo3/backend/input/clearable.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import RegularEvent from"@typo3/core/event/regular-event.js";class Repository{constructor(){this.downloadPath="",this.getDependencies=async e=>{const t=await e.resolve();NProgress.done(),t.hasDependencies?Modal.confirm(t.title,$(t.message),Severity.info,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{Modal.dismiss()}},{text:TYPO3.lang["button.resolveDependencies"],btnClass:"btn-info",trigger:()=>{this.getResolveDependenciesAndInstallResult(t.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+this.downloadPath),Modal.dismiss()}}]):t.hasErrors?Notification.error(t.title,t.message,15):this.getResolveDependenciesAndInstallResult(t.url+"&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]="+this.downloadPath)}}initDom(){NProgress.configure({parent:".module-loading-indicator",showSpinner:!1});const e=document.getElementById("terVersionTable"),t=document.getElementById("terSearchTable");null!==e&&new Tablesort(e),null!==t&&new Tablesort(t),this.bindDownload(),this.bindSearchFieldResetter()}bindDownload(){const e=this;new RegularEvent("click",(function(t){t.preventDefault();const n=this.closest("form"),o=n.dataset.href;e.downloadPath=n.querySelector("input.downloadPath:checked").value,NProgress.start(),new AjaxRequest(o).get().then(e.getDependencies)})).delegateTo(document,".downloadFromTer form.download button[type=submit]")}getResolveDependenciesAndInstallResult(e){NProgress.start(),new AjaxRequest(e).get().then(async e=>{const t=await e.raw().json();if(t.errorCount>0)Modal.confirm(t.errorTitle,$(t.errorMessage),Severity.error,[{text:TYPO3.lang["button.cancel"],active:!0,btnClass:"btn-default",trigger:()=>{Modal.dismiss()}},{text:TYPO3.lang["button.resolveDependenciesIgnore"],btnClass:"btn-danger disabled t3js-dependencies",trigger:e=>{$(e.currentTarget).hasClass("disabled")||(this.getResolveDependenciesAndInstallResult(t.skipDependencyUri),Modal.dismiss())}}]),Modal.currentModal.on("shown.bs.modal",()=>{const e=Modal.currentModal.find(".t3js-dependencies");$('input[name="unlockDependencyIgnoreButton"]',Modal.currentModal).on("change",t=>{e.toggleClass("disabled",!$(t.currentTarget).prop("checked"))})});else{let e=TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.message"+t.installationTypeLanguageKey].replace(/\{0\}/g,t.extension);e+="\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.header"]+": ",$.each(t.result,(t,n)=>{e+="\n\n"+TYPO3.lang["extensionList.dependenciesResolveDownloadSuccess.item"]+" "+t+": ",$.each(n,t=>{e+="\n* "+t})}),Notification.info(TYPO3.lang["extensionList.dependenciesResolveFlashMessage.title"+t.installationTypeLanguageKey].replace(/\{0\}/g,t.extension),e,15),top.TYPO3.ModuleMenu.App.refreshMenu()}}).finally(()=>{NProgress.done()})}bindSearchFieldResetter(){let e;if(null!==(e=document.querySelector('.typo3-extensionmanager-searchTerForm input[type="text"]'))){const t=""!==e.value;e.clearable({onClear:e=>{t&&e.closest("form").submit()}})}}}export default Repository; \ No newline at end of file diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/update.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/update.js new file mode 100644 index 0000000000000000000000000000000000000000..902b1d8c6698ac915e893c4b76ec226930c87ffb --- /dev/null +++ b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/update.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import NProgress from"nprogress";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";var ExtensionManagerUpdateIdentifier;!function(e){e.extensionTable="#terTable",e.terUpdateAction=".update-from-ter",e.pagination=".pagination-wrap",e.splashscreen=".splash-receivedata",e.terTableWrapper="#terTableWrapper .table"}(ExtensionManagerUpdateIdentifier||(ExtensionManagerUpdateIdentifier={}));class ExtensionManagerUpdate{initializeEvents(){$(ExtensionManagerUpdateIdentifier.terUpdateAction).each((e,a)=>{const t=$(a),n=t.attr("action");t.attr("action","#"),t.on("submit",()=>(this.updateFromTer(n,!0),!1)),this.updateFromTer(n,!1)})}updateFromTer(e,a){a&&(e+="&tx_extensionmanager_tools_extensionmanagerextensionmanager%5BforceUpdateCheck%5D=1"),$(ExtensionManagerUpdateIdentifier.terUpdateAction).addClass("extensionmanager-is-hidden"),$(ExtensionManagerUpdateIdentifier.extensionTable).hide(),$(ExtensionManagerUpdateIdentifier.splashscreen).addClass("extensionmanager-is-shown"),$(ExtensionManagerUpdateIdentifier.terTableWrapper).addClass("extensionmanager-is-loading"),$(ExtensionManagerUpdateIdentifier.pagination).addClass("extensionmanager-is-loading");let t=!1;NProgress.start(),new AjaxRequest(e).get().then(async e=>{const a=await e.resolve();a.errorMessage.length&&Notification.error(TYPO3.lang["extensionList.updateFromTerFlashMessage.title"],a.errorMessage,10);const n=$(ExtensionManagerUpdateIdentifier.terUpdateAction+" .extension-list-last-updated");n.text(a.timeSinceLastUpdate),n.attr("title",TYPO3.lang["extensionList.updateFromTer.lastUpdate.timeOfLastUpdate"]+a.lastUpdateTime),a.updated&&(t=!0,window.location.replace(window.location.href))},async e=>{const a=e.response.statusText+"("+e.response.status+"): "+await e.response.text();Notification.warning(TYPO3.lang["extensionList.updateFromTerFlashMessage.title"],a,10)}).finally(()=>{NProgress.done(),t||($(ExtensionManagerUpdateIdentifier.splashscreen).removeClass("extensionmanager-is-shown"),$(ExtensionManagerUpdateIdentifier.terTableWrapper).removeClass("extensionmanager-is-loading"),$(ExtensionManagerUpdateIdentifier.pagination).removeClass("extensionmanager-is-loading"),$(ExtensionManagerUpdateIdentifier.terUpdateAction).removeClass("extensionmanager-is-hidden"),$(ExtensionManagerUpdateIdentifier.extensionTable).show())})}}export default ExtensionManagerUpdate; \ No newline at end of file diff --git a/typo3/sysext/extensionmanager/Resources/Public/JavaScript/upload-form.js b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/upload-form.js new file mode 100644 index 0000000000000000000000000000000000000000..565f5096649b18a12b5c70f660f4726b60d71bb6 --- /dev/null +++ b/typo3/sysext/extensionmanager/Resources/Public/JavaScript/upload-form.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";class UploadForm{constructor(){this.expandedUploadFormClass="transformed"}initializeEvents(){$(document).on("click",".t3js-upload",e=>{const a=$(e.currentTarget),s=$(".extension-upload-form");e.preventDefault(),a.hasClass(this.expandedUploadFormClass)?(s.stop().slideUp(),a.removeClass(this.expandedUploadFormClass)):(a.addClass(this.expandedUploadFormClass),s.stop().slideDown(),new AjaxRequest(a.attr("href")).get().then(async e=>{s.find(".t3js-upload-form-target").html(await e.resolve())}))})}}export default UploadForm; \ No newline at end of file diff --git a/typo3/sysext/filelist/Classes/Controller/File/CreateFolderController.php b/typo3/sysext/filelist/Classes/Controller/File/CreateFolderController.php index 1f2ab173709c140e85a09ee95d5dd943a43672a6..e31591a9218f18319532867af176ec9ec77b9eb5 100644 --- a/typo3/sysext/filelist/Classes/Controller/File/CreateFolderController.php +++ b/typo3/sysext/filelist/Classes/Controller/File/CreateFolderController.php @@ -129,8 +129,8 @@ class CreateFolderController } $this->view->getDocHeaderComponent()->setMetaInformationForResource($this->folderObject); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ContextMenu.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Filelist/CreateFolder.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-menu.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/filelist/create-folder.js'); } /** diff --git a/typo3/sysext/filelist/Classes/Controller/File/RenameFileController.php b/typo3/sysext/filelist/Classes/Controller/File/RenameFileController.php index be52e740d52752d9a2974b66c638f3f4f2439488..94bf4baa415a04f443bf61e16820be9d301509ab 100644 --- a/typo3/sysext/filelist/Classes/Controller/File/RenameFileController.php +++ b/typo3/sysext/filelist/Classes/Controller/File/RenameFileController.php @@ -139,8 +139,8 @@ class RenameFileController $this->moduleTemplate->getDocHeaderComponent()->setMetaInformationForResource($this->fileOrFolderObject); // Setting up the context sensitive menu - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ContextMenu.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Filelist/RenameFile.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-menu.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/filelist/rename-file.js'); } /** diff --git a/typo3/sysext/filelist/Classes/Controller/File/ReplaceFileController.php b/typo3/sysext/filelist/Classes/Controller/File/ReplaceFileController.php index eab211042f5a9c34fb47817085d9d7ca795c49fa..b230854183e578e995b0d0ca2e196bf04b79089e 100644 --- a/typo3/sysext/filelist/Classes/Controller/File/ReplaceFileController.php +++ b/typo3/sysext/filelist/Classes/Controller/File/ReplaceFileController.php @@ -128,8 +128,8 @@ class ReplaceFileController } $this->view->getDocHeaderComponent()->setMetaInformationForResource($this->fileOrFolderObject); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ContextMenu.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Filelist/FileReplace.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-menu.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/filelist/file-replace.js'); } /** diff --git a/typo3/sysext/filelist/Classes/Controller/FileListController.php b/typo3/sysext/filelist/Classes/Controller/FileListController.php index c87b879ab029419f2b4b2b06d235b04930698131..c5136a71cd8c4e9841f773e99b6ce48a5560f7f6 100644 --- a/typo3/sysext/filelist/Classes/Controller/FileListController.php +++ b/typo3/sysext/filelist/Classes/Controller/FileListController.php @@ -178,12 +178,12 @@ class FileListController implements LoggerAwareInterface } $this->view->assign('currentIdentifier', $this->folderObject ? $this->folderObject->getCombinedIdentifier() : ''); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Filelist/FileList.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Filelist/FileDelete.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ContextMenu.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ClipboardPanel.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/MultiRecordSelection.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ColumnSelectorButton.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/filelist/file-list.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/filelist/file-delete.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-menu.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/clipboard-panel.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/multi-record-selection.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/column-selector-button.js'); $this->pageRenderer->addInlineLanguageLabelFile( 'EXT:backend/Resources/Private/Language/locallang_alt_doc.xlf', 'buttons' @@ -399,7 +399,7 @@ class FileListController implements LoggerAwareInterface && $this->folderObject->getStorage()->checkUserActionPermission('add', 'File') ) { $lang = $this->getLanguageService(); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/DragUploader.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/drag-uploader.js'); $this->pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_core.xlf', 'file_upload'); $this->pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_core.xlf', 'file_download'); $this->pageRenderer->addInlineLanguageLabelArray([ diff --git a/typo3/sysext/filelist/Configuration/JavaScriptModules.php b/typo3/sysext/filelist/Configuration/JavaScriptModules.php index 686ac531af976c29ffe470304b16952eaac08229..4a593ccfbf94c155bbacb1ccdc8f73e6c292a31b 100644 --- a/typo3/sysext/filelist/Configuration/JavaScriptModules.php +++ b/typo3/sysext/filelist/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Filelist/' => 'EXT:filelist/Resources/Public/JavaScript/', + '@typo3/filelist/' => 'EXT:filelist/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/filelist/Resources/Private/Templates/File/UploadFile.html b/typo3/sysext/filelist/Resources/Private/Templates/File/UploadFile.html index 816450d67e51802c990c68a5af2920a7287da35c..5ea09087dcd05b62b02865b8b6378f897c564cda 100644 --- a/typo3/sysext/filelist/Resources/Private/Templates/File/UploadFile.html +++ b/typo3/sysext/filelist/Resources/Private/Templates/File/UploadFile.html @@ -9,7 +9,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/ContextMenu.js' + 0: '@typo3/backend/context-menu.js' }" /> diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/ContextMenuActions.js b/typo3/sysext/filelist/Resources/Public/JavaScript/ContextMenuActions.js deleted file mode 100644 index 1c86f2a0df45ed4d4cfb726554ca2a8216cf2c61..0000000000000000000000000000000000000000 --- a/typo3/sysext/filelist/Resources/Public/JavaScript/ContextMenuActions.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{lll}from"TYPO3/CMS/Core/lit-helper.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Md5 from"TYPO3/CMS/Backend/Hashing/Md5.js";class ContextMenuActions{static getReturnUrl(){return encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search)}static triggerFileDownload(t,e,n=!1){const o=document.createElement("a");o.href=t,o.download=e,document.body.appendChild(o),o.click(),n&&URL.revokeObjectURL(t),document.body.removeChild(o),Notification.success(lll("file_download.success"),"",2)}static renameFile(t,e){const n=$(this).data("action-url");top.TYPO3.Backend.ContentContainer.setUrl(n+"&target="+encodeURIComponent(e)+"&returnUrl="+ContextMenuActions.getReturnUrl())}static editFile(t,e){const n=$(this).data("action-url");top.TYPO3.Backend.ContentContainer.setUrl(n+"&target="+encodeURIComponent(e)+"&returnUrl="+ContextMenuActions.getReturnUrl())}static editMetadata(){const t=$(this).data("metadata-uid");t&&top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit[sys_file_metadata]["+parseInt(t,10)+"]=edit&returnUrl="+ContextMenuActions.getReturnUrl())}static openInfoPopUp(t,e){"sys_file_storage"===t?top.TYPO3.InfoWindow.showItem(t,e):top.TYPO3.InfoWindow.showItem("_FILE",e)}static uploadFile(t,e){const n=$(this).data("action-url");top.TYPO3.Backend.ContentContainer.setUrl(n+"&target="+encodeURIComponent(e)+"&returnUrl="+ContextMenuActions.getReturnUrl())}static createFile(t,e){const n=$(this).data("action-url");top.TYPO3.Backend.ContentContainer.setUrl(n+"&target="+encodeURIComponent(e)+"&returnUrl="+ContextMenuActions.getReturnUrl())}static downloadFile(){ContextMenuActions.triggerFileDownload($(this).data("url"),$(this).data("name"))}static downloadFolder(t,e){Notification.info(lll("file_download.prepare"),"",2);const n=$(this).data("action-url");new AjaxRequest(n).post({items:[e]}).then(async t=>{let e=t.response.headers.get("Content-Disposition");if(!e){const e=await t.resolve();return void(!1===e.success&&e.status?Notification.warning(lll("file_download."+e.status),lll("file_download."+e.status+".message"),10):Notification.error(lll("file_download.error")))}e=e.substring(e.indexOf(" filename=")+10);const n=await t.raw().arrayBuffer(),o=new Blob([n],{type:t.raw().headers.get("Content-Type")});ContextMenuActions.triggerFileDownload(URL.createObjectURL(o),e,!0)}).catch(()=>{Notification.error(lll("file_download.error"))})}static createFilemount(t,e){const n=e.split(":");2===n.length&&top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit[sys_filemounts][0]=new&defVals[sys_filemounts][base]="+encodeURIComponent(n[0])+"&defVals[sys_filemounts][path]="+encodeURIComponent(n[1])+"&returnUrl="+ContextMenuActions.getReturnUrl())}static deleteFile(t,e){const n=$(this),o=()=>{top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.FileCommit.moduleUrl+"&data[delete][0][data]="+encodeURIComponent(e)+"&data[delete][0][redirect]="+ContextMenuActions.getReturnUrl())};if(!n.data("title"))return void o();Modal.confirm(n.data("title"),n.data("message"),SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",t=>{"delete"===t.target.name&&o(),Modal.dismiss()})}static copyFile(t,e){const n=Md5.hash(e),o=TYPO3.settings.ajaxUrls.contextmenu_clipboard,a={CB:{el:{["_FILE%7C"+n]:e},setCopyMode:"1"}};new AjaxRequest(o).withQueryArguments(a).get().finally(()=>{top.TYPO3.Backend.ContentContainer.refresh(!0)})}static copyReleaseFile(t,e){const n=Md5.hash(e),o=TYPO3.settings.ajaxUrls.contextmenu_clipboard,a={CB:{el:{["_FILE%7C"+n]:"0"},setCopyMode:"1"}};new AjaxRequest(o).withQueryArguments(a).get().finally(()=>{top.TYPO3.Backend.ContentContainer.refresh(!0)})}static cutFile(t,e){const n=Md5.hash(e),o=TYPO3.settings.ajaxUrls.contextmenu_clipboard,a={CB:{el:{["_FILE%7C"+n]:e}}};new AjaxRequest(o).withQueryArguments(a).get().finally(()=>{top.TYPO3.Backend.ContentContainer.refresh(!0)})}static cutReleaseFile(t,e){const n=Md5.hash(e),o=TYPO3.settings.ajaxUrls.contextmenu_clipboard,a={CB:{el:{["_FILE%7C"+n]:"0"}}};new AjaxRequest(o).withQueryArguments(a).get().finally(()=>{top.TYPO3.Backend.ContentContainer.refresh(!0)})}static pasteFileInto(t,e){const n=$(this),o=n.data("title"),a=()=>{top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.FileCommit.moduleUrl+"&CB[paste]=FILE|"+encodeURIComponent(e)+"&CB[pad]=normal&redirect="+ContextMenuActions.getReturnUrl())};if(!o)return void a();Modal.confirm(o,n.data("message"),SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-warning",name:"ok"}]).on("button.clicked",t=>{"ok"===t.target.name&&a(),Modal.dismiss()})}}export default ContextMenuActions; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/CreateFolder.js b/typo3/sysext/filelist/Resources/Public/JavaScript/CreateFolder.js deleted file mode 100644 index 4f77abade6ac9df66d885b625f9714616442f8d8..0000000000000000000000000000000000000000 --- a/typo3/sysext/filelist/Resources/Public/JavaScript/CreateFolder.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class CreateFolder{constructor(){this.changed=!1,DocumentService.ready().then(()=>{const e=document.querySelector(".filelist-create-folder-main");if(!(e instanceof HTMLElement))throw new Error("Main element not found");this.selfUrl=e.dataset.selfUrl,this.confirmTitle=e.dataset.confirmTitle,this.confirmText=e.dataset.confirmText,this.registerEvents()})}reload(e){const t=this.selfUrl.replace(/AMOUNT/,e.toString());if(this.changed){const e=Modal.confirm(this.confirmTitle,this.confirmText);e.on("confirm.button.cancel",()=>{e.trigger("modal-dismiss")}),e.on("confirm.button.ok",()=>{e.trigger("modal-dismiss"),window.location.href=t})}else window.location.href=t}registerEvents(){new RegularEvent("change",()=>{this.changed=!0}).delegateTo(document,['input[type="text"][name^="data[newfolder]"]','input[type="text"][name^="data[newfile]"]','input[type="text"][name^="data[newMedia]"]'].join(",")),new RegularEvent("change",e=>{const t=parseInt(e.target.value,10);this.reload(t)}).bindTo(document.getElementById("number-of-new-folders"))}}export default new CreateFolder; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/FileDelete.js b/typo3/sysext/filelist/Resources/Public/JavaScript/FileDelete.js deleted file mode 100644 index 9df2eb5caa9e7daa2f3ca290eab7e23dca24f45b..0000000000000000000000000000000000000000 --- a/typo3/sysext/filelist/Resources/Public/JavaScript/FileDelete.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import Modal from"TYPO3/CMS/Backend/Modal.js";class FileDelete{constructor(){DocumentService.ready().then(()=>{new RegularEvent("click",(e,t)=>{e.preventDefault();let n=t.dataset.redirectUrl;n=n?encodeURIComponent(n):encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search);const o=t.dataset.identifier,a=t.dataset.deleteType,l=t.dataset.deleteUrl+"&data[delete][0][data]="+encodeURIComponent(o)+"&data[delete][0][redirect]="+n;if(t.dataset.check){Modal.confirm(t.dataset.title,t.dataset.bsContent,SeverityEnum.warning,[{text:TYPO3.lang["buttons.confirm.delete_file.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm."+a+".yes"]||"Yes, delete this file or folder",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",e=>{const t=e.target.name;"no"===t?Modal.dismiss():"yes"===t&&(Modal.dismiss(),top.list_frame.location.href=l)})}else top.list_frame.location.href=l}).delegateTo(document,".t3js-filelist-delete")})}}export default new FileDelete; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/FileList.js b/typo3/sysext/filelist/Resources/Public/JavaScript/FileList.js deleted file mode 100644 index 8b0f584461f55c2fd7c1a1d7cb0a51e046be9ba3..0000000000000000000000000000000000000000 --- a/typo3/sysext/filelist/Resources/Public/JavaScript/FileList.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{lll}from"TYPO3/CMS/Core/lit-helper.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import InfoWindow from"TYPO3/CMS/Backend/InfoWindow.js";import{BroadcastMessage}from"TYPO3/CMS/Backend/BroadcastMessage.js";import broadcastService from"TYPO3/CMS/Backend/BroadcastService.js";import Tooltip from"TYPO3/CMS/Backend/Tooltip.js";import NProgress from"nprogress";import Icons from"TYPO3/CMS/Backend/Icons.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import{ModuleStateStorage}from"TYPO3/CMS/Backend/Storage/ModuleStateStorage.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import Severity from"TYPO3/CMS/Backend/Severity.js";var Selectors;!function(e){e.fileListFormSelector='form[name="fileListForm"]',e.commandSelector='input[name="cmd"]',e.searchFieldSelector='input[name="searchTerm"]',e.pointerFieldSelector='input[name="pointer"]'}(Selectors||(Selectors={}));class Filelist{constructor(){this.downloadFilesAndFolders=e=>{const t=e.target,o=e.detail,i=o.configuration,r=[];o.checkboxes.forEach(e=>{const t=e.closest("tr");t?.dataset[i.folderIdentifier]?r.push(t.dataset[i.folderIdentifier]):t?.dataset[i.fileIdentifier]&&r.push(t.dataset[i.fileIdentifier])}),r.length?this.triggerDownload(r,i.downloadUrl,t):Notification.warning(lll("file_download.invalidSelection"))},this.downloadFolder=e=>{const t=e.target,o=t.dataset.folderIdentifier;this.triggerDownload([o],t.dataset.folderDownload,t)},Filelist.processTriggers(),DocumentService.ready().then(()=>{Tooltip.initialize(".table-fit a[title]"),new RegularEvent("click",(e,t)=>{e.preventDefault(),Filelist.openInfoPopup(t.dataset.filelistShowItemType,t.dataset.filelistShowItemIdentifier)}).delegateTo(document,"[data-filelist-show-item-identifier][data-filelist-show-item-type]"),new RegularEvent("click",(e,t)=>{e.preventDefault(),Filelist.openInfoPopup("_FILE",t.dataset.identifier)}).delegateTo(document,"a.filelist-file-info"),new RegularEvent("click",(e,t)=>{e.preventDefault(),Filelist.openInfoPopup("_FILE",t.dataset.identifier)}).delegateTo(document,"a.filelist-file-references"),new RegularEvent("click",(e,t)=>{e.preventDefault();const o=t.getAttribute("href");let i=o?encodeURIComponent(o):encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search);top.list_frame.location.href=o+"&redirect="+i}).delegateTo(document,"a.filelist-file-copy")}),new RegularEvent("multiRecordSelection:action:edit",this.editFileMetadata).bindTo(document),new RegularEvent("multiRecordSelection:action:delete",this.deleteMultiple).bindTo(document),new RegularEvent("multiRecordSelection:action:download",this.downloadFilesAndFolders).bindTo(document),new RegularEvent("click",this.downloadFolder).delegateTo(document,"button[data-folder-download]"),new RegularEvent("multiRecordSelection:action:copyMarked",e=>{Filelist.submitClipboardFormWithCommand("copyMarked",e.target)}).bindTo(document),new RegularEvent("multiRecordSelection:action:removeMarked",e=>{Filelist.submitClipboardFormWithCommand("removeMarked",e.target)}).bindTo(document);const e=""!==document.querySelector([Selectors.fileListFormSelector,Selectors.searchFieldSelector].join(" "))?.value;new RegularEvent("search",t=>{const o=t.target;""===o.value&&e&&o.closest(Selectors.fileListFormSelector)?.submit()}).delegateTo(document,Selectors.searchFieldSelector)}static submitClipboardFormWithCommand(e,t){const o=t.closest(Selectors.fileListFormSelector);if(!o)return;const i=o.querySelector(Selectors.commandSelector);if(i){if(i.value=e,"copyMarked"===e||"removeMarked"===e){const e=o.querySelector(Selectors.pointerFieldSelector),t=Filelist.parseQueryParameters(document.location).pointer;e&&t&&(e.value=t)}o.submit()}}static openInfoPopup(e,t){InfoWindow.showItem(e,t)}static processTriggers(){const e=document.querySelector(".filelist-main");if(null===e)return;const t=encodeURIComponent(e.dataset.filelistCurrentIdentifier);ModuleStateStorage.update("file",t,!0,void 0),Filelist.emitTreeUpdateRequest(e.dataset.filelistCurrentIdentifier)}static emitTreeUpdateRequest(e){const t=new BroadcastMessage("filelist","treeUpdateRequested",{type:"folder",identifier:e});broadcastService.post(t)}static parseQueryParameters(e){let t={};if(e&&Object.prototype.hasOwnProperty.call(e,"search")){let o=e.search.substr(1).split("&");for(let e=0;e<o.length;e++){const i=o[e].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}}return t}static getReturnUrl(e){return""===e&&(e=top.list_frame.document.location.pathname+top.list_frame.document.location.search),encodeURIComponent(e)}deleteMultiple(e){e.preventDefault();const t=e.detail.configuration;Modal.advanced({title:t.title||"Delete",content:t.content||"Are you sure you want to delete those files and folders?",severity:SeverityEnum.warning,buttons:[{text:TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:()=>Modal.currentModal.trigger("modal-dismiss")},{text:t.ok||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(SeverityEnum.warning),trigger:()=>{Filelist.submitClipboardFormWithCommand("delete",e.target),Modal.currentModal.trigger("modal-dismiss")}}]})}editFileMetadata(e){e.preventDefault();const t=e.detail,o=t.configuration;if(!o||!o.idField||!o.table)return;const i=[];t.checkboxes.forEach(e=>{const t=e.closest("tr");null!==t&&t.dataset[o.idField]&&i.push(t.dataset[o.idField])}),i.length?window.location.href=top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+o.table+"]["+i.join(",")+"]=edit&returnUrl="+Filelist.getReturnUrl(o.returnUrl||""):Notification.warning("The selected elements can not be edited.")}triggerDownload(e,t,o){Notification.info(lll("file_download.prepare"),"",2);const i=o.innerHTML;o.setAttribute("disabled","disabled"),Icons.getIcon("spinner-circle-dark",Icons.sizes.small).then(e=>{o.innerHTML=e}),NProgress.configure({parent:"#typo3-filelist",showSpinner:!1}).start(),new AjaxRequest(t).post({items:e}).then(async e=>{let t=e.response.headers.get("Content-Disposition");if(!t){const t=await e.resolve();return void(!1===t.success&&t.status?Notification.warning(lll("file_download."+t.status),lll("file_download."+t.status+".message"),10):Notification.error(lll("file_download.error")))}t=t.substring(t.indexOf(" filename=")+10);const o=await e.raw().arrayBuffer(),i=new Blob([o],{type:e.raw().headers.get("Content-Type")}),r=URL.createObjectURL(i),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),URL.revokeObjectURL(r),document.body.removeChild(n),Notification.success(lll("file_download.success"),"",2)}).catch(()=>{Notification.error(lll("file_download.error"))}).finally(()=>{NProgress.done(),o.removeAttribute("disabled"),o.innerHTML=i})}}export default new Filelist; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/FileReplace.js b/typo3/sysext/filelist/Resources/Public/JavaScript/FileReplace.js deleted file mode 100644 index 4966bed34a9d0c3e943a9332be9fd4762673c747..0000000000000000000000000000000000000000 --- a/typo3/sysext/filelist/Resources/Public/JavaScript/FileReplace.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class FileReplace{constructor(){DocumentService.ready().then(()=>{this.registerEvents()})}registerEvents(){new RegularEvent("click",(function(){const e=this.dataset.filelistClickTarget;document.querySelector(e).click()})).delegateTo(document.body,'[data-filelist-click-target]:not([data-filelist-click-target=""]'),new RegularEvent("change",(function(){const e=this.dataset.filelistChangeTarget;document.querySelector(e).value=this.value})).delegateTo(document.body,'[data-filelist-change-target]:not([data-filelist-change-target=""])')}}export default new FileReplace; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/RenameFile.js b/typo3/sysext/filelist/Resources/Public/JavaScript/RenameFile.js deleted file mode 100644 index 3464bb5694aa0a5d5759ffc93e88b8b0c2f23e56..0000000000000000000000000000000000000000 --- a/typo3/sysext/filelist/Resources/Public/JavaScript/RenameFile.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class RenameFile{constructor(){DocumentService.ready().then(()=>{this.initialize()})}initialize(){const e=document.querySelector(".t3js-submit-file-rename");null!==e&&e.addEventListener("click",this.checkForDuplicate)}checkForDuplicate(e){e.preventDefault();const t=e.currentTarget.form,a=t.querySelector('input[name="data[rename][0][target]"]'),n=t.querySelector('input[name="data[rename][0][destination]"]'),i=t.querySelector('input[name="data[rename][0][conflictMode]"]'),r={fileName:a.value};null!==n&&(r.fileTarget=n.value),new AjaxRequest(TYPO3.settings.ajaxUrls.file_exists).withQueryArguments(r).get({cache:"no-cache"}).then(async e=>{const n=void 0!==(await e.resolve()).uid,r=a.dataset.original,l=a.value;if(n&&r!==l){const e=TYPO3.lang["file_rename.exists.description"].replace("{0}",r).replace(/\{1\}/g,l);Modal.confirm(TYPO3.lang["file_rename.exists.title"],e,SeverityEnum.warning,[{active:!0,btnClass:"btn-default",name:"cancel",text:TYPO3.lang["file_rename.actions.cancel"]},{btnClass:"btn-primary",name:"rename",text:TYPO3.lang["file_rename.actions.rename"]},{btnClass:"btn-default",name:"replace",text:TYPO3.lang["file_rename.actions.override"]}]).on("button.clicked",e=>{"cancel"!==e.target.name&&(null!==i&&(i.value=e.target.name),t.submit()),Modal.dismiss()})}else t.submit()})}}export default new RenameFile; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/context-menu-actions.js b/typo3/sysext/filelist/Resources/Public/JavaScript/context-menu-actions.js new file mode 100644 index 0000000000000000000000000000000000000000..28f9f4b3f432eaeade40f977e37856da41c7f641 --- /dev/null +++ b/typo3/sysext/filelist/Resources/Public/JavaScript/context-menu-actions.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{lll}from"@typo3/core/lit-helper.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Notification from"@typo3/backend/notification.js";import Modal from"@typo3/backend/modal.js";import Md5 from"@typo3/backend/hashing/md5.js";class ContextMenuActions{static getReturnUrl(){return encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search)}static triggerFileDownload(t,e,n=!1){const o=document.createElement("a");o.href=t,o.download=e,document.body.appendChild(o),o.click(),n&&URL.revokeObjectURL(t),document.body.removeChild(o),Notification.success(lll("file_download.success"),"",2)}static renameFile(t,e){const n=$(this).data("action-url");top.TYPO3.Backend.ContentContainer.setUrl(n+"&target="+encodeURIComponent(e)+"&returnUrl="+ContextMenuActions.getReturnUrl())}static editFile(t,e){const n=$(this).data("action-url");top.TYPO3.Backend.ContentContainer.setUrl(n+"&target="+encodeURIComponent(e)+"&returnUrl="+ContextMenuActions.getReturnUrl())}static editMetadata(){const t=$(this).data("metadata-uid");t&&top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit[sys_file_metadata]["+parseInt(t,10)+"]=edit&returnUrl="+ContextMenuActions.getReturnUrl())}static openInfoPopUp(t,e){"sys_file_storage"===t?top.TYPO3.InfoWindow.showItem(t,e):top.TYPO3.InfoWindow.showItem("_FILE",e)}static uploadFile(t,e){const n=$(this).data("action-url");top.TYPO3.Backend.ContentContainer.setUrl(n+"&target="+encodeURIComponent(e)+"&returnUrl="+ContextMenuActions.getReturnUrl())}static createFile(t,e){const n=$(this).data("action-url");top.TYPO3.Backend.ContentContainer.setUrl(n+"&target="+encodeURIComponent(e)+"&returnUrl="+ContextMenuActions.getReturnUrl())}static downloadFile(){ContextMenuActions.triggerFileDownload($(this).data("url"),$(this).data("name"))}static downloadFolder(t,e){Notification.info(lll("file_download.prepare"),"",2);const n=$(this).data("action-url");new AjaxRequest(n).post({items:[e]}).then(async t=>{let e=t.response.headers.get("Content-Disposition");if(!e){const e=await t.resolve();return void(!1===e.success&&e.status?Notification.warning(lll("file_download."+e.status),lll("file_download."+e.status+".message"),10):Notification.error(lll("file_download.error")))}e=e.substring(e.indexOf(" filename=")+10);const n=await t.raw().arrayBuffer(),o=new Blob([n],{type:t.raw().headers.get("Content-Type")});ContextMenuActions.triggerFileDownload(URL.createObjectURL(o),e,!0)}).catch(()=>{Notification.error(lll("file_download.error"))})}static createFilemount(t,e){const n=e.split(":");2===n.length&&top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.FormEngine.moduleUrl+"&edit[sys_filemounts][0]=new&defVals[sys_filemounts][base]="+encodeURIComponent(n[0])+"&defVals[sys_filemounts][path]="+encodeURIComponent(n[1])+"&returnUrl="+ContextMenuActions.getReturnUrl())}static deleteFile(t,e){const n=$(this),o=()=>{top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.FileCommit.moduleUrl+"&data[delete][0][data]="+encodeURIComponent(e)+"&data[delete][0][redirect]="+ContextMenuActions.getReturnUrl())};if(!n.data("title"))return void o();Modal.confirm(n.data("title"),n.data("message"),SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.delete"]||"Delete",btnClass:"btn-warning",name:"delete"}]).on("button.clicked",t=>{"delete"===t.target.name&&o(),Modal.dismiss()})}static copyFile(t,e){const n=Md5.hash(e),o=TYPO3.settings.ajaxUrls.contextmenu_clipboard,a={CB:{el:{["_FILE%7C"+n]:e},setCopyMode:"1"}};new AjaxRequest(o).withQueryArguments(a).get().finally(()=>{top.TYPO3.Backend.ContentContainer.refresh(!0)})}static copyReleaseFile(t,e){const n=Md5.hash(e),o=TYPO3.settings.ajaxUrls.contextmenu_clipboard,a={CB:{el:{["_FILE%7C"+n]:"0"},setCopyMode:"1"}};new AjaxRequest(o).withQueryArguments(a).get().finally(()=>{top.TYPO3.Backend.ContentContainer.refresh(!0)})}static cutFile(t,e){const n=Md5.hash(e),o=TYPO3.settings.ajaxUrls.contextmenu_clipboard,a={CB:{el:{["_FILE%7C"+n]:e}}};new AjaxRequest(o).withQueryArguments(a).get().finally(()=>{top.TYPO3.Backend.ContentContainer.refresh(!0)})}static cutReleaseFile(t,e){const n=Md5.hash(e),o=TYPO3.settings.ajaxUrls.contextmenu_clipboard,a={CB:{el:{["_FILE%7C"+n]:"0"}}};new AjaxRequest(o).withQueryArguments(a).get().finally(()=>{top.TYPO3.Backend.ContentContainer.refresh(!0)})}static pasteFileInto(t,e){const n=$(this),o=n.data("title"),a=()=>{top.TYPO3.Backend.ContentContainer.setUrl(top.TYPO3.settings.FileCommit.moduleUrl+"&CB[paste]=FILE|"+encodeURIComponent(e)+"&CB[pad]=normal&redirect="+ContextMenuActions.getReturnUrl())};if(!o)return void a();Modal.confirm(o,n.data("message"),SeverityEnum.warning,[{text:$(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:$(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-warning",name:"ok"}]).on("button.clicked",t=>{"ok"===t.target.name&&a(),Modal.dismiss()})}}export default ContextMenuActions; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/create-folder.js b/typo3/sysext/filelist/Resources/Public/JavaScript/create-folder.js new file mode 100644 index 0000000000000000000000000000000000000000..86b1370b86462c53b6dd272105fa8616fe07e6ed --- /dev/null +++ b/typo3/sysext/filelist/Resources/Public/JavaScript/create-folder.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import Modal from"@typo3/backend/modal.js";import RegularEvent from"@typo3/core/event/regular-event.js";class CreateFolder{constructor(){this.changed=!1,DocumentService.ready().then(()=>{const e=document.querySelector(".filelist-create-folder-main");if(!(e instanceof HTMLElement))throw new Error("Main element not found");this.selfUrl=e.dataset.selfUrl,this.confirmTitle=e.dataset.confirmTitle,this.confirmText=e.dataset.confirmText,this.registerEvents()})}reload(e){const t=this.selfUrl.replace(/AMOUNT/,e.toString());if(this.changed){const e=Modal.confirm(this.confirmTitle,this.confirmText);e.on("confirm.button.cancel",()=>{e.trigger("modal-dismiss")}),e.on("confirm.button.ok",()=>{e.trigger("modal-dismiss"),window.location.href=t})}else window.location.href=t}registerEvents(){new RegularEvent("change",()=>{this.changed=!0}).delegateTo(document,['input[type="text"][name^="data[newfolder]"]','input[type="text"][name^="data[newfile]"]','input[type="text"][name^="data[newMedia]"]'].join(",")),new RegularEvent("change",e=>{const t=parseInt(e.target.value,10);this.reload(t)}).bindTo(document.getElementById("number-of-new-folders"))}}export default new CreateFolder; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/file-delete.js b/typo3/sysext/filelist/Resources/Public/JavaScript/file-delete.js new file mode 100644 index 0000000000000000000000000000000000000000..8665b2e0cae860a5077ecf6a2806b0e039b434f2 --- /dev/null +++ b/typo3/sysext/filelist/Resources/Public/JavaScript/file-delete.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{SeverityEnum}from"@typo3/backend/enum/severity.js";import RegularEvent from"@typo3/core/event/regular-event.js";import DocumentService from"@typo3/core/document-service.js";import Modal from"@typo3/backend/modal.js";class FileDelete{constructor(){DocumentService.ready().then(()=>{new RegularEvent("click",(e,t)=>{e.preventDefault();let o=t.dataset.redirectUrl;o=o?encodeURIComponent(o):encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search);const n=t.dataset.identifier,a=t.dataset.deleteType,l=t.dataset.deleteUrl+"&data[delete][0][data]="+encodeURIComponent(n)+"&data[delete][0][redirect]="+o;if(t.dataset.check){Modal.confirm(t.dataset.title,t.dataset.bsContent,SeverityEnum.warning,[{text:TYPO3.lang["buttons.confirm.delete_file.no"]||"Cancel",active:!0,btnClass:"btn-default",name:"no"},{text:TYPO3.lang["buttons.confirm."+a+".yes"]||"Yes, delete this file or folder",btnClass:"btn-warning",name:"yes"}]).on("button.clicked",e=>{const t=e.target.name;"no"===t?Modal.dismiss():"yes"===t&&(Modal.dismiss(),top.list_frame.location.href=l)})}else top.list_frame.location.href=l}).delegateTo(document,".t3js-filelist-delete")})}}export default new FileDelete; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/file-list.js b/typo3/sysext/filelist/Resources/Public/JavaScript/file-list.js new file mode 100644 index 0000000000000000000000000000000000000000..19fd2a8802e245057c4b81ff50e416c3e1acff50 --- /dev/null +++ b/typo3/sysext/filelist/Resources/Public/JavaScript/file-list.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{lll}from"@typo3/core/lit-helper.js";import DocumentService from"@typo3/core/document-service.js";import Notification from"@typo3/backend/notification.js";import InfoWindow from"@typo3/backend/info-window.js";import{BroadcastMessage}from"@typo3/backend/broadcast-message.js";import broadcastService from"@typo3/backend/broadcast-service.js";import Tooltip from"@typo3/backend/tooltip.js";import NProgress from"nprogress";import Icons from"@typo3/backend/icons.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import RegularEvent from"@typo3/core/event/regular-event.js";import{ModuleStateStorage}from"@typo3/backend/storage/module-state-storage.js";import Modal from"@typo3/backend/modal.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import Severity from"@typo3/backend/severity.js";var Selectors;!function(e){e.fileListFormSelector='form[name="fileListForm"]',e.commandSelector='input[name="cmd"]',e.searchFieldSelector='input[name="searchTerm"]',e.pointerFieldSelector='input[name="pointer"]'}(Selectors||(Selectors={}));class Filelist{constructor(){this.downloadFilesAndFolders=e=>{const t=e.target,o=e.detail,i=o.configuration,r=[];o.checkboxes.forEach(e=>{const t=e.closest("tr");t?.dataset[i.folderIdentifier]?r.push(t.dataset[i.folderIdentifier]):t?.dataset[i.fileIdentifier]&&r.push(t.dataset[i.fileIdentifier])}),r.length?this.triggerDownload(r,i.downloadUrl,t):Notification.warning(lll("file_download.invalidSelection"))},this.downloadFolder=e=>{const t=e.target,o=t.dataset.folderIdentifier;this.triggerDownload([o],t.dataset.folderDownload,t)},Filelist.processTriggers(),DocumentService.ready().then(()=>{Tooltip.initialize(".table-fit a[title]"),new RegularEvent("click",(e,t)=>{e.preventDefault(),Filelist.openInfoPopup(t.dataset.filelistShowItemType,t.dataset.filelistShowItemIdentifier)}).delegateTo(document,"[data-filelist-show-item-identifier][data-filelist-show-item-type]"),new RegularEvent("click",(e,t)=>{e.preventDefault(),Filelist.openInfoPopup("_FILE",t.dataset.identifier)}).delegateTo(document,"a.filelist-file-info"),new RegularEvent("click",(e,t)=>{e.preventDefault(),Filelist.openInfoPopup("_FILE",t.dataset.identifier)}).delegateTo(document,"a.filelist-file-references"),new RegularEvent("click",(e,t)=>{e.preventDefault();const o=t.getAttribute("href");let i=o?encodeURIComponent(o):encodeURIComponent(top.list_frame.document.location.pathname+top.list_frame.document.location.search);top.list_frame.location.href=o+"&redirect="+i}).delegateTo(document,"a.filelist-file-copy")}),new RegularEvent("multiRecordSelection:action:edit",this.editFileMetadata).bindTo(document),new RegularEvent("multiRecordSelection:action:delete",this.deleteMultiple).bindTo(document),new RegularEvent("multiRecordSelection:action:download",this.downloadFilesAndFolders).bindTo(document),new RegularEvent("click",this.downloadFolder).delegateTo(document,"button[data-folder-download]"),new RegularEvent("multiRecordSelection:action:copyMarked",e=>{Filelist.submitClipboardFormWithCommand("copyMarked",e.target)}).bindTo(document),new RegularEvent("multiRecordSelection:action:removeMarked",e=>{Filelist.submitClipboardFormWithCommand("removeMarked",e.target)}).bindTo(document);const e=""!==document.querySelector([Selectors.fileListFormSelector,Selectors.searchFieldSelector].join(" "))?.value;new RegularEvent("search",t=>{const o=t.target;""===o.value&&e&&o.closest(Selectors.fileListFormSelector)?.submit()}).delegateTo(document,Selectors.searchFieldSelector)}static submitClipboardFormWithCommand(e,t){const o=t.closest(Selectors.fileListFormSelector);if(!o)return;const i=o.querySelector(Selectors.commandSelector);if(i){if(i.value=e,"copyMarked"===e||"removeMarked"===e){const e=o.querySelector(Selectors.pointerFieldSelector),t=Filelist.parseQueryParameters(document.location).pointer;e&&t&&(e.value=t)}o.submit()}}static openInfoPopup(e,t){InfoWindow.showItem(e,t)}static processTriggers(){const e=document.querySelector(".filelist-main");if(null===e)return;const t=encodeURIComponent(e.dataset.filelistCurrentIdentifier);ModuleStateStorage.update("file",t,!0,void 0),Filelist.emitTreeUpdateRequest(e.dataset.filelistCurrentIdentifier)}static emitTreeUpdateRequest(e){const t=new BroadcastMessage("filelist","treeUpdateRequested",{type:"folder",identifier:e});broadcastService.post(t)}static parseQueryParameters(e){let t={};if(e&&Object.prototype.hasOwnProperty.call(e,"search")){let o=e.search.substr(1).split("&");for(let e=0;e<o.length;e++){const i=o[e].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}}return t}static getReturnUrl(e){return""===e&&(e=top.list_frame.document.location.pathname+top.list_frame.document.location.search),encodeURIComponent(e)}deleteMultiple(e){e.preventDefault();const t=e.detail.configuration;Modal.advanced({title:t.title||"Delete",content:t.content||"Are you sure you want to delete those files and folders?",severity:SeverityEnum.warning,buttons:[{text:TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:()=>Modal.currentModal.trigger("modal-dismiss")},{text:t.ok||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(SeverityEnum.warning),trigger:()=>{Filelist.submitClipboardFormWithCommand("delete",e.target),Modal.currentModal.trigger("modal-dismiss")}}]})}editFileMetadata(e){e.preventDefault();const t=e.detail,o=t.configuration;if(!o||!o.idField||!o.table)return;const i=[];t.checkboxes.forEach(e=>{const t=e.closest("tr");null!==t&&t.dataset[o.idField]&&i.push(t.dataset[o.idField])}),i.length?window.location.href=top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+o.table+"]["+i.join(",")+"]=edit&returnUrl="+Filelist.getReturnUrl(o.returnUrl||""):Notification.warning("The selected elements can not be edited.")}triggerDownload(e,t,o){Notification.info(lll("file_download.prepare"),"",2);const i=o.innerHTML;o.setAttribute("disabled","disabled"),Icons.getIcon("spinner-circle-dark",Icons.sizes.small).then(e=>{o.innerHTML=e}),NProgress.configure({parent:"#typo3-filelist",showSpinner:!1}).start(),new AjaxRequest(t).post({items:e}).then(async e=>{let t=e.response.headers.get("Content-Disposition");if(!t){const t=await e.resolve();return void(!1===t.success&&t.status?Notification.warning(lll("file_download."+t.status),lll("file_download."+t.status+".message"),10):Notification.error(lll("file_download.error")))}t=t.substring(t.indexOf(" filename=")+10);const o=await e.raw().arrayBuffer(),i=new Blob([o],{type:e.raw().headers.get("Content-Type")}),r=URL.createObjectURL(i),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),URL.revokeObjectURL(r),document.body.removeChild(n),Notification.success(lll("file_download.success"),"",2)}).catch(()=>{Notification.error(lll("file_download.error"))}).finally(()=>{NProgress.done(),o.removeAttribute("disabled"),o.innerHTML=i})}}export default new Filelist; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/file-replace.js b/typo3/sysext/filelist/Resources/Public/JavaScript/file-replace.js new file mode 100644 index 0000000000000000000000000000000000000000..ceb16ce6d099281fd68b1c8f4f1e1de894b92631 --- /dev/null +++ b/typo3/sysext/filelist/Resources/Public/JavaScript/file-replace.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import RegularEvent from"@typo3/core/event/regular-event.js";import DocumentService from"@typo3/core/document-service.js";class FileReplace{constructor(){DocumentService.ready().then(()=>{this.registerEvents()})}registerEvents(){new RegularEvent("click",(function(){const e=this.dataset.filelistClickTarget;document.querySelector(e).click()})).delegateTo(document.body,'[data-filelist-click-target]:not([data-filelist-click-target=""]'),new RegularEvent("change",(function(){const e=this.dataset.filelistChangeTarget;document.querySelector(e).value=this.value})).delegateTo(document.body,'[data-filelist-change-target]:not([data-filelist-change-target=""])')}}export default new FileReplace; \ No newline at end of file diff --git a/typo3/sysext/filelist/Resources/Public/JavaScript/rename-file.js b/typo3/sysext/filelist/Resources/Public/JavaScript/rename-file.js new file mode 100644 index 0000000000000000000000000000000000000000..1ec4997e2d4387b53d3f893044e0883cdce7ac82 --- /dev/null +++ b/typo3/sysext/filelist/Resources/Public/JavaScript/rename-file.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{SeverityEnum}from"@typo3/backend/enum/severity.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Modal from"@typo3/backend/modal.js";import DocumentService from"@typo3/core/document-service.js";class RenameFile{constructor(){DocumentService.ready().then(()=>{this.initialize()})}initialize(){const e=document.querySelector(".t3js-submit-file-rename");null!==e&&e.addEventListener("click",this.checkForDuplicate)}checkForDuplicate(e){e.preventDefault();const t=e.currentTarget.form,a=t.querySelector('input[name="data[rename][0][target]"]'),n=t.querySelector('input[name="data[rename][0][destination]"]'),i=t.querySelector('input[name="data[rename][0][conflictMode]"]'),r={fileName:a.value};null!==n&&(r.fileTarget=n.value),new AjaxRequest(TYPO3.settings.ajaxUrls.file_exists).withQueryArguments(r).get({cache:"no-cache"}).then(async e=>{const n=void 0!==(await e.resolve()).uid,r=a.dataset.original,l=a.value;if(n&&r!==l){const e=TYPO3.lang["file_rename.exists.description"].replace("{0}",r).replace(/\{1\}/g,l);Modal.confirm(TYPO3.lang["file_rename.exists.title"],e,SeverityEnum.warning,[{active:!0,btnClass:"btn-default",name:"cancel",text:TYPO3.lang["file_rename.actions.cancel"]},{btnClass:"btn-primary",name:"rename",text:TYPO3.lang["file_rename.actions.rename"]},{btnClass:"btn-default",name:"replace",text:TYPO3.lang["file_rename.actions.override"]}]).on("button.clicked",e=>{"cancel"!==e.target.name&&(null!==i&&(i.value=e.target.name),t.submit()),Modal.dismiss()})}else t.submit()})}}export default new RenameFile; \ No newline at end of file diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Be/TableListViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Be/TableListViewHelper.php index de012f880079c565ad91070d255e732ed60867da..41b4a634debe63982bc72c75419e21ce80699d6e 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Be/TableListViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Be/TableListViewHelper.php @@ -118,12 +118,12 @@ final class TableListViewHelper extends AbstractBackendViewHelper $clickTitleMode = $this->arguments['clickTitleMode']; $enableControlPanels = $this->arguments['enableControlPanels']; - $this->getPageRenderer()->loadJavaScriptModule('TYPO3/CMS/Recordlist/Recordlist.js'); - $this->getPageRenderer()->loadJavaScriptModule('TYPO3/CMS/Recordlist/RecordDownloadButton.js'); - $this->getPageRenderer()->loadJavaScriptModule('TYPO3/CMS/Backend/ActionDispatcher.js'); + $this->getPageRenderer()->loadJavaScriptModule('@typo3/recordlist/recordlist.js'); + $this->getPageRenderer()->loadJavaScriptModule('@typo3/recordlist/record-download-button.js'); + $this->getPageRenderer()->loadJavaScriptModule('@typo3/backend/action-dispatcher.js'); if ($enableControlPanels === true) { - $this->getPageRenderer()->loadJavaScriptModule('TYPO3/CMS/Backend/MultiRecordSelection.js'); - $this->getPageRenderer()->loadJavaScriptModule('TYPO3/CMS/Backend/ContextMenu.js'); + $this->getPageRenderer()->loadJavaScriptModule('@typo3/backend/multi-record-selection.js'); + $this->getPageRenderer()->loadJavaScriptModule('@typo3/backend/context-menu.js'); } // We need to include the language file, since DatabaseRecordList is heavily using ->getLL $this->getLanguageService()->includeLLFile('EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf'); diff --git a/typo3/sysext/form/Classes/Controller/FormEditorController.php b/typo3/sysext/form/Classes/Controller/FormEditorController.php index 445bb933e089f9757c38fe2916680b264b1d03ad..57f6bd6129732502764c43e266e4ff0ce4aad32e 100644 --- a/typo3/sysext/form/Classes/Controller/FormEditorController.php +++ b/typo3/sysext/form/Classes/Controller/FormEditorController.php @@ -171,7 +171,7 @@ class FormEditorController extends AbstractBackendController $jsModules = $requireJsModules + $javaScriptModules; $pageRenderer = $this->pageRenderer; $pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction( - JavaScriptModuleInstruction::create('TYPO3/CMS/Form/Backend/Helper.js', 'Helper') + JavaScriptModuleInstruction::create('@typo3/form/backend/helper.js', 'Helper') ->invoke('dispatchFormEditor', $jsModules, $formEditorAppInitialData) ); $pageRenderer->addInlineSettingArray(null, $addInlineSettings); diff --git a/typo3/sysext/form/Classes/Controller/FormManagerController.php b/typo3/sysext/form/Classes/Controller/FormManagerController.php index 8a5664210d26939fbdbbbc02589b75d9e6b5c64c..2f716c53db1aba364aa73372ad75ca80468793bd 100644 --- a/typo3/sysext/form/Classes/Controller/FormManagerController.php +++ b/typo3/sysext/form/Classes/Controller/FormManagerController.php @@ -107,7 +107,7 @@ class FormManagerController extends AbstractBackendController $this->pageRenderer->loadRequireJs(); } $this->pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction( - JavaScriptModuleInstruction::create('TYPO3/CMS/Form/Backend/Helper.js', 'Helper') + JavaScriptModuleInstruction::create('@typo3/form/backend/helper.js', 'Helper') ->invoke('dispatchFormManager', $jsModules, $this->getFormManagerAppInitialData()) ); $moduleTemplate->setModuleClass($this->request->getPluginName() . '_' . $this->request->getControllerName()); diff --git a/typo3/sysext/form/Configuration/JavaScriptModules.php b/typo3/sysext/form/Configuration/JavaScriptModules.php index 05a38436fc34ffb0487cd94e2b1f157e65176f6d..60941967cd468e61776b81c2dfd6dd1a80d56489 100644 --- a/typo3/sysext/form/Configuration/JavaScriptModules.php +++ b/typo3/sysext/form/Configuration/JavaScriptModules.php @@ -9,6 +9,6 @@ return [ 'backend.contextmenu', ], 'imports' => [ - 'TYPO3/CMS/Form/Backend/' => 'EXT:form/Resources/Public/JavaScript/Backend/', + '@typo3/form/Backend/' => 'EXT:form/Resources/Public/JavaScript/Backend/', ], ]; diff --git a/typo3/sysext/form/Configuration/Yaml/FormSetup.yaml b/typo3/sysext/form/Configuration/Yaml/FormSetup.yaml index c9c06254b73985e9396ff5bf9b584471327c71aa..34db181e39f2a9ceaf4ec78b271dac7b86b5fca5 100644 --- a/typo3/sysext/form/Configuration/Yaml/FormSetup.yaml +++ b/typo3/sysext/form/Configuration/Yaml/FormSetup.yaml @@ -69,9 +69,9 @@ TYPO3: translationFiles: 10: 'EXT:form/Resources/Private/Language/Database.xlf' dynamicJavaScriptModules: - app: TYPO3/CMS/Form/Backend/FormEditor.js - mediator: TYPO3/CMS/Form/Backend/FormEditor/Mediator.js - viewModel: TYPO3/CMS/Form/Backend/FormEditor/ViewModel.js + app: '@typo3/form/backend/form-editor.js' + mediator: '@typo3/form/backend/form-editor/mediator.js' + viewModel: '@typo3/form/backend/form-editor/view-model.js' addInlineSettings: { } maximumUndoSteps: 10 stylesheets: @@ -144,8 +144,8 @@ TYPO3: formManager: dynamicJavaScriptModules: - app: TYPO3/CMS/Form/Backend/FormManager.js - viewModel: TYPO3/CMS/Form/Backend/FormManager/ViewModel.js + app: '@typo3/form/backend/form-manager.js' + viewModel: '@typo3/form/backend/form-manager/view-model.js' stylesheets: 100: 'EXT:form/Resources/Public/Css/form.css' translationFiles: diff --git a/typo3/sysext/form/Documentation/I/ApiReference/Index.rst b/typo3/sysext/form/Documentation/I/ApiReference/Index.rst index 7ac928372dc3c440f72eb3ba98c12f650dbe4148..d9585c69f1406d97507d942674555df7a9c9890e 100644 --- a/typo3/sysext/form/Documentation/I/ApiReference/Index.rst +++ b/typo3/sysext/form/Documentation/I/ApiReference/Index.rst @@ -3960,7 +3960,7 @@ A simple example that registers a custom ``inspector editor`` called 'Inspector- :emphasize-lines: 107-116 /** - * Module: TYPO3/CMS/MySitePackage/Backend/FormEditor/ViewModel + * Module: @typo3/my-site-package/backend/form-editor/view-model */ define(['jquery', 'TYPO3/CMS/Form/Backend/FormEditor/Helper' @@ -4624,7 +4624,7 @@ In this example, 'GenderSelect' is basically a radio button form element with so formEditor: dynamicJavaScriptModules: additionalViewModelModules: - 10: 'TYPO3/CMS/MySitePackage/Backend/FormEditor/ViewModel.js' + 10: '@typo3/my-site-package/backend/form-editor/view-model.js' formEditorPartials: FormElement-GenderSelect: 'Stage/SelectTemplate' formElementsDefinition: @@ -4657,7 +4657,7 @@ In this example, 'GenderSelect' is basically a radio button form element with so :emphasize-lines: 105-109 /** - * Module: TYPO3/CMS/MySitePackage/Backend/FormEditor/ViewModel + * Module: @typo3/my-site-package/backend/form-editor/view-model */ define(['jquery', 'TYPO3/CMS/Form/Backend/FormEditor/Helper' diff --git a/typo3/sysext/form/Documentation/I/Concepts/FormEditor/Index.rst b/typo3/sysext/form/Documentation/I/Concepts/FormEditor/Index.rst index 3993511f6ba50f7e3c039401badeba0285033488..c982bbec5e2002a740e31f708cd25aaa7384cfe6 100644 --- a/typo3/sysext/form/Documentation/I/Concepts/FormEditor/Index.rst +++ b/typo3/sysext/form/Documentation/I/Concepts/FormEditor/Index.rst @@ -201,7 +201,7 @@ for setting up your own module. * Module: @my-vendor/my-site-package/backend/form-editor/view-model.js */ import $ from 'jquery'; - import * as Helper from 'TYPO3/CMS/Form/Backend/FormEditor/Helper.js' + import * as Helper from '@typo3/form/backend/form-editor/helper.js' /** * @private diff --git a/typo3/sysext/form/Documentation/I/Config/configuration/Index.rst b/typo3/sysext/form/Documentation/I/Config/configuration/Index.rst index 5d9c1769dc3de34e204158fd1467f44dcfdde7f4..7c05d259f49d6f9a0d53ef9b2578125a902738d0 100644 --- a/typo3/sysext/form/Documentation/I/Config/configuration/Index.rst +++ b/typo3/sysext/form/Documentation/I/Config/configuration/Index.rst @@ -3768,9 +3768,9 @@ Full default configuration translationFiles: 10: 'EXT:form/Resources/Private/Language/Database.xlf' dynamicJavaScriptModules: - app: TYPO3/CMS/Form/Backend/FormEditor.js - mediator: TYPO3/CMS/Form/Backend/FormEditor/Mediator.js - viewModel: TYPO3/CMS/Form/Backend/FormEditor/ViewModel.js + app: @typo3/form/backend/form-editor.js + mediator: @typo3/form/backend/form-editor/mediator.js + viewModel: @typo3/form/backend/form-editor/view-model.js addInlineSettings: { } maximumUndoSteps: 10 stylesheets: @@ -4650,8 +4650,8 @@ Full default configuration - plaintext formManager: dynamicJavaScriptModules: - app: TYPO3/CMS/Form/Backend/FormManager.js - viewModel: TYPO3/CMS/Form/Backend/FormManager/ViewModel.js + app: @typo3/form/backend/form-manager.js + viewModel: @typo3/form/backend/form-manager/view-model.js stylesheets: 100: 'EXT:form/Resources/Public/Css/form.css' translationFiles: diff --git a/typo3/sysext/form/Documentation/I/Config/formManager/Index.rst b/typo3/sysext/form/Documentation/I/Config/formManager/Index.rst index 1177d6e7cac6db0c95bcfa6a354fca17cd8330dc..6952a070bf78155a8f925cc67ffa8ed74ba70c55 100644 --- a/typo3/sysext/form/Documentation/I/Config/formManager/Index.rst +++ b/typo3/sysext/form/Documentation/I/Config/formManager/Index.rst @@ -67,8 +67,8 @@ dynamicJavaScriptModules.viewModel :emphasize-lines: 3 dynamicJavaScriptModules: - app: TYPO3/CMS/Form/Backend/FormManager.js - viewModel: TYPO3/CMS/Form/Backend/FormManager/ViewModel.js + app: @typo3/form/backend/form-manager.js + viewModel: @typo3/form/backend/form-manager/view-model.js :aspect:`Description` Internal setting. ES6 module specifier for the form manager JavaScript view model. diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor.js index 2d8d759f863b7e6484d6777fb656a92fc2e0431a..b58dfd21f75f20eaca8f7d928f5e5feb68ee6c96 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor.js @@ -12,11 +12,11 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormEditor + * Module: @typo3/form/backend/form-editor */ import $ from 'jquery'; -import * as Core from 'TYPO3/CMS/Form/Backend/FormEditor/Core.js'; -import Notification from 'TYPO3/CMS/Backend/Notification.js'; +import * as Core from '@typo3/form/backend/form-editor/core.js'; +import Notification from '@typo3/backend/notification.js'; const { getInstance diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Core.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Core.js index 9a2d0f86a0f97265845b9e4ee9e946acc4861c39..2a23d27cc866f144d56083ccc250c9e2735a1ee1 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Core.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Core.js @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormEditor/Core + * Module: @typo3/form/backend/form-editor/core */ import $ from 'jquery'; diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Helper.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Helper.js index 2309324873e1570e1cd8e2d7193fef08820ccf0c..51eec72cd3b9a74668b0a828c07309fdeb0ae05a 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Helper.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Helper.js @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormEditor/Helper + * Module: @typo3/form/backend/form-editor/helper */ import $ from 'jquery'; diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/InspectorComponent.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/InspectorComponent.js index e9008d2435ebf460df49e392634bd4d9a68e3b80..85bf01dc482697de2ee209d7764ee8603fdb513e 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/InspectorComponent.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/InspectorComponent.js @@ -12,16 +12,16 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormEditor/InspectorComponent + * Module: @typo3/form/backend/form-editor/inspector-component */ import $ from 'jquery'; -import * as Helper from 'TYPO3/CMS/Form/Backend/FormEditor/Helper.js'; -import Icons from 'TYPO3/CMS/Backend/Icons.js'; -import Notification from 'TYPO3/CMS/Backend/Notification.js'; -import Modal from 'TYPO3/CMS/Backend/Modal.js'; -import {MessageUtility} from 'TYPO3/CMS/Backend/Utility/MessageUtility.js'; -import 'TYPO3/CMS/Form/Backend/Contrib/jquery.mjs.nestedSortable.js'; +import * as Helper from '@typo3/form/backend/form-editor/helper.js'; +import Icons from '@typo3/backend/icons.js'; +import Notification from '@typo3/backend/notification.js'; +import Modal from '@typo3/backend/modal.js'; +import {MessageUtility} from '@typo3/backend/utility/message-utility.js'; +import '@typo3/form/backend/contrib/jquery.mjs.nested-sortable.js'; const { bootstrap, diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Mediator.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Mediator.js index 5d2f6f9f0ab4b37202485abab9909dd949c5e80a..0aedd86202bd43acb6c8b26b25bb30ebe348baac 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Mediator.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/Mediator.js @@ -12,10 +12,10 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormEditor/Mediator + * Module: @typo3/form/backend/form-editor/mediator */ import $ from 'jquery'; -import * as Helper from 'TYPO3/CMS/Form/Backend/FormEditor/Helper.js'; +import * as Helper from '@typo3/form/backend/form-editor/helper.js'; const { bootstrap diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/ModalsComponent.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/ModalsComponent.js index 41ef1d80c2979a42e1800d75cad5c4b26c4e13a6..ca81860827f2cf3f36b2f1f5af67516379c2a5f0 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/ModalsComponent.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/ModalsComponent.js @@ -12,13 +12,13 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormEditor/ModalsComponent + * Module: @typo3/form/backend/form-editor/modals-component */ import $ from 'jquery'; -import * as Helper from 'TYPO3/CMS/Form/Backend/FormEditor/Helper.js'; -import Modal from 'TYPO3/CMS/Backend/Modal.js'; -import Severity from 'TYPO3/CMS/Backend/Severity.js'; -import Icons from 'TYPO3/CMS/Backend/Icons.js'; +import * as Helper from '@typo3/form/backend/form-editor/helper.js'; +import Modal from '@typo3/backend/modal.js'; +import Severity from '@typo3/backend/severity.js'; +import Icons from '@typo3/backend/icons.js'; const { bootstrap, diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/StageComponent.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/StageComponent.js index c1236587a1a3b136d8ee7c2d5ab81aecb38cdf9e..9cbf2006e6db4ae28ac7d2b6e18463a0b8bbc7c8 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/StageComponent.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/StageComponent.js @@ -12,12 +12,12 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormEditor/StageComponent + * Module: @typo3/form/backend/form-editor/stage-component */ import $ from 'jquery'; -import * as Helper from 'TYPO3/CMS/Form/Backend/FormEditor/Helper.js'; -import Icons from 'TYPO3/CMS/Backend/Icons.js'; -import 'TYPO3/CMS/Form/Backend/Contrib/jquery.mjs.nestedSortable.js'; +import * as Helper from '@typo3/form/backend/form-editor/helper.js'; +import Icons from '@typo3/backend/icons.js'; +import '@typo3/form/backend/contrib/jquery.mjs.nested-sortable.js'; const { bootstrap, diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/TreeComponent.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/TreeComponent.js index 0ac64266b480b7d7e365b339a7e84b1eaf88e5ec..db044cc11ddbe69a940bc663a885bc1cbe9487c0 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/TreeComponent.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/TreeComponent.js @@ -12,12 +12,12 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormEditor/TreeComponent + * Module: @typo3/form/backend/form-editor/tree-component */ import $ from 'jquery'; -import * as Helper from 'TYPO3/CMS/Form/Backend/FormEditor/Helper.js'; -import Icons from 'TYPO3/CMS/Backend/Icons.js'; -import 'TYPO3/CMS/Form/Backend/Contrib/jquery.mjs.nestedSortable.js'; +import * as Helper from '@typo3/form/backend/form-editor/helper.js'; +import Icons from '@typo3/backend/icons.js'; +import '@typo3/form/backend/contrib/jquery.mjs.nested-sortable.js'; const { bootstrap, diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/ViewModel.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/ViewModel.js index c4d01ebdcfc69e2f7dd18131ae8d2847451d98b1..eb8f3bb4009d71bdf4840d0e5bfde5ab5035008e 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/ViewModel.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormEditor/ViewModel.js @@ -12,17 +12,17 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormEditor/ViewModel + * Module: @typo3/form/backend/form-editor/view-model */ import $ from 'jquery'; -import * as TreeComponent from 'TYPO3/CMS/Form/Backend/FormEditor/TreeComponent.js'; -import * as ModalsComponent from 'TYPO3/CMS/Form/Backend/FormEditor/ModalsComponent.js'; -import * as InspectorComponent from 'TYPO3/CMS/Form/Backend/FormEditor/InspectorComponent.js'; -import * as StageComponent from 'TYPO3/CMS/Form/Backend/FormEditor/StageComponent.js'; -import * as Helper from 'TYPO3/CMS/Form/Backend/FormEditor/Helper.js'; -import Icons from 'TYPO3/CMS/Backend/Icons.js'; -import Notification from 'TYPO3/CMS/Backend/Notification.js'; -import {loadModule} from 'TYPO3/CMS/Core/JavaScriptItemProcessor.js'; +import * as TreeComponent from '@typo3/form/backend/form-editor/tree-component.js'; +import * as ModalsComponent from '@typo3/form/backend/form-editor/modals-component.js'; +import * as InspectorComponent from '@typo3/form/backend/form-editor/inspector-component.js'; +import * as StageComponent from '@typo3/form/backend/form-editor/stage-component.js'; +import * as Helper from '@typo3/form/backend/form-editor/helper.js'; +import Icons from '@typo3/backend/icons.js'; +import Notification from '@typo3/backend/notification.js'; +import {loadModule} from '@typo3/core/java-script-item-processor.js'; const { addAbstractViewValidationResults, diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormManager.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormManager.js index a82bac3fb7e71a1d691d6675b54bbd3daba29b67..7c0545acc1e9647f711a26564d5f185dd6aea379 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormManager.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormManager.js @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormManager + * Module: @typo3/form/backend/form-manager */ import $ from 'jquery'; diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormManager/ViewModel.js b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormManager/ViewModel.js index 576ef878b09a43c0c528cd214748daa98e655646..79b836cfff3951a2b50c356839f62ebad1d4f4ed 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormManager/ViewModel.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/Backend/FormManager/ViewModel.js @@ -12,15 +12,15 @@ */ /** - * Module: TYPO3/CMS/Form/Backend/FormManager/ViewModel + * Module: @typo3/form/backend/form-manager/view-model */ import $ from 'jquery'; -import Modal from 'TYPO3/CMS/Backend/Modal.js'; -import Severity from 'TYPO3/CMS/Backend/Severity.js'; -import MultiStepWizard from 'TYPO3/CMS/Backend/MultiStepWizard.js'; -import Icons from 'TYPO3/CMS/Backend/Icons.js'; -import Notification from 'TYPO3/CMS/Backend/Notification.js'; -import SecurityUtility from 'TYPO3/CMS/Core/SecurityUtility.js'; +import Modal from '@typo3/backend/modal.js'; +import Severity from '@typo3/backend/severity.js'; +import MultiStepWizard from '@typo3/backend/multi-step-wizard.js'; +import Icons from '@typo3/backend/icons.js'; +import Notification from '@typo3/backend/notification.js'; +import SecurityUtility from '@typo3/core/security-utility.js'; const { bootstrap diff --git a/typo3/sysext/form/Resources/Public/JavaScript/Backend/Helper.js b/typo3/sysext/form/Resources/Public/JavaScript/backend/helper.js similarity index 92% rename from typo3/sysext/form/Resources/Public/JavaScript/Backend/Helper.js rename to typo3/sysext/form/Resources/Public/JavaScript/backend/helper.js index 7c3a9e87306164491123990ca9c51e5efa67ae2d..ba423ca37c57fa22f3cfe00b640d9a3b8ab73e3a 100644 --- a/typo3/sysext/form/Resources/Public/JavaScript/Backend/Helper.js +++ b/typo3/sysext/form/Resources/Public/JavaScript/backend/helper.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -import{loadModule}from"TYPO3/CMS/Core/JavaScriptItemProcessor.js";export class Helper{static dispatchFormEditor(o,e){Promise.all([loadModule(o.app),loadModule(o.mediator),loadModule(o.viewModel)]).then(o=>((o,a,d)=>{window.TYPO3.FORMEDITOR_APP=o.getInstance(e,a,d).run()})(...o))}static dispatchFormManager(o,e){Promise.all([loadModule(o.app),loadModule(o.viewModel)]).then(o=>((o,a)=>{window.TYPO3.FORMMANAGER_APP=o.getInstance(e,a).run()})(...o))}} \ No newline at end of file +import{loadModule}from"@typo3/core/java-script-item-processor.js";export class Helper{static dispatchFormEditor(o,e){Promise.all([loadModule(o.app),loadModule(o.mediator),loadModule(o.viewModel)]).then(o=>((o,a,d)=>{window.TYPO3.FORMEDITOR_APP=o.getInstance(e,a,d).run()})(...o))}static dispatchFormManager(o,e){Promise.all([loadModule(o.app),loadModule(o.viewModel)]).then(o=>((o,a)=>{window.TYPO3.FORMMANAGER_APP=o.getInstance(e,a).run()})(...o))}} \ No newline at end of file diff --git a/typo3/sysext/impexp/Classes/ContextMenu/ItemProvider.php b/typo3/sysext/impexp/Classes/ContextMenu/ItemProvider.php index a253f0f85595fdeec6ef81528de148835328047f..a3e120553127df0f1575022deb45b89cf52994fa 100644 --- a/typo3/sysext/impexp/Classes/ContextMenu/ItemProvider.php +++ b/typo3/sysext/impexp/Classes/ContextMenu/ItemProvider.php @@ -115,7 +115,7 @@ class ItemProvider extends AbstractProvider protected function getAdditionalAttributes(string $itemName): array { $attributes = [ - 'data-callback-module' => 'TYPO3/CMS/Impexp/ContextMenuActions', + 'data-callback-module' => '@typo3/impexp/context-menu-actions', ]; // Add action url for items diff --git a/typo3/sysext/impexp/Configuration/JavaScriptModules.php b/typo3/sysext/impexp/Configuration/JavaScriptModules.php index 97434d331bc6a80bcaf23d321720bde00a4f24f7..37b6d9b59d03450e0e641d4b90b06af7de2bdbc0 100644 --- a/typo3/sysext/impexp/Configuration/JavaScriptModules.php +++ b/typo3/sysext/impexp/Configuration/JavaScriptModules.php @@ -8,6 +8,6 @@ return [ 'backend.contextmenu', ], 'imports' => [ - 'TYPO3/CMS/Impexp/' => 'EXT:impexp/Resources/Public/JavaScript/', + '@typo3/impexp/' => 'EXT:impexp/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/impexp/Resources/Private/Templates/Export.html b/typo3/sysext/impexp/Resources/Private/Templates/Export.html index 8ac17a058ebff3dca93d3371044ae8f1b99b4fbc..47fba9a78245fc4651fd1f5e1eff5ffc07602e23 100644 --- a/typo3/sysext/impexp/Resources/Private/Templates/Export.html +++ b/typo3/sysext/impexp/Resources/Private/Templates/Export.html @@ -10,9 +10,9 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/ContextMenu.js', - 1: 'TYPO3/CMS/Impexp/ImportExport.js', - 2: 'TYPO3/CMS/Backend/Element/ImmediateActionElement.js' + 0: '@typo3/backend/context-menu.js', + 1: '@typo3/impexp/import-export.js', + 2: '@typo3/backend/element/immediate-action-element.js' }" /> <form action="{f:be.uri(route:'tx_impexp_export')}" method="post" id="ImportExportController"> diff --git a/typo3/sysext/impexp/Resources/Private/Templates/Import.html b/typo3/sysext/impexp/Resources/Private/Templates/Import.html index c26ec28f404af20afd383ccde5d331e1b6ca7e3e..7a13008d37dde85513e6dfc0e148f0b26ac5f0c4 100644 --- a/typo3/sysext/impexp/Resources/Private/Templates/Import.html +++ b/typo3/sysext/impexp/Resources/Private/Templates/Import.html @@ -9,9 +9,9 @@ <f:section name="Content"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/ContextMenu.js', - 1: 'TYPO3/CMS/Impexp/ImportExport.js', - 2: 'TYPO3/CMS/Backend/Element/ImmediateActionElement.js' + 0: '@typo3/backend/context-menu.js', + 1: '@typo3/impexp/import-export.js', + 2: '@typo3/backend/element/immediate-action-element.js' }" /> <form action="{f:be.uri(route:'tx_impexp_import')}" method="post" id="ImportExportController" enctype="multipart/form-data"> diff --git a/typo3/sysext/impexp/Resources/Public/JavaScript/ImportExport.js b/typo3/sysext/impexp/Resources/Public/JavaScript/ImportExport.js deleted file mode 100644 index bb54df00ed276c758ee5e46e807edb42b7d8411f..0000000000000000000000000000000000000000 --- a/typo3/sysext/impexp/Resources/Public/JavaScript/ImportExport.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Modal from"TYPO3/CMS/Backend/Modal.js";class ImportExport{constructor(){$(()=>{$(document).on("click",".t3js-confirm-trigger",t=>{const e=$(t.currentTarget);Modal.confirm(e.data("title"),e.data("message")).on("confirm.button.ok",()=>{$("#t3js-submit-field").attr("name",e.attr("name")).closest("form").trigger("submit"),Modal.currentModal.trigger("modal-dismiss")}).on("confirm.button.cancel",()=>{Modal.currentModal.trigger("modal-dismiss")})}),$(".t3js-impexp-toggledisabled").on("click",()=>{const t=$('table.t3js-impexp-preview tr[data-active="hidden"] input.t3js-exclude-checkbox');if(t.length){const e=t.get(0);t.prop("checked",!e.checked)}})})}}export default new ImportExport; \ No newline at end of file diff --git a/typo3/sysext/impexp/Resources/Public/JavaScript/ContextMenuActions.js b/typo3/sysext/impexp/Resources/Public/JavaScript/context-menu-actions.js similarity index 100% rename from typo3/sysext/impexp/Resources/Public/JavaScript/ContextMenuActions.js rename to typo3/sysext/impexp/Resources/Public/JavaScript/context-menu-actions.js diff --git a/typo3/sysext/impexp/Resources/Public/JavaScript/import-export.js b/typo3/sysext/impexp/Resources/Public/JavaScript/import-export.js new file mode 100644 index 0000000000000000000000000000000000000000..7c0eb666ac33e7d0e9326d7121b3481dee7dc83f --- /dev/null +++ b/typo3/sysext/impexp/Resources/Public/JavaScript/import-export.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Modal from"@typo3/backend/modal.js";class ImportExport{constructor(){$(()=>{$(document).on("click",".t3js-confirm-trigger",t=>{const o=$(t.currentTarget);Modal.confirm(o.data("title"),o.data("message")).on("confirm.button.ok",()=>{$("#t3js-submit-field").attr("name",o.attr("name")).closest("form").trigger("submit"),Modal.currentModal.trigger("modal-dismiss")}).on("confirm.button.cancel",()=>{Modal.currentModal.trigger("modal-dismiss")})}),$(".t3js-impexp-toggledisabled").on("click",()=>{const t=$('table.t3js-impexp-preview tr[data-active="hidden"] input.t3js-exclude-checkbox');if(t.length){const o=t.get(0);t.prop("checked",!o.checked)}})})}}export default new ImportExport; \ No newline at end of file diff --git a/typo3/sysext/info/Classes/Controller/TranslationStatusController.php b/typo3/sysext/info/Classes/Controller/TranslationStatusController.php index 53391f7f9ea6579d18f91c9f23149dbe5c40f484..5191bd245d4a46d07b1868603cc90e2915b90af4 100644 --- a/typo3/sysext/info/Classes/Controller/TranslationStatusController.php +++ b/typo3/sysext/info/Classes/Controller/TranslationStatusController.php @@ -71,7 +71,7 @@ class TranslationStatusController extends InfoModuleController { $theOutput = '<h1>' . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_title')) . '</h1>'; if ($this->id) { - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Info/TranslationStatus.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/info/translation-status.js'); $moduleMenu = ''; diff --git a/typo3/sysext/info/Configuration/JavaScriptModules.php b/typo3/sysext/info/Configuration/JavaScriptModules.php index be5fe0b23987b0b70930b7e00a7a89ea39f57e63..1cf830085b6449371d98c1e3af4404682b309b24 100644 --- a/typo3/sysext/info/Configuration/JavaScriptModules.php +++ b/typo3/sysext/info/Configuration/JavaScriptModules.php @@ -3,6 +3,6 @@ return [ 'dependencies' => [], 'imports' => [ - 'TYPO3/CMS/Info/' => 'EXT:info/Resources/Public/JavaScript/', + '@typo3/info/' => 'EXT:info/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/info/Resources/Private/Templates/Main.html b/typo3/sysext/info/Resources/Private/Templates/Main.html index 329faff3465ce71d03dff93fb1cb3046fe37cce7..ef3747575d797ceeed857a7f5b647eba6e0b95fa 100644 --- a/typo3/sysext/info/Resources/Private/Templates/Main.html +++ b/typo3/sysext/info/Resources/Private/Templates/Main.html @@ -9,8 +9,8 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/ContextMenu.js', - 1: 'TYPO3/CMS/Backend/Element/ImmediateActionElement.js' + 0: '@typo3/backend/context-menu.js', + 1: '@typo3/backend/element/immediate-action-element.js' }" /> diff --git a/typo3/sysext/info/Resources/Public/JavaScript/TranslationStatus.js b/typo3/sysext/info/Resources/Public/JavaScript/translation-status.js similarity index 100% rename from typo3/sysext/info/Resources/Public/JavaScript/TranslationStatus.js rename to typo3/sysext/info/Resources/Public/JavaScript/translation-status.js diff --git a/typo3/sysext/install/Classes/Controller/InstallerController.php b/typo3/sysext/install/Classes/Controller/InstallerController.php index 15eb4d7f2738088670555d9d8f85c7ff4be3b781..b35fa498cadc2a1d6abd0e8028fee962e63f54eb 100644 --- a/typo3/sysext/install/Classes/Controller/InstallerController.php +++ b/typo3/sysext/install/Classes/Controller/InstallerController.php @@ -160,7 +160,7 @@ class InstallerController ]; $importMap = new ImportMap($packages); $sitePath = $request->getAttribute('normalizedParams')->getSitePath(); - $initModule = $sitePath . $importMap->resolveImport('TYPO3/CMS/Install/InitInstaller.js'); + $initModule = $sitePath . $importMap->resolveImport('@typo3/install/init-installer.js'); $view = $this->initializeView(); $view->assign('bust', $bust); $view->assign('initModule', $initModule); diff --git a/typo3/sysext/install/Classes/Controller/LayoutController.php b/typo3/sysext/install/Classes/Controller/LayoutController.php index edaf999f1790fa6ccc6265d0dcb61358e2cc3306..553cd9400f6a22e0f7df6ebde2abfcd0114952de 100644 --- a/typo3/sysext/install/Classes/Controller/LayoutController.php +++ b/typo3/sysext/install/Classes/Controller/LayoutController.php @@ -76,7 +76,7 @@ class LayoutController extends AbstractController ]; $importMap = new ImportMap($packages); $sitePath = $request->getAttribute('normalizedParams')->getSitePath(); - $initModule = $sitePath . $importMap->resolveImport('TYPO3/CMS/Install/InitInstall.js'); + $initModule = $sitePath . $importMap->resolveImport('@typo3/install/init-install.js'); $view = $this->initializeView($request); $view->assignMultiple([ diff --git a/typo3/sysext/install/Configuration/JavaScriptModules.php b/typo3/sysext/install/Configuration/JavaScriptModules.php index be4c4b45a9cdc48fb7bc3fb9336b03da07d60363..90d25fbbc63bda002202e3ed769112eb914d8315 100644 --- a/typo3/sysext/install/Configuration/JavaScriptModules.php +++ b/typo3/sysext/install/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Install/' => 'EXT:install/Resources/Public/JavaScript/', + '@typo3/install/' => 'EXT:install/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/install/Resources/Private/Templates/BackendModule/BackendUserConfirmation.html b/typo3/sysext/install/Resources/Private/Templates/BackendModule/BackendUserConfirmation.html index f14107786cf65bf2f86d1624848bf4b07eb6c624..68d99568602e100d44157d0c8cefb62a98898249 100644 --- a/typo3/sysext/install/Resources/Private/Templates/BackendModule/BackendUserConfirmation.html +++ b/typo3/sysext/install/Resources/Private/Templates/BackendModule/BackendUserConfirmation.html @@ -9,7 +9,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Install/BackendUserConfirmation.js' + 0: '@typo3/install/backend-user-confirmation.js' }" /> diff --git a/typo3/sysext/install/Resources/Private/Templates/Environment/Cards.html b/typo3/sysext/install/Resources/Private/Templates/Environment/Cards.html index 6d95bfa7e0c12a4d6dba1cd9a7ff803efe008047..67e155583b8c7c381be25b43c049063503ffa778 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Environment/Cards.html +++ b/typo3/sysext/install/Resources/Private/Templates/Environment/Cards.html @@ -9,7 +9,7 @@ <p class="card-text">Gives an overview of your host environment including its web server, PHP version, selected database and the application context.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-modal-size="small" data-import="TYPO3/CMS/Install/Module/Environment/SystemInformation.js">Show System Information</button> + <button type="button" class="btn btn-default" data-modal-size="small" data-import="@typo3/install/module/environment/system-information.js">Show System Information</button> </div> </div> <div class="card card-size-fixed-small"> @@ -18,7 +18,7 @@ <p class="card-text">Analyzes your host environment, identifying any issues that may prevent TYPO3 from running correctly.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Environment/EnvironmentCheck.js">Check Environment</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/environment/environment-check.js">Check Environment</button> </div> </div> <div class="card card-size-fixed-small"> @@ -27,7 +27,7 @@ <p class="card-text">Analyzes your folder structure, checking files and directories for correct permissions and identifying any files or directories that may be missing from your installation.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Environment/FolderStructure.js">Check Directory Status</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/environment/folder-structure.js">Check Directory Status</button> </div> </div> <div class="card card-size-fixed-small"> @@ -36,7 +36,7 @@ <p class="card-text">Outputs detailed information about your installation of PHP. Including version details and enabled PHP extensions.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Environment/PhpInfo.js">View PHP Info</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/environment/php-info.js">View PHP Info</button> </div> </div> <div class="card card-size-fixed-small"> @@ -45,7 +45,7 @@ <p class="card-text">Test your mail configuration by sending out a dummy email via TYPO3.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-modal-size="small" data-import="TYPO3/CMS/Install/Module/Environment/MailTest.js">Test Mail Setup</button> + <button type="button" class="btn btn-default" data-modal-size="small" data-import="@typo3/install/module/environment/mail-test.js">Test Mail Setup</button> </div> </div> <div class="card card-size-fixed-small"> @@ -54,7 +54,7 @@ <p class="card-text">Creates test images and compares them against a set of reference images to help ensure that image processing is working correctly within your environment.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Environment/ImageProcessing.js">Test Images</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/environment/image-processing.js">Test Images</button> </div> </div> </div> diff --git a/typo3/sysext/install/Resources/Private/Templates/Maintenance/Cards.html b/typo3/sysext/install/Resources/Private/Templates/Maintenance/Cards.html index 971ad2ba04923c344869ac0fd6ec08e19bac1423..e95d19e18dc108c54722aa9ad2ebbdc16569b04a 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Maintenance/Cards.html +++ b/typo3/sysext/install/Resources/Private/Templates/Maintenance/Cards.html @@ -9,7 +9,7 @@ <p class="card-text">This action directly clears all registered caches including opcode and dependency injection cache.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-primary " data-inline="1" data-import="TYPO3/CMS/Install/Module/Maintenance/Cache.js">Flush cache</button> + <button type="button" class="btn btn-primary " data-inline="1" data-import="@typo3/install/module/maintenance/cache.js">Flush cache</button> </div> </div> <div class="card card-size-fixed-small"> @@ -18,7 +18,7 @@ <p class="card-text">Compare and update the database table and field definitions of your installation against the specification defined for every activated extension.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Maintenance/DatabaseAnalyzer.js">Analyze database</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/maintenance/database-analyzer.js">Analyze database</button> </div> </div> <div class="card card-size-fixed-small"> @@ -27,7 +27,7 @@ <p class="card-text">Clears temporary files including concatenated JS/CSS files and processed images.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Maintenance/ClearTypo3tempFiles.js">Scan temporary files</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/maintenance/clear-typo3temp-files.js">Scan temporary files</button> </div> </div> <div class="card card-size-fixed-small {f:if(condition:'{composerMode}', then: 'card-disabled')}"> @@ -44,7 +44,7 @@ </f:then> <f:else> <div class="card-footer"> - <button type="button" class="btn btn-primary " data-inline="1" data-import="TYPO3/CMS/Install/Module/Maintenance/DumpAutoload.js">Dump autoload</button> + <button type="button" class="btn btn-primary " data-inline="1" data-import="@typo3/install/module/maintenance/dump-autoload.js">Dump autoload</button> </div> </f:else> </f:if> @@ -55,7 +55,7 @@ <p class="card-text">Truncates persistent database tables, which are not related to caching.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Maintenance/ClearTables.js">Scan tables</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/maintenance/clear-tables.js">Scan tables</button> </div> </div> <div class="card card-size-fixed-small"> @@ -64,7 +64,7 @@ <p class="card-text">Create new administrative users and grant them system maintainer privileges (optional).</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-modal-size="small" data-import="TYPO3/CMS/Install/Module/Maintenance/CreateAdmin.js">Create Administrator</button> + <button type="button" class="btn btn-default" data-modal-size="small" data-import="@typo3/install/module/maintenance/create-admin.js">Create Administrator</button> </div> </div> <div class="card card-size-fixed-small"> @@ -73,7 +73,7 @@ <p class="card-text">Clears preferences and settings for all backend users. The <code>uc</code> field is then set to an empty string.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-primary " data-inline="1" data-import="TYPO3/CMS/Install/Module/Maintenance/ResetBackendUserUc.js">Reset backend user preferences</button> + <button type="button" class="btn btn-primary " data-inline="1" data-import="@typo3/install/module/maintenance/reset-backend-user-uc.js">Reset backend user preferences</button> </div> </div> <div class="card card-size-fixed-small"> @@ -82,7 +82,7 @@ <p class="card-text">Download and update language packs for installed extensions.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Maintenance/LanguagePacks.js">Manage languages</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/maintenance/language-packs.js">Manage languages</button> </div> </div> </div> diff --git a/typo3/sysext/install/Resources/Private/Templates/Settings/Cards.html b/typo3/sysext/install/Resources/Private/Templates/Settings/Cards.html index c0d478cee86229a07b77332622aa460e5a019f1b..aed458ab116f076262c59a145ea3ab2828e77d5e 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Settings/Cards.html +++ b/typo3/sysext/install/Resources/Private/Templates/Settings/Cards.html @@ -9,7 +9,7 @@ <p class="card-text">Configure settings for all enabled extensions.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Settings/ExtensionConfiguration.js">Configure extensions</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/settings/extension-configuration.js">Configure extensions</button> </div> </div> <div class="card card-size-fixed-small"> @@ -18,7 +18,7 @@ <p class="card-text">Set a new password for the Install Tool when accessed in Standalone mode.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-modal-size="small" data-import="TYPO3/CMS/Install/Module/Settings/ChangeInstallToolPassword.js">Change Install Tool Password</button> + <button type="button" class="btn btn-default" data-modal-size="small" data-import="@typo3/install/module/settings/change-install-tool-password.js">Change Install Tool Password</button> </div> </div> <div class="card card-size-fixed-small"> @@ -27,7 +27,7 @@ <p class="card-text">Specify which backend administrators have access to the Admin Tools module and Install Tool when accessed in Standalone Mode.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-modal-size="medium" data-import="TYPO3/CMS/Install/Module/Settings/SystemMaintainer.js">Manage System Maintainers</button> + <button type="button" class="btn btn-default" data-modal-size="medium" data-import="@typo3/install/module/settings/system-maintainer.js">Manage System Maintainers</button> </div> </div> <div class="card card-size-fixed-small"> @@ -36,7 +36,7 @@ <p class="card-text">Configure image processing, debug/live mode and mail settings.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Settings/Presets.js">Choose Preset</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/settings/presets.js">Choose Preset</button> </div> </div> <div class="card card-size-fixed-small"> @@ -45,7 +45,7 @@ <p class="card-text">Enable and disable core features.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-modal-size="medium" data-import="TYPO3/CMS/Install/Module/Settings/Features.js">Configure Features</button> + <button type="button" class="btn btn-default" data-modal-size="medium" data-import="@typo3/install/module/settings/features.js">Configure Features</button> </div> </div> <div class="card card-size-fixed-small"> @@ -54,7 +54,7 @@ <p class="card-text">Modify settings written to LocalConfiguration.php.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Settings/LocalConfiguration.js">Configure options</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/settings/local-configuration.js">Configure options</button> </div> </div> </div> diff --git a/typo3/sysext/install/Resources/Private/Templates/Upgrade/Cards.html b/typo3/sysext/install/Resources/Private/Templates/Upgrade/Cards.html index c71559d37f6181b38f345caf3c78e8b8777bfbf4..7b65ef06227a44c5a58d27447addeaf4626c571a 100644 --- a/typo3/sysext/install/Resources/Private/Templates/Upgrade/Cards.html +++ b/typo3/sysext/install/Resources/Private/Templates/Upgrade/Cards.html @@ -17,7 +17,7 @@ </f:then> <f:else> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Upgrade/CoreUpdate.js">Update Core</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/upgrade/core-update.js">Update Core</button> </div> </f:else> </f:if> @@ -28,7 +28,7 @@ <p class="card-text">Finalises the upgrade process when moving to a major release.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Upgrade/UpgradeWizards.js">Run Upgrade Wizard</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/upgrade/upgrade-wizards.js">Run Upgrade Wizard</button> </div> </div> <div class="card card-size-fixed-small"> @@ -37,7 +37,7 @@ <p class="card-text">View and search for important changes that have been made for every major and minor release of TYPO3.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Upgrade/UpgradeDocs.js">View Upgrade Documentation</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/upgrade/upgrade-docs.js">View Upgrade Documentation</button> </div> </div> <div class="card card-size-fixed-small"> @@ -47,7 +47,7 @@ </p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Upgrade/TcaExtTablesCheck.js">Check TCA</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/upgrade/tca-ext-tables-check.js">Check TCA</button> </div> </div> <div class="card card-size-fixed-small"> @@ -56,7 +56,7 @@ <p class="card-text">Checks the compatibility of all active extensions against the current (installed) version of TYPO3.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-modal-size="small" data-import="TYPO3/CMS/Install/Module/Upgrade/ExtensionCompatTester.js">Check Extension Compatibility</button> + <button type="button" class="btn btn-default" data-modal-size="small" data-import="@typo3/install/module/upgrade/extension-compat-tester.js">Check Extension Compatibility</button> </div> </div> <div class="card card-size-fixed-small"> @@ -65,7 +65,7 @@ <p class="card-text">Identifies any third-party extensions that contain an outdated TCA configuration which should be adapted for the current (installed) version of TYPO3.</p> </div> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Upgrade/TcaMigrationsCheck.js">Check TCA Migrations</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/upgrade/tca-migrations-check.js">Check TCA Migrations</button> </div> </div> <div class="card card-size-fixed-small {f:if(condition:'!{extensionFoldersInTypo3conf}', then: 'card-disabled')}"> @@ -76,7 +76,7 @@ <f:if condition="{extensionFoldersInTypo3conf}"> <f:then> <div class="card-footer"> - <button type="button" class="btn btn-default" data-import="TYPO3/CMS/Install/Module/Upgrade/ExtensionScanner.js">Scan Extension Files</button> + <button type="button" class="btn btn-default" data-import="@typo3/install/module/upgrade/extension-scanner.js">Scan Extension Files</button> </div> </f:then> <f:else> diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Ajax/AjaxQueue.js b/typo3/sysext/install/Resources/Public/JavaScript/Ajax/AjaxQueue.js deleted file mode 100644 index 9fd87819c85bc047dde7bebdb36198df0f751229..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Ajax/AjaxQueue.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";class AjaxQueue{constructor(){this.requests=[],this.requestCount=0,this.threshold=5,this.queue=[]}add(e){this.queue.push(e),this.handleNext()}flush(){this.queue=[],this.requests.forEach(e=>e.abort()),this.requests=[]}handleNext(){this.queue.length>0&&this.requestCount<this.threshold&&(this.incrementRequestCount(),this.sendRequest(this.queue.shift()).finally(()=>{this.decrementRequestCount(),this.handleNext()}))}async sendRequest(e){const t=new AjaxRequest(e.url);let s;return s=void 0!==e.method&&"POST"===e.method.toUpperCase()?t.post(e.data):t.withQueryArguments(e.data||{}).get(),this.requests.push(t),s.then(e.onfulfilled,e.onrejected).then(()=>{const e=this.requests.indexOf(t);delete this.requests[e]})}incrementRequestCount(){this.requestCount++}decrementRequestCount(){this.requestCount>0&&this.requestCount--}}export default new AjaxQueue; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/BackendUserConfirmation.js b/typo3/sysext/install/Resources/Public/JavaScript/BackendUserConfirmation.js deleted file mode 100644 index bcde2c4169f491c8b5ca1b60854252d7d34e531e..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/BackendUserConfirmation.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";class BackendUserConfirmation{constructor(){DocumentService.ready().then(()=>this.addFocusToFormInput())}addFocusToFormInput(){const o=document.getElementById("confirmationPassword");null!==o&&o.focus()}}export default new BackendUserConfirmation; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Installer.js b/typo3/sysext/install/Resources/Public/JavaScript/Installer.js deleted file mode 100644 index 49d1ff6d0a0c02266aaaa7b6bb492d1870540c7a..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Installer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import PasswordStrength from"TYPO3/CMS/Install/Module/PasswordStrength.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";class Installer{constructor(){this.selectorBody=".t3js-body",this.selectorModuleContent=".t3js-module-content",this.selectorMainContent=".t3js-installer-content",this.selectorProgressBar=".t3js-installer-progress",this.selectorDatabaseConnectOutput=".t3js-installer-databaseConnect-output",this.selectorDatabaseSelectOutput=".t3js-installer-databaseSelect-output",this.selectorDatabaseDataOutput=".t3js-installer-databaseData-output",this.initializeEvents(),$(()=>{this.initialize()})}initializeEvents(){$(document).on("click",".t3js-installer-environmentFolders-retry",e=>{e.preventDefault(),this.showEnvironmentAndFolders()}),$(document).on("click",".t3js-installer-environmentFolders-execute",e=>{e.preventDefault(),this.executeEnvironmentAndFolders()}),$(document).on("click",".t3js-installer-databaseConnect-execute",e=>{e.preventDefault(),this.executeDatabaseConnect()}),$(document).on("click",".t3js-installer-databaseSelect-execute",e=>{e.preventDefault(),this.executeDatabaseSelect()}),$(document).on("click",".t3js-installer-databaseData-execute",e=>{e.preventDefault(),this.executeDatabaseData()}),$(document).on("click",".t3js-installer-defaultConfiguration-execute",e=>{e.preventDefault(),this.executeDefaultConfiguration()}),$(document).on("click",".t3-install-form-password-toggle",e=>{e.preventDefault();const t=$(e.currentTarget),a=$(t.data("toggleTarget")),s=t.find(t.data("toggleIcon"));"password"===a.attr("type")?(s.removeClass("fa-lock").addClass("fa-eye"),a.attr("type","text")):(a.attr("type","password"),s.removeClass("fa-eye").addClass("fa-lock"))}),$(document).on("keyup",".t3-install-form-password-strength",()=>{PasswordStrength.initialize(".t3-install-form-password-strength")}),$(document).on("change","#t3js-connect-database-driver",e=>{let t=$(e.currentTarget).val();$(".t3-install-driver-data").hide(),$(".t3-install-driver-data input").attr("disabled","disabled"),$("#"+t+" input").attr("disabled",null),$("#"+t).show()})}initialize(){this.setProgress(0),this.getMainLayout()}getUrl(e){let t=location.href;return t=t.replace(location.search,""),void 0!==e&&(t=t+"?install[action]="+e),t}setProgress(e){let t=$(this.selectorProgressBar),a=0;0!==e&&(a=e/5*100,t.find(".progress-bar").empty().text(e+" / 5 - "+a+"% Complete")),t.find(".progress-bar").css("width",a+"%").attr("aria-valuenow",a)}getMainLayout(){new AjaxRequest(this.getUrl("mainLayout")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();$(this.selectorBody).empty().append(t.html),this.checkInstallerAvailable()})}checkInstallerAvailable(){new AjaxRequest(this.getUrl("checkInstallerAvailable")).get({cache:"no-cache"}).then(async e=>{(await e.resolve()).success?this.checkEnvironmentAndFolders():this.showInstallerNotAvailable()})}showInstallerNotAvailable(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showInstallerNotAvailable")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&e.empty().append(a.html)})}checkEnvironmentAndFolders(){this.setProgress(1),new AjaxRequest(this.getUrl("checkEnvironmentAndFolders")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkTrustedHostsPattern():this.showEnvironmentAndFolders()})}showEnvironmentAndFolders(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showEnvironmentAndFolders")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();if(!0===a.success){e.empty().html(a.html);let t=$(".t3js-installer-environment-details"),s=!1;Array.isArray(a.environmentStatusErrors)&&a.environmentStatusErrors.forEach(e=>{s=!0;let a=InfoBox.render(e.severity,e.title,e.message);t.append(a)}),Array.isArray(a.environmentStatusWarnings)&&a.environmentStatusWarnings.forEach(e=>{s=!0;let a=InfoBox.render(e.severity,e.title,e.message);t.append(a)}),Array.isArray(a.structureErrors)&&a.structureErrors.forEach(e=>{s=!0;let a=InfoBox.render(e.severity,e.title,e.message);t.append(a)}),s?(t.show(),$(".t3js-installer-environmentFolders-bad").show()):$(".t3js-installer-environmentFolders-good").show()}})}executeEnvironmentAndFolders(){new AjaxRequest(this.getUrl("executeEnvironmentAndFolders")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success&&this.checkTrustedHostsPattern()})}checkTrustedHostsPattern(){new AjaxRequest(this.getUrl("checkTrustedHostsPattern")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.executeSilentConfigurationUpdate():this.executeAdjustTrustedHostsPattern()})}executeAdjustTrustedHostsPattern(){new AjaxRequest(this.getUrl("executeAdjustTrustedHostsPattern")).get({cache:"no-cache"}).then(()=>{this.executeSilentConfigurationUpdate()})}executeSilentConfigurationUpdate(){new AjaxRequest(this.getUrl("executeSilentConfigurationUpdate")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.executeSilentTemplateFileUpdate():this.executeSilentConfigurationUpdate()})}executeSilentTemplateFileUpdate(){new AjaxRequest(this.getUrl("executeSilentTemplateFileUpdate")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkDatabaseConnect():this.executeSilentTemplateFileUpdate()})}checkDatabaseConnect(){this.setProgress(2),new AjaxRequest(this.getUrl("checkDatabaseConnect")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkDatabaseSelect():this.showDatabaseConnect()})}showDatabaseConnect(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showDatabaseConnect")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&(e.empty().html(a.html),$("#t3js-connect-database-driver").trigger("change"))})}executeDatabaseConnect(){let e=$(this.selectorDatabaseConnectOutput),t={"install[action]":"executeDatabaseConnect","install[token]":$(this.selectorModuleContent).data("installer-database-connect-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((e,a)=>{t[a.name]=a.value}),new AjaxRequest(this.getUrl()).post(t).then(async t=>{const a=await t.resolve();!0===a.success?this.checkDatabaseSelect():Array.isArray(a.status)&&(e.empty(),a.status.forEach(t=>{let a=InfoBox.render(t.severity,t.title,t.message);e.append(a)}))})}checkDatabaseSelect(){this.setProgress(3),new AjaxRequest(this.getUrl("checkDatabaseSelect")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkDatabaseData():this.showDatabaseSelect()})}showDatabaseSelect(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showDatabaseSelect")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&e.empty().html(a.html)})}executeDatabaseSelect(){let e=$(this.selectorDatabaseSelectOutput),t={"install[action]":"executeDatabaseSelect","install[token]":$(this.selectorModuleContent).data("installer-database-select-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((e,a)=>{t[a.name]=a.value}),new AjaxRequest(this.getUrl()).post(t).then(async t=>{const a=await t.resolve();!0===a.success?this.checkDatabaseRequirements():Array.isArray(a.status)&&a.status.forEach(t=>{let a=InfoBox.render(t.severity,t.title,t.message);e.empty().append(a)})})}checkDatabaseRequirements(){let e=$(this.selectorDatabaseSelectOutput),t={"install[action]":"checkDatabaseRequirements","install[token]":$(this.selectorModuleContent).data("installer-database-check-requirements-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((e,a)=>{t[a.name]=a.value}),new AjaxRequest(this.getUrl()).post(t).then(async t=>{const a=await t.resolve();!0===a.success?this.checkDatabaseData():Array.isArray(a.status)&&(e.empty(),a.status.forEach(t=>{let a=InfoBox.render(t.severity,t.title,t.message);e.append(a)}))})}checkDatabaseData(){this.setProgress(4),new AjaxRequest(this.getUrl("checkDatabaseData")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.showDefaultConfiguration():this.showDatabaseData()})}showDatabaseData(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showDatabaseData")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&e.empty().html(a.html)})}executeDatabaseData(){let e=$(this.selectorDatabaseDataOutput),t={"install[action]":"executeDatabaseData","install[token]":$(this.selectorModuleContent).data("installer-database-data-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((e,a)=>{t[a.name]=a.value});let a=ProgressBar.render(Severity.loading,"Loading...","");e.empty().html(a),new AjaxRequest(this.getUrl()).post(t).then(async t=>{const a=await t.resolve();!0===a.success?this.showDefaultConfiguration():Array.isArray(a.status)&&a.status.forEach(t=>{let a=InfoBox.render(t.severity,t.title,t.message);e.empty().append(a)})})}showDefaultConfiguration(){let e=$(this.selectorMainContent);this.setProgress(5),new AjaxRequest(this.getUrl("showDefaultConfiguration")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&e.empty().html(a.html)})}executeDefaultConfiguration(){let e={"install[action]":"executeDefaultConfiguration","install[token]":$(this.selectorModuleContent).data("installer-default-configuration-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((t,a)=>{e[a.name]=a.value}),new AjaxRequest(this.getUrl()).post(e).then(async e=>{const t=await e.resolve();top.location.href=t.redirect})}}export default new Installer; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/EnvironmentCheck.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/EnvironmentCheck.js deleted file mode 100644 index 18558ac4adc60ff824dc1dc0334772d3f3ab1b12..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/EnvironmentCheck.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class EnvironmentCheck extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorGridderBadge=".t3js-environmentCheck-badge",this.selectorExecuteTrigger=".t3js-environmentCheck-execute",this.selectorOutputContainer=".t3js-environmentCheck-output"}initialize(e){this.currentModal=e,this.runTests(),e.on("click",this.selectorExecuteTrigger,e=>{e.preventDefault(),this.runTests()})}runTests(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=$(this.selectorGridderBadge);t.text("").hide();const r=ProgressBar.render(Severity.loading,"Loading...","");e.find(this.selectorOutputContainer).empty().append(r),new AjaxRequest(Router.getUrl("environmentCheckGetStatus")).get({cache:"no-cache"}).then(async r=>{const o=await r.resolve();e.empty().append(o.html),Modal.setButtons(o.buttons);let s=0,n=0;!0===o.success&&"object"==typeof o.status?($.each(o.status,(t,r)=>{Array.isArray(r)&&r.length>0&&r.forEach(t=>{1===t.severity&&s++,2===t.severity&&n++;const r=InfoBox.render(t.severity,t.title,t.message);e.find(this.selectorOutputContainer).append(r)})}),n>0?t.removeClass("label-warning").addClass("label-danger").text(n).show():s>0&&t.removeClass("label-error").addClass("label-warning").text(s).show()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}}export default new EnvironmentCheck; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/FolderStructure.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/FolderStructure.js deleted file mode 100644 index 838b3cd862b14f17ff9ffc1753a0d96e3e5fbbba..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/FolderStructure.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class FolderStructure extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorGridderBadge=".t3js-folderStructure-badge",this.selectorOutputContainer=".t3js-folderStructure-output",this.selectorErrorContainer=".t3js-folderStructure-errors",this.selectorErrorList=".t3js-folderStructure-errors-list",this.selectorErrorFixTrigger=".t3js-folderStructure-errors-fix",this.selectorOkContainer=".t3js-folderStructure-ok",this.selectorOkList=".t3js-folderStructure-ok-list",this.selectorPermissionContainer=".t3js-folderStructure-permissions"}static removeLoadingMessage(e){e.find(".alert-loading").remove()}initialize(e){this.currentModal=e,this.getStatus(),e.on("click",this.selectorErrorFixTrigger,e=>{e.preventDefault(),this.fix()})}getStatus(){const e=this.getModalBody(),t=$(this.selectorGridderBadge);t.text("").hide(),e.find(this.selectorOutputContainer).empty().append(ProgressBar.render(Severity.loading,"Loading...","")),new AjaxRequest(Router.getUrl("folderStructureGetStatus")).get({cache:"no-cache"}).then(async r=>{const o=await r.resolve();if(e.empty().append(o.html),Modal.setButtons(o.buttons),!0===o.success&&Array.isArray(o.errorStatus)){let r=0;o.errorStatus.length>0?(e.find(this.selectorErrorContainer).show(),e.find(this.selectorErrorList).empty(),o.errorStatus.forEach(o=>{r++,t.text(r).show();const s=InfoBox.render(o.severity,o.title,o.message);e.find(this.selectorErrorList).append(s)})):e.find(this.selectorErrorContainer).hide()}!0===o.success&&Array.isArray(o.okStatus)&&(o.okStatus.length>0?(e.find(this.selectorOkContainer).show(),e.find(this.selectorOkList).empty(),o.okStatus.forEach(t=>{const r=InfoBox.render(t.severity,t.title,t.message);e.find(this.selectorOkList).append(r)})):e.find(this.selectorOkContainer).hide());let s=o.folderStructureFilePermissionStatus;e.find(this.selectorPermissionContainer).empty().append(InfoBox.render(s.severity,s.title,s.message)),s=o.folderStructureDirectoryPermissionStatus,e.find(this.selectorPermissionContainer).append(InfoBox.render(s.severity,s.title,s.message))},t=>{Router.handleAjaxError(t,e)})}fix(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.findInModal(this.selectorOutputContainer),r=ProgressBar.render(Severity.loading,"Loading...","");t.empty().html(r),new AjaxRequest(Router.getUrl("folderStructureFix")).get({cache:"no-cache"}).then(async e=>{const r=await e.resolve();FolderStructure.removeLoadingMessage(t),!0===r.success&&Array.isArray(r.fixedStatus)?(r.fixedStatus.length>0?r.fixedStatus.forEach(e=>{t.append(InfoBox.render(e.severity,e.title,e.message))}):t.append(InfoBox.render(Severity.warning,"Nothing fixed","")),this.getStatus()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}}export default new FolderStructure; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/ImageProcessing.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/ImageProcessing.js deleted file mode 100644 index 71dde28d8961e60176642345b7ba639e3e565ff3..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/ImageProcessing.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class ImageProcessing extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorExecuteTrigger=".t3js-imageProcessing-execute",this.selectorTestContainer=".t3js-imageProcessing-twinContainer",this.selectorTwinImageTemplate=".t3js-imageProcessing-twinImage-template",this.selectorCommandContainer=".t3js-imageProcessing-command",this.selectorCommandText=".t3js-imageProcessing-command-text",this.selectorTwinImages=".t3js-imageProcessing-images"}initialize(e){this.currentModal=e,this.getData(),e.on("click",this.selectorExecuteTrigger,e=>{e.preventDefault(),this.runTests()})}getData(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("imageProcessingGetData")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success?(e.empty().append(s.html),Modal.setButtons(s.buttons),this.runTests()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}runTests(){const e=this.getModalBody(),t=this.findInModal(this.selectorExecuteTrigger);this.setModalButtonsState(!1);const s=this.findInModal(this.selectorTwinImageTemplate),o=[];e.find(this.selectorTestContainer).each((t,r)=>{const n=$(r),a=n.data("test"),i=InfoBox.render(Severity.loading,"Loading...","");n.empty().html(i);const c=new AjaxRequest(Router.getUrl(a)).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();if(!0===t.success){n.empty(),Array.isArray(t.status)&&t.status.forEach(e=>{const t=InfoBox.render(e.severity,e.title,e.message);n.append(t)});const e=s.clone();if(e.removeClass("t3js-imageProcessing-twinImage-template"),!0===t.fileExists&&(e.find("img.reference").attr("src",t.referenceFile),e.find("img.result").attr("src",t.outputFile),e.find(this.selectorTwinImages).show()),Array.isArray(t.command)&&t.command.length>0){e.find(this.selectorCommandContainer).show();const s=[];t.command.forEach(e=>{s.push("<strong>Command:</strong>\n"+e[1]),3===e.length&&s.push("<strong>Result:</strong>\n"+e[2])}),e.find(this.selectorCommandText).html(s.join("\n"))}n.append(e)}},t=>{Router.handleAjaxError(t,e)});o.push(c)}),Promise.all(o).then(()=>{t.removeClass("disabled").prop("disabled",!1)})}}export default new ImageProcessing; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/MailTest.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/MailTest.js deleted file mode 100644 index 17736ef084d75ed631dc8c7de1889a6235b5581f..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/MailTest.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class MailTest extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorOutputContainer=".t3js-mailTest-output",this.selectorMailTestButton=".t3js-mailTest-execute"}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorMailTestButton,t=>{t.preventDefault(),this.send()}),t.on("submit","form",t=>{t.preventDefault(),this.send()})}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("mailTestGetData")).get({cache:"no-cache"}).then(async e=>{const o=await e.resolve();!0===o.success?(t.empty().append(o.html),Modal.setButtons(o.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}send(){this.setModalButtonsState(!1);const t=this.getModuleContent().data("mail-test-token"),e=this.findInModal(this.selectorOutputContainer),o=ProgressBar.render(Severity.loading,"Loading...","");e.empty().html(o),new AjaxRequest(Router.getUrl()).post({install:{action:"mailTest",token:t,email:this.findInModal(".t3js-mailTest-email").val()}}).then(async t=>{const o=await t.resolve();e.empty(),Array.isArray(o.status)?o.status.forEach(t=>{const o=InfoBox.render(t.severity,t.title,t.message);e.html(o)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},()=>{Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")}).finally(()=>{this.setModalButtonsState(!0)})}}export default new MailTest; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/PhpInfo.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/PhpInfo.js deleted file mode 100644 index 834bf9abf3d6fd72bc49aa2950d33b84aed9e5ea..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/PhpInfo.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";class PhpInfo extends AbstractInteractableModule{initialize(e){this.currentModal=e,this.getData()}getData(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("phpInfoGetData")).get({cache:"no-cache"}).then(async t=>{const o=await t.resolve();!0===o.success?e.empty().append(o.html):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}}export default new PhpInfo; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/SystemInformation.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/SystemInformation.js deleted file mode 100644 index 2c9c8935948b406985bd3f5307a43b5007213ae6..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Environment/SystemInformation.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";class SystemInformation extends AbstractInteractableModule{initialize(t){this.currentModal=t,this.getData()}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("systemInformationGetData")).get({cache:"no-cache"}).then(async e=>{const o=await e.resolve();!0===o.success?t.empty().append(o.html):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}}export default new SystemInformation; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/Cache.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/Cache.js deleted file mode 100644 index de98922b41d4222328808e884e55d89a944711fc..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/Cache.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";import{AbstractInlineModule}from"TYPO3/CMS/Install/Module/AbstractInlineModule.js";class Cache extends AbstractInlineModule{initialize(e){this.setButtonState(e,!1),new AjaxRequest(Router.getUrl("cacheClearAll","maintenance")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?t.status.length>0&&t.status.forEach(e=>{Notification.success(e.title,e.message)}):Notification.error("Something went wrong clearing caches")},()=>{Notification.error("Clearing caches failed","Clearing caches went wrong on the server side. Check the system for broken extensions or missing database tables and try again.")}).finally(()=>{this.setButtonState(e,!0)})}}export default new Cache; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/ClearTables.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/ClearTables.js deleted file mode 100644 index fe2647ccd7686a4b1ea83958970c67e1a646f3dd..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/ClearTables.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";class ClearTables extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorClearTrigger=".t3js-clearTables-clear",this.selectorStatsTrigger=".t3js-clearTables-stats",this.selectorOutputContainer=".t3js-clearTables-output",this.selectorStatContainer=".t3js-clearTables-stat-container",this.selectorStatTemplate=".t3js-clearTables-stat-template",this.selectorStatDescription=".t3js-clearTables-stat-description",this.selectorStatRows=".t3js-clearTables-stat-rows",this.selectorStatName=".t3js-clearTables-stat-name"}initialize(t){this.currentModal=t,this.getStats(),t.on("click",this.selectorStatsTrigger,t=>{t.preventDefault(),$(this.selectorOutputContainer).empty(),this.getStats()}),t.on("click",this.selectorClearTrigger,t=>{const e=$(t.target).closest(this.selectorClearTrigger).data("table");t.preventDefault(),this.clear(e)})}getStats(){this.setModalButtonsState(!1);const t=this.getModalBody();new AjaxRequest(Router.getUrl("clearTablesStats")).get({cache:"no-cache"}).then(async e=>{const s=await e.resolve();!0===s.success?(t.empty().append(s.html),Modal.setButtons(s.buttons),Array.isArray(s.stats)&&s.stats.length>0&&s.stats.forEach(e=>{if(e.rowCount>0){const s=t.find(this.selectorStatTemplate).clone();s.find(this.selectorStatDescription).text(e.description),s.find(this.selectorStatName).text(e.name),s.find(this.selectorStatRows).text(e.rowCount),s.find(this.selectorClearTrigger).attr("data-table",e.name),t.find(this.selectorStatContainer).append(s.html())}})):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}clear(t){const e=this.getModalBody(),s=this.getModuleContent().data("clear-tables-clear-token");new AjaxRequest(Router.getUrl()).post({install:{action:"clearTablesClear",token:s,table:t}}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?e.status.forEach(t=>{Notification.success(t.title,t.message)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log."),this.getStats()},t=>{Router.handleAjaxError(t,e)})}}export default new ClearTables; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/ClearTypo3tempFiles.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/ClearTypo3tempFiles.js deleted file mode 100644 index 99cae4a2a978955d6cd9ad2cdbf7c7a0c8210ac4..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/ClearTypo3tempFiles.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";class ClearTypo3tempFiles extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorDeleteTrigger=".t3js-clearTypo3temp-delete",this.selectorOutputContainer=".t3js-clearTypo3temp-output",this.selectorStatContainer=".t3js-clearTypo3temp-stat-container",this.selectorStatsTrigger=".t3js-clearTypo3temp-stats",this.selectorStatTemplate=".t3js-clearTypo3temp-stat-template",this.selectorStatNumberOfFiles=".t3js-clearTypo3temp-stat-numberOfFiles",this.selectorStatDirectory=".t3js-clearTypo3temp-stat-directory"}initialize(t){this.currentModal=t,this.getStats(),t.on("click",this.selectorStatsTrigger,t=>{t.preventDefault(),$(this.selectorOutputContainer).empty(),this.getStats()}),t.on("click",this.selectorDeleteTrigger,t=>{const e=$(t.currentTarget).data("folder"),s=$(t.currentTarget).data("storage-uid");t.preventDefault(),this.delete(e,s)})}getStats(){this.setModalButtonsState(!1);const t=this.getModalBody();new AjaxRequest(Router.getUrl("clearTypo3tempFilesStats")).get({cache:"no-cache"}).then(async e=>{const s=await e.resolve();!0===s.success?(t.empty().append(s.html),Modal.setButtons(s.buttons),Array.isArray(s.stats)&&s.stats.length>0&&s.stats.forEach(e=>{if(e.numberOfFiles>0){const s=t.find(this.selectorStatTemplate).clone();s.find(this.selectorStatNumberOfFiles).text(e.numberOfFiles),s.find(this.selectorStatDirectory).text(e.directory),s.find(this.selectorDeleteTrigger).attr("data-folder",e.directory),s.find(this.selectorDeleteTrigger).attr("data-storage-uid",e.storageUid),t.find(this.selectorStatContainer).append(s.html())}})):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}delete(t,e){const s=this.getModalBody(),r=this.getModuleContent().data("clear-typo3temp-delete-token");new AjaxRequest(Router.getUrl()).post({install:{action:"clearTypo3tempFiles",token:r,folder:t,storageUid:e}}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?(e.status.forEach(t=>{Notification.success(t.title,t.message)}),this.getStats()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,s)})}}export default new ClearTypo3tempFiles; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/CreateAdmin.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/CreateAdmin.js deleted file mode 100644 index 7f5054869fb700885b9432c4ab8895383488f9fb..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/CreateAdmin.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";import PasswordStrength from"TYPO3/CMS/Install/Module/PasswordStrength.js";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";class CreateAdmin extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorAdminCreateButton=".t3js-createAdmin-create"}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorAdminCreateButton,t=>{t.preventDefault(),this.create()}),t.on("click",".t3-install-form-password-strength",()=>{PasswordStrength.initialize(".t3-install-form-password-strength")})}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("createAdminGetData")).get({cache:"no-cache"}).then(async e=>{const s=await e.resolve();!0===s.success?(t.empty().append(s.html),Modal.setButtons(s.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}create(){this.setModalButtonsState(!1);const t=this.getModalBody(),e={install:{action:"createAdmin",token:this.getModuleContent().data("create-admin-token"),userName:this.findInModal(".t3js-createAdmin-user").val(),userPassword:this.findInModal(".t3js-createAdmin-password").val(),userPasswordCheck:this.findInModal(".t3js-createAdmin-password-check").val(),userEmail:this.findInModal(".t3js-createAdmin-email").val(),userSystemMaintainer:this.findInModal(".t3js-createAdmin-system-maintainer").is(":checked")?1:0}};this.getModuleContent().find(":input").prop("disabled",!0),new AjaxRequest(Router.getUrl()).post(e).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?e.status.forEach(t=>{Notification.showMessage(t.title,t.message,t.severity)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)}).finally(()=>{this.setModalButtonsState(!0),this.getModuleContent().find(":input").prop("disabled",!1),this.findInModal(".t3js-createAdmin-user").val(""),this.findInModal(".t3js-createAdmin-password").val(""),this.findInModal(".t3js-createAdmin-password-check").val(""),this.findInModal(".t3js-createAdmin-email").val(""),this.findInModal(".t3js-createAdmin-system-maintainer").prop("checked",!1)})}}export default new CreateAdmin; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/DatabaseAnalyzer.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/DatabaseAnalyzer.js deleted file mode 100644 index 3e3bb791d9276b3b395f8df8777d1136958eb606..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/DatabaseAnalyzer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class DatabaseAnalyzer extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorAnalyzeTrigger=".t3js-databaseAnalyzer-analyze",this.selectorExecuteTrigger=".t3js-databaseAnalyzer-execute",this.selectorOutputContainer=".t3js-databaseAnalyzer-output",this.selectorSuggestionBlock=".t3js-databaseAnalyzer-suggestion-block",this.selectorSuggestionList=".t3js-databaseAnalyzer-suggestion-list",this.selectorSuggestionLineTemplate=".t3js-databaseAnalyzer-suggestion-line-template"}initialize(e){this.currentModal=e,this.getData(),e.on("click",".t3js-databaseAnalyzer-suggestion-block-checkbox",e=>{const t=$(e.currentTarget);t.closest("fieldset").find(":checkbox").prop("checked",t.get(0).checked)}),e.on("click",this.selectorAnalyzeTrigger,e=>{e.preventDefault(),this.analyze()}),e.on("click",this.selectorExecuteTrigger,e=>{e.preventDefault(),this.execute()})}getData(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("databaseAnalyzer")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success?(e.empty().append(a.html),Modal.setButtons(a.buttons),this.analyze()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}analyze(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModalFooter(),a=e.find(this.selectorOutputContainer),s=t.find(this.selectorExecuteTrigger),n=t.find(this.selectorAnalyzeTrigger);a.empty().append(ProgressBar.render(Severity.loading,"Analyzing current database schema...","")),a.on("change",'input[type="checkbox"]',()=>{const e=a.find(":checked").length>0;this.setModalButtonState(s,e)}),new AjaxRequest(Router.getUrl("databaseAnalyzerAnalyze")).get({cache:"no-cache"}).then(async t=>{const o=await t.resolve();!0===o.success?(Array.isArray(o.status)&&(a.find(".alert-loading").remove(),o.status.forEach(e=>{const t=InfoBox.render(e.severity,e.title,e.message);a.append(t)})),Array.isArray(o.suggestions)&&(o.suggestions.forEach(t=>{const s=e.find(this.selectorSuggestionBlock).clone();s.removeClass(this.selectorSuggestionBlock.substr(1));const n=t.key;s.find(".t3js-databaseAnalyzer-suggestion-block-legend").text(t.label),s.find(".t3js-databaseAnalyzer-suggestion-block-checkbox").attr("id","t3-install-"+n+"-checkbox"),t.enabled&&s.find(".t3js-databaseAnalyzer-suggestion-block-checkbox").attr("checked","checked"),s.find(".t3js-databaseAnalyzer-suggestion-block-label").attr("for","t3-install-"+n+"-checkbox"),t.children.forEach(a=>{const n=e.find(this.selectorSuggestionLineTemplate).children().clone(),o=a.hash,r=n.find(".t3js-databaseAnalyzer-suggestion-line-checkbox");r.attr("id","t3-install-db-"+o).attr("data-hash",o),t.enabled&&r.attr("checked","checked"),n.find(".t3js-databaseAnalyzer-suggestion-line-label").attr("for","t3-install-db-"+o),n.find(".t3js-databaseAnalyzer-suggestion-line-statement").text(a.statement),void 0!==a.current&&(n.find(".t3js-databaseAnalyzer-suggestion-line-current-value").text(a.current),n.find(".t3js-databaseAnalyzer-suggestion-line-current").show()),void 0!==a.rowCount&&(n.find(".t3js-databaseAnalyzer-suggestion-line-count-value").text(a.rowCount),n.find(".t3js-databaseAnalyzer-suggestion-line-count").show()),s.find(this.selectorSuggestionList).append(n)}),a.append(s.html())}),this.setModalButtonState(n,!0),this.setModalButtonState(s,a.find(":checked").length>0)),0===o.suggestions.length&&0===o.status.length&&a.append(InfoBox.render(Severity.ok,"Database schema is up to date. Good job!",""))):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}execute(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModuleContent().data("database-analyzer-execute-token"),a=e.find(this.selectorOutputContainer),s=[];a.find(".t3js-databaseAnalyzer-suggestion-line input:checked").each((e,t)=>{s.push($(t).data("hash"))}),a.empty().append(ProgressBar.render(Severity.loading,"Executing database updates...","")),new AjaxRequest(Router.getUrl()).post({install:{action:"databaseAnalyzerExecute",token:t,hashes:s}}).then(async e=>{const t=await e.resolve();Array.isArray(t.status)&&t.status.forEach(e=>{Notification.showMessage(e.title,e.message,e.severity)}),this.analyze()},t=>{Router.handleAjaxError(t,e)})}}export default new DatabaseAnalyzer; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/DumpAutoload.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/DumpAutoload.js deleted file mode 100644 index 73723b7532d26763751375fd081031dd3e273607..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/DumpAutoload.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";import{AbstractInlineModule}from"TYPO3/CMS/Install/Module/AbstractInlineModule.js";class DumpAutoload extends AbstractInlineModule{initialize(t){this.setButtonState(t,!1),new AjaxRequest(Router.getUrl("dumpAutoload")).get({cache:"no-cache"}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?e.status.length>0&&e.status.forEach(t=>{Notification.success(t.message)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},()=>{Notification.error("Autoloader not dumped","Dumping autoload files failed for unknown reasons. Check the system for broken extensions and try again.")}).finally(()=>{this.setButtonState(t,!0)})}}export default new DumpAutoload; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/LanguagePacks.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/LanguagePacks.js deleted file mode 100644 index ec3f5a17f2b1a4953f67aa7c628ca7d2b2566dc7..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/LanguagePacks.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";import FlashMessage from"TYPO3/CMS/Install/Renderable/FlashMessage.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class LanguagePacks extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorOutputContainer=".t3js-languagePacks-output",this.selectorContentContainer=".t3js-languagePacks-mainContent",this.selectorActivateLanguage=".t3js-languagePacks-activateLanguage",this.selectorActivateLanguageIcon="#t3js-languagePacks-activate-icon",this.selectorAddLanguageToggle=".t3js-languagePacks-addLanguage-toggle",this.selectorLanguageInactive=".t3js-languagePacks-inactive",this.selectorDeactivateLanguage=".t3js-languagePacks-deactivateLanguage",this.selectorDeactivateLanguageIcon="#t3js-languagePacks-deactivate-icon",this.selectorUpdate=".t3js-languagePacks-update",this.selectorLanguageUpdateIcon="#t3js-languagePacks-languageUpdate-icon",this.selectorNotifications=".t3js-languagePacks-notifications",this.activeLanguages=[],this.activeExtensions=[],this.packsUpdateDetails={toHandle:0,handled:0,updated:0,new:0,failed:0},this.notifications=[]}static pluralize(t,a="pack",e="s",s=0){return 1!==t&&1!==s?a+e:a}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorAddLanguageToggle,()=>{t.find(this.selectorContentContainer+" "+this.selectorLanguageInactive).toggle()}),t.on("click",this.selectorActivateLanguage,t=>{const a=$(t.target).closest(this.selectorActivateLanguage).data("iso");t.preventDefault(),this.activateLanguage(a)}),t.on("click",this.selectorDeactivateLanguage,t=>{const a=$(t.target).closest(this.selectorDeactivateLanguage).data("iso");t.preventDefault(),this.deactivateLanguage(a)}),t.on("click",this.selectorUpdate,t=>{const a=$(t.target).closest(this.selectorUpdate).data("iso"),e=$(t.target).closest(this.selectorUpdate).data("extension");t.preventDefault(),this.updatePacks(a,e)})}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("languagePacksGetData")).get({cache:"no-cache"}).then(async a=>{const e=await a.resolve();if(!0===e.success){this.activeLanguages=e.activeLanguages,this.activeExtensions=e.activeExtensions,t.empty().append(e.html);const a=t.parent().find(this.selectorContentContainer);a.empty(),a.append(this.languageMatrixHtml(e)),a.append(this.extensionMatrixHtml(e)),$('[data-bs-toggle="tooltip"]').tooltip({container:a})}else{const t=InfoBox.render(Severity.error,"Something went wrong","");this.addNotification(t)}this.renderNotifications()},a=>{Router.handleAjaxError(a,t)})}activateLanguage(t){const a=this.getModalBody(),e=this.findInModal(this.selectorOutputContainer),s=ProgressBar.render(Severity.loading,"Loading...","");e.empty().append(s),this.getNotificationBox().empty(),new AjaxRequest(Router.getUrl()).post({install:{action:"languagePacksActivateLanguage",token:this.getModuleContent().data("language-packs-activate-language-token"),iso:t}}).then(async t=>{const a=await t.resolve();if(e.empty(),!0===a.success&&Array.isArray(a.status))a.status.forEach(t=>{const a=InfoBox.render(t.severity,t.title,t.message);this.addNotification(a)});else{const t=FlashMessage.render(Severity.error,"Something went wrong","");this.addNotification(t)}this.getData()},t=>{Router.handleAjaxError(t,a)})}deactivateLanguage(t){const a=this.getModalBody(),e=this.findInModal(this.selectorOutputContainer),s=ProgressBar.render(Severity.loading,"Loading...","");e.empty().append(s),this.getNotificationBox().empty(),new AjaxRequest(Router.getUrl()).post({install:{action:"languagePacksDeactivateLanguage",token:this.getModuleContent().data("language-packs-deactivate-language-token"),iso:t}}).then(async t=>{const a=await t.resolve();if(e.empty(),!0===a.success&&Array.isArray(a.status))a.status.forEach(t=>{const a=InfoBox.render(t.severity,t.title,t.message);this.addNotification(a)});else{const t=FlashMessage.render(Severity.error,"Something went wrong","");this.addNotification(t)}this.getData()},t=>{Router.handleAjaxError(t,a)})}updatePacks(t,a){const e=this.findInModal(this.selectorOutputContainer),s=this.findInModal(this.selectorContentContainer),n=void 0===t?this.activeLanguages:[t];let i=!0,o=this.activeExtensions;void 0!==a&&(o=[a],i=!1),this.packsUpdateDetails={toHandle:n.length*o.length,handled:0,updated:0,new:0,failed:0},e.empty().append($("<div>",{class:"progress"}).append($("<div>",{class:"progress-bar progress-bar-info",role:"progressbar","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,style:"width: 0;"}).append($("<span>",{class:"text-nowrap"}).text("0 of "+this.packsUpdateDetails.toHandle+" language "+LanguagePacks.pluralize(this.packsUpdateDetails.toHandle)+" updated")))),s.empty(),n.forEach(t=>{o.forEach(a=>{this.getNotificationBox().empty(),new AjaxRequest(Router.getUrl()).post({install:{action:"languagePacksUpdatePack",token:this.getModuleContent().data("language-packs-update-pack-token"),iso:t,extension:a}}).then(async t=>{const a=await t.resolve();!0===a.success?(this.packsUpdateDetails.handled++,"new"===a.packResult?this.packsUpdateDetails.new++:"update"===a.packResult?this.packsUpdateDetails.updated++:this.packsUpdateDetails.failed++,this.packUpdateDone(i,n)):(this.packsUpdateDetails.handled++,this.packsUpdateDetails.failed++,this.packUpdateDone(i,n))},()=>{this.packsUpdateDetails.handled++,this.packsUpdateDetails.failed++,this.packUpdateDone(i,n)})})})}packUpdateDone(t,a){const e=this.getModalBody(),s=this.findInModal(this.selectorOutputContainer);if(this.packsUpdateDetails.handled===this.packsUpdateDetails.toHandle){const s=InfoBox.render(Severity.ok,"Language packs updated",this.packsUpdateDetails.new+" new language "+LanguagePacks.pluralize(this.packsUpdateDetails.new)+" downloaded, "+this.packsUpdateDetails.updated+" language "+LanguagePacks.pluralize(this.packsUpdateDetails.updated)+" updated, "+this.packsUpdateDetails.failed+" language "+LanguagePacks.pluralize(this.packsUpdateDetails.failed)+" not available");this.addNotification(s),!0===t?new AjaxRequest(Router.getUrl()).post({install:{action:"languagePacksUpdateIsoTimes",token:this.getModuleContent().data("language-packs-update-iso-times-token"),isos:a}}).then(async t=>{if(!0===(await t.resolve()).success)this.getData();else{const t=FlashMessage.render(Severity.error,"Something went wrong","");this.addNotification(t)}},t=>{Router.handleAjaxError(t,e)}):this.getData()}else{const t=this.packsUpdateDetails.handled/this.packsUpdateDetails.toHandle*100;s.find(".progress-bar").css("width",t+"%").attr("aria-valuenow",t).find("span").text(this.packsUpdateDetails.handled+" of "+this.packsUpdateDetails.toHandle+" language "+LanguagePacks.pluralize(this.packsUpdateDetails.handled,"pack","s",this.packsUpdateDetails.toHandle)+" updated")}}languageMatrixHtml(t){const a=this.findInModal(this.selectorActivateLanguageIcon).html(),e=this.findInModal(this.selectorDeactivateLanguageIcon).html(),s=this.findInModal(this.selectorLanguageUpdateIcon).html(),n=$("<div>"),i=$("<tbody>");return t.languages.forEach(t=>{const n=t.active,o=$("<tr>");n?i.append(o.append($("<td>").text(" "+t.name).prepend($("<div />",{class:"btn-group"}).append($("<a>",{class:"btn btn-default t3js-languagePacks-deactivateLanguage","data-iso":t.iso,"data-bs-toggle":"tooltip",title:"Deactivate"}).append(e),$("<a>",{class:"btn btn-default t3js-languagePacks-update","data-iso":t.iso,"data-bs-toggle":"tooltip",title:"Download language packs"}).append(s))))):i.append(o.addClass("t3-languagePacks-inactive t3js-languagePacks-inactive").css({display:"none"}).append($("<td>").text(" "+t.name).prepend($("<div />",{class:"btn-group"}).append($("<a>",{class:"btn btn-default t3js-languagePacks-activateLanguage","data-iso":t.iso,"data-bs-toggle":"tooltip",title:"Activate"}).append(a))))),o.append($("<td>").text(t.iso),$("<td>").text(t.dependencies.join(", ")),$("<td>").text(null===t.lastUpdate?"":t.lastUpdate)),i.append(o)}),n.append($("<h3>").text("Active languages"),$("<table>",{class:"table table-striped table-bordered"}).append($("<thead>").append($("<tr>").append($("<th>").append($("<div />",{class:"btn-group"}).append($("<button>",{class:"btn btn-default t3js-languagePacks-addLanguage-toggle",type:"button"}).append($("<span>").append(a)," Add language"),$("<button>",{class:"btn btn-default disabled update-all t3js-languagePacks-update",type:"button",disabled:"disabled"}).append($("<span>").append(s)," Update all"))),$("<th>").text("Locale"),$("<th>").text("Dependencies"),$("<th>").text("Last update"))),i)),Array.isArray(this.activeLanguages)&&this.activeLanguages.length&&n.find(".update-all").removeClass("disabled").removeAttr("disabled"),n.html()}extensionMatrixHtml(t){const a=new SecurityUtility,e=this.findInModal(this.selectorLanguageUpdateIcon).html();let s,n="",i=0;const o=$("<div>"),l=$("<tr>");l.append($("<th>").text("Extension"),$("<th>").text("Key")),t.activeLanguages.forEach(t=>{l.append($("<th>").append($("<a>",{class:"btn btn-default t3js-languagePacks-update","data-iso":t,"data-bs-toggle":"tooltip",title:"Download and update all language packs"}).append($("<span>").append(e)," "+t)))});const d=$("<tbody>");return t.extensions.forEach(t=>{i++,s=void 0!==t.icon?$("<span>").append($("<img>",{style:"max-height: 16px; max-width: 16px;",src:t.icon,alt:t.title}),$("<span>").text(" "+t.title)):$("<span>").text(t.title);const o=$("<tr>");o.append($("<td>").html(s.html()),$("<td>").text(t.key)),t.packs.forEach(s=>{const i=$("<td>");o.append(i),n=!0!==s.exists?null!==s.lastUpdate?"No language pack available for "+s.iso+" when tried at "+s.lastUpdate+". Click to re-try.":"Language pack not downloaded. Click to download":null===s.lastUpdate?"Downloaded. Click to renew":"Language pack downloaded at "+s.lastUpdate+". Click to renew",i.append($("<a>",{class:"btn btn-default t3js-languagePacks-update","data-extension":t.key,"data-iso":s.iso,"data-bs-toggle":"tooltip",title:a.encodeHtml(n)}).append(e))}),d.append(o)}),o.append($("<h3>").text("Translation status"),$("<table>",{class:"table table-striped table-bordered"}).append($("<thead>").append(l),d)),0===i?InfoBox.render(Severity.ok,"Language packs have been found for every installed extension.","To download the latest changes, use the refresh button in the list above."):o.html()}getNotificationBox(){return this.findInModal(this.selectorNotifications)}addNotification(t){this.notifications.push(t)}renderNotifications(){const t=this.getNotificationBox();for(let a of this.notifications)t.append(a);this.notifications=[]}}export default new LanguagePacks; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/ResetBackendUserUc.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/ResetBackendUserUc.js deleted file mode 100644 index af21705b09ee1e37b78d343c5bf0b6ff3bb4f83a..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Maintenance/ResetBackendUserUc.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import{AbstractInlineModule}from"TYPO3/CMS/Install/Module/AbstractInlineModule.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import Router from"TYPO3/CMS/Install/Router.js";class ResetBackendUserUc extends AbstractInlineModule{initialize(e){this.setButtonState(e,!1),new AjaxRequest(Router.getUrl("resetBackendUserUc")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?t.status.length>0&&t.status.forEach(e=>{Notification.success(e.title,e.message)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},()=>{Notification.error("Reset preferences of all backend users failed","Resetting preferences of all backend users failed for an unknown reason. Please check your server's logs for further investigation.")}).finally(()=>{this.setButtonState(e,!0)})}}export default new ResetBackendUserUc; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/ChangeInstallToolPassword.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/ChangeInstallToolPassword.js deleted file mode 100644 index d72034f9964a7e21581230eaa718f0c1a2f1a0af..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/ChangeInstallToolPassword.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";import PasswordStrength from"TYPO3/CMS/Install/Module/PasswordStrength.js";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";class ChangeInstallToolPassword extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorChangeButton=".t3js-changeInstallToolPassword-change"}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorChangeButton,t=>{t.preventDefault(),this.change()}),t.on("click",".t3-install-form-password-strength",()=>{PasswordStrength.initialize(".t3-install-form-password-strength")})}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("changeInstallToolPasswordGetData")).get({cache:"no-cache"}).then(async s=>{const e=await s.resolve();!0===e.success?(t.empty().append(e.html),Modal.setButtons(e.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},s=>{Router.handleAjaxError(s,t)})}change(){this.setModalButtonsState(!1);const t=this.getModalBody(),s=this.getModuleContent().data("install-tool-token");new AjaxRequest(Router.getUrl()).post({install:{action:"changeInstallToolPassword",token:s,password:this.findInModal(".t3js-changeInstallToolPassword-password").val(),passwordCheck:this.findInModal(".t3js-changeInstallToolPassword-password-check").val()}}).then(async t=>{const s=await t.resolve();!0===s.success&&Array.isArray(s.status)?s.status.forEach(t=>{Notification.showMessage(t.title,t.message,t.severity)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},s=>{Router.handleAjaxError(s,t)}).finally(()=>{this.findInModal(".t3js-changeInstallToolPassword-password,.t3js-changeInstallToolPassword-password-check").val(""),this.setModalButtonsState(!0)})}}export default new ChangeInstallToolPassword; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/ExtensionConfiguration.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/ExtensionConfiguration.js deleted file mode 100644 index 0b0ccd1db315dbb67d317e2757584bff5b2ddb52..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/ExtensionConfiguration.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import"TYPO3/CMS/Install/Renderable/Clearable.js";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import ModuleMenu from"TYPO3/CMS/Backend/ModuleMenu.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";import{topLevelModuleImport}from"TYPO3/CMS/Backend/Utility/TopLevelModuleImport.js";class ExtensionConfiguration extends 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.trigger("focus")):27===e.keyCode&&(e.preventDefault(),a.val("").trigger("focus"))}),t.on("keyup",this.selectorSearchInput,e=>{const a=$(e.target).val(),o=t.find(this.selectorSearchInput);t.find(".search-item").each((t,e)=>{const o=$(e);$(":contains("+a+")",o).length>0||$('input[value*="'+a+'"]',o).length>0?o.removeClass("hidden").addClass("searchhit"):o.removeClass("searchhit").addClass("hidden")}),t.find(".searchhit").collapse("show");const i=o.get(0);i.clearable(),i.focus()}),t.on("submit",this.selectorFormListener,t=>{t.preventDefault(),this.write($(t.currentTarget))})}getContent(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("extensionConfigurationGetContent")).get({cache:"no-cache"}).then(async e=>{const a=await e.resolve();!0===a.success&&(t.html(a.html),this.initializeWrap(),this.initializeColorPicker())},e=>{Router.handleAjaxError(e,t)})}initializeColorPicker(){window.location!==window.parent.location?topLevelModuleImport("TYPO3/CMS/Backend/ColorPicker.js").then(({default:t})=>{t.initialize()}):import("TYPO3/CMS/Backend/ColorPicker.js").then(({default:t})=>{t.initialize()})}write(t){const e=this.getModalBody(),a=this.getModuleContent().data("extension-configuration-write-token"),o={};$.each(t.serializeArray(),(t,e)=>{o[e.name]=e.value}),new AjaxRequest(Router.getUrl()).post({install:{token:a,action:"extensionConfigurationWrite",extensionKey:t.attr("data-extensionKey"),extensionConfiguration:o}}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?(e.status.forEach(t=>{Notification.showMessage(t.title,t.message,t.severity)}),"backend"===$("body").data("context")&&ModuleMenu.App.refreshMenu()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}initializeWrap(){this.findInModal(".t3js-emconf-offset").each((t,e)=>{const a=$(e),o=a.parent(),i=a.attr("id"),r=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 n=$("<div>",{class:"form-multigroup-item"}).append($("<div>",{class:"input-group"}).append($("<div>",{class:"input-group-addon"}).text("x"),$("<input>",{id:i+"_offset_x",class:"form-control t3js-emconf-offsetfield","data-target":"#"+i,value:r[0]?.trim()}))),s=$("<div>",{class:"form-multigroup-item"}).append($("<div>",{class:"input-group"}).append($("<div>",{class:"input-group-addon"}).text("y"),$("<input>",{id:i+"_offset_y",class:"form-control t3js-emconf-offsetfield","data-target":"#"+i,value:r[1]?.trim()}))),l=$("<div>",{class:"form-multigroup-wrap"}).append(n,s);o.append(l),o.find(".t3js-emconf-offsetfield").on("keyup",t=>{const e=o.find($(t.currentTarget).data("target"));e.val(o.find(e.data("offsetfield-x")).val()+","+o.find(e.data("offsetfield-y")).val())})}),this.findInModal(".t3js-emconf-wrap").each((t,e)=>{const a=$(e),o=a.parent(),i=a.attr("id"),r=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 n=$("<div>",{class:"form-multigroup-wrap"}).append($("<div>",{class:"form-multigroup-item"}).append($("<input>",{id:i+"_wrap_start",class:"form-control t3js-emconf-wrapfield","data-target":"#"+i,value:r[0]?.trim()})),$("<div>",{class:"form-multigroup-item"}).append($("<input>",{id:i+"_wrap_end",class:"form-control t3js-emconf-wrapfield","data-target":"#"+i,value:r[1]?.trim()})));o.append(n),o.find(".t3js-emconf-wrapfield").on("keyup",t=>{const e=o.find($(t.currentTarget).data("target"));e.val(o.find(e.data("wrapfield-start")).val()+"|"+o.find(e.data("wrapfield-end")).val())})})}}export default new ExtensionConfiguration; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/Features.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/Features.js deleted file mode 100644 index 1c30f6c3bf5bce6895f9cd6cc05c9db6906b53b2..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/Features.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";class Features extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorSaveTrigger=".t3js-features-save"}initialize(e){this.currentModal=e,this.getContent(),e.on("click",this.selectorSaveTrigger,e=>{e.preventDefault(),this.save()})}getContent(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("featuresGetContent")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success&&"undefined"!==s.html&&s.html.length>0?(e.empty().append(s.html),Modal.setButtons(s.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}save(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModuleContent().data("features-save-token"),s={};$(this.findInModal("form").serializeArray()).each((e,t)=>{s[t.name]=t.value}),s["install[action]"]="featuresSave",s["install[token]"]=t,new AjaxRequest(Router.getUrl()).post(s).then(async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?(t.status.forEach(e=>{Notification.showMessage(e.title,e.message,e.severity)}),this.getContent()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}}export default new Features; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/LocalConfiguration.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/LocalConfiguration.js deleted file mode 100644 index 7894b5387f6f0fc2dcb68b2d61fe3b28c75592cf..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/LocalConfiguration.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import"TYPO3/CMS/Install/Renderable/Clearable.js";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";class LocalConfiguration extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorToggleAllTrigger=".t3js-localConfiguration-toggleAll",this.selectorWriteTrigger=".t3js-localConfiguration-write",this.selectorSearchTrigger=".t3js-localConfiguration-search"}initialize(t){this.currentModal=t,this.getContent(),t.on("click",this.selectorWriteTrigger,()=>{this.write()}),t.on("click",this.selectorToggleAllTrigger,()=>{const t=this.getModalBody().find(".panel-collapse"),e=t.eq(0).hasClass("in")?"hide":"show";t.collapse(e)}),$.expr[":"].contains=$.expr.createPseudo(t=>e=>$(e).text().toUpperCase().includes(t.toUpperCase())),t.on("keydown",e=>{const o=t.find(this.selectorSearchTrigger);e.ctrlKey||e.metaKey?"f"===String.fromCharCode(e.which).toLowerCase()&&(e.preventDefault(),o.trigger("focus")):27===e.keyCode&&(e.preventDefault(),o.val("").trigger("focus"))}),t.on("keyup",this.selectorSearchTrigger,e=>{const o=$(e.target).val(),a=t.find(this.selectorSearchTrigger);t.find("div.item").each((t,e)=>{const a=$(e);$(":contains("+o+")",a).length>0||$('input[value*="'+o+'"]',a).length>0?a.removeClass("hidden").addClass("searchhit"):a.removeClass("searchhit").addClass("hidden")}),t.find(".searchhit").parent().collapse("show");const r=a.get(0);r.clearable(),r.focus()})}getContent(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("localConfigurationGetContent")).get({cache:"no-cache"}).then(async e=>{const o=await e.resolve();!0===o.success&&(t.html(o.html),Modal.setButtons(o.buttons))},e=>{Router.handleAjaxError(e,t)})}write(){this.setModalButtonsState(!1);const t=this.getModalBody(),e=this.getModuleContent().data("local-configuration-write-token"),o={};this.findInModal(".t3js-localConfiguration-pathValue").each((t,e)=>{const a=$(e);"checkbox"===a.attr("type")?e.checked?o[a.data("path")]="1":o[a.data("path")]="0":o[a.data("path")]=a.val()}),new AjaxRequest(Router.getUrl()).post({install:{action:"localConfigurationWrite",token:e,configurationValues:o}}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?e.status.forEach(t=>{Notification.showMessage(t.title,t.message,t.severity)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)}).finally(()=>{this.setModalButtonsState(!0)})}}export default new LocalConfiguration; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/Presets.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/Presets.js deleted file mode 100644 index 7c74a36339c797e4efa14e0308853664b04e048b..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/Presets.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";class Presets extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorActivateTrigger=".t3js-presets-activate",this.selectorImageExecutable=".t3js-presets-image-executable",this.selectorImageExecutableTrigger=".t3js-presets-image-executable-trigger"}initialize(e){this.currentModal=e,this.getContent(),e.on("click",this.selectorImageExecutableTrigger,e=>{e.preventDefault(),this.getCustomImagePathContent()}),e.on("click",this.selectorActivateTrigger,e=>{e.preventDefault(),this.activate()}),e.find(".t3js-custom-preset").on("input",".t3js-custom-preset",e=>{$("#"+$(e.currentTarget).data("radio")).prop("checked",!0)})}getContent(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("presetsGetContent")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success&&"undefined"!==s.html&&s.html.length>0?(e.empty().append(s.html),Modal.setButtons(s.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}getCustomImagePathContent(){const e=this.getModalBody(),t=this.getModuleContent().data("presets-content-token");new AjaxRequest(Router.getUrl()).post({install:{token:t,action:"presetsGetContent",values:{Image:{additionalSearchPath:this.findInModal(this.selectorImageExecutable).val()}}}}).then(async t=>{const s=await t.resolve();!0===s.success&&"undefined"!==s.html&&s.html.length>0?e.empty().append(s.html):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}activate(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModuleContent().data("presets-activate-token"),s={};$(this.findInModal("form").serializeArray()).each((e,t)=>{s[t.name]=t.value}),s["install[action]"]="presetsActivate",s["install[token]"]=t,new AjaxRequest(Router.getUrl()).post(s).then(async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?t.status.forEach(e=>{Notification.showMessage(e.title,e.message,e.severity)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)}).finally(()=>{this.setModalButtonsState(!0)})}}export default new Presets; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/SystemMaintainer.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/SystemMaintainer.js deleted file mode 100644 index 62e5b9aa5ed8557306fb5395f3d936017317ea65..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Settings/SystemMaintainer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import{topLevelModuleImport}from"TYPO3/CMS/Backend/Utility/TopLevelModuleImport.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Router from"TYPO3/CMS/Install/Router.js";class SystemMaintainer extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorWriteTrigger=".t3js-systemMaintainer-write",this.selectorChosenContainer=".t3js-systemMaintainer-chosen",this.selectorChosenField=".t3js-systemMaintainer-chosen-select"}initialize(t){this.currentModal=t;window.location!==window.parent.location?topLevelModuleImport("TYPO3/CMS/Install/chosen.jquery.min.js").then(()=>{this.getList()}):import("TYPO3/CMS/Install/chosen.jquery.min.js").then(()=>{this.getList()}),t.on("click",this.selectorWriteTrigger,t=>{t.preventDefault(),this.write()})}getList(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("systemMaintainerGetList")).get({cache:"no-cache"}).then(async e=>{const s=await e.resolve();if(!0===s.success){t.html(s.html),Modal.setButtons(s.buttons),Array.isArray(s.users)&&s.users.forEach(e=>{let s=e.username;e.disable&&(s="[DISABLED] "+s);const o=$("<option>",{value:e.uid}).text(s);e.isSystemMaintainer&&o.attr("selected","selected"),t.find(this.selectorChosenField).append(o)});const e={".t3js-systemMaintainer-chosen-select":{width:"100%",placeholder_text_multiple:"users"}};for(const s in e)e.hasOwnProperty(s)&&t.find(s).chosen(e[s]);t.find(this.selectorChosenContainer).show(),t.find(this.selectorChosenField).trigger("chosen:updated")}},e=>{Router.handleAjaxError(e,t)})}write(){this.setModalButtonsState(!1);const t=this.getModalBody(),e=this.getModuleContent().data("system-maintainer-write-token"),s=this.findInModal(this.selectorChosenField).val();new AjaxRequest(Router.getUrl()).post({install:{users:s,token:e,action:"systemMaintainerWrite"}}).then(async t=>{const e=await t.resolve();!0===e.success?Array.isArray(e.status)&&e.status.forEach(t=>{Notification.success(t.title,t.message)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)}).finally(()=>{this.setModalButtonsState(!0)})}}export default new SystemMaintainer; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/CoreUpdate.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/CoreUpdate.js deleted file mode 100644 index d09f2bfdee8b23aca6e53bd2ae540cd4a4982756..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/CoreUpdate.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import FlashMessage from"TYPO3/CMS/Install/Renderable/FlashMessage.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class CoreUpdate extends AbstractInteractableModule{constructor(){super(...arguments),this.actionQueue={coreUpdateIsUpdateAvailable:{loadingMessage:"Checking for possible regular or security update",finishMessage:void 0,nextActionName:void 0},coreUpdateCheckPreConditions:{loadingMessage:"Checking if update is possible",finishMessage:"System can be updated",nextActionName:"coreUpdateDownload"},coreUpdateDownload:{loadingMessage:"Downloading new core",finishMessage:void 0,nextActionName:"coreUpdateVerifyChecksum"},coreUpdateVerifyChecksum:{loadingMessage:"Verifying checksum of downloaded core",finishMessage:void 0,nextActionName:"coreUpdateUnpack"},coreUpdateUnpack:{loadingMessage:"Unpacking core",finishMessage:void 0,nextActionName:"coreUpdateMove"},coreUpdateMove:{loadingMessage:"Moving core",finishMessage:void 0,nextActionName:"coreUpdateActivate"},coreUpdateActivate:{loadingMessage:"Activating core",finishMessage:"Core updated - please reload your browser",nextActionName:void 0}},this.selectorOutput=".t3js-coreUpdate-output",this.updateButton=".t3js-coreUpdate-button",this.buttonTemplate=null}initialize(e){this.currentModal=e,this.getData().then(()=>{this.buttonTemplate=this.findInModal(this.updateButton).clone()}),e.on("click",".t3js-coreUpdate-init",e=>{e.preventDefault();const t=$(e.currentTarget).attr("data-action");switch(this.findInModal(this.selectorOutput).empty(),t){case"checkForUpdate":this.callAction("coreUpdateIsUpdateAvailable");break;case"updateDevelopment":this.update("development");break;case"updateRegular":this.update("regular");break;default:throw'Unknown update action "'+t+'"'}})}getData(){const e=this.getModalBody();return new AjaxRequest(Router.getUrl("coreUpdateGetData")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success?(e.empty().append(a.html),Modal.setButtons(a.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}update(e){"development"!==e&&(e="regular"),this.callAction("coreUpdateCheckPreConditions",e)}callAction(e,t){const a={install:{action:e}};void 0!==t&&(a.install.type=t),this.addLoadingMessage(this.actionQueue[e].loadingMessage),new AjaxRequest(Router.getUrl()).withQueryArguments(a).get({cache:"no-cache"}).then(async a=>{const o=await a.resolve();!0===this.handleResult(o,this.actionQueue[e].finishMessage)&&void 0!==this.actionQueue[e].nextActionName&&this.callAction(this.actionQueue[e].nextActionName,t)},e=>{Router.handleAjaxError(e,this.getModalBody())})}handleResult(e,t){const a=e.success;return this.removeLoadingMessage(),e.status&&"object"==typeof e.status&&this.showStatusMessages(e.status),e.action&&"object"==typeof e.action&&this.showActionButton(e.action),a&&t&&this.addMessage(Severity.ok,t),a}addLoadingMessage(e){const t=FlashMessage.render(Severity.loading,e);this.findInModal(this.selectorOutput).append(t)}removeLoadingMessage(){this.findInModal(this.selectorOutput).find(".alert-loading").remove()}showStatusMessages(e){$.each(e,(e,t)=>{let a="",o="";const s=t.severity;t.title&&(a=t.title),t.message&&(o=t.message),this.addMessage(s,a,o)})}showActionButton(e){let t=!1,a=!1;e.title&&(t=e.title),e.action&&(a=e.action);const o=this.buttonTemplate;a&&o.attr("data-action",a),t&&o.text(t),this.findInModal(this.updateButton).replaceWith(o)}addMessage(e,t,a){const o=FlashMessage.render(e,t,a);this.findInModal(this.selectorOutput).append(o)}}export default new CoreUpdate; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/ExtensionCompatTester.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/ExtensionCompatTester.js deleted file mode 100644 index 6ab3a54d02553e6aae03fc445124864f54e4610b..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/ExtensionCompatTester.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class ExtensionCompatTester extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorCheckTrigger=".t3js-extensionCompatTester-check",this.selectorUninstallTrigger=".t3js-extensionCompatTester-uninstall",this.selectorOutputContainer=".t3js-extensionCompatTester-output"}initialize(e){this.currentModal=e,this.getLoadedExtensionList(),e.on("click",this.selectorCheckTrigger,()=>{this.findInModal(this.selectorUninstallTrigger).addClass("hidden"),this.findInModal(this.selectorOutputContainer).empty(),this.getLoadedExtensionList()}),e.on("click",this.selectorUninstallTrigger,e=>{this.uninstallExtension($(e.target).data("extension"))})}getLoadedExtensionList(){this.setModalButtonsState(!1),this.findInModal(".modal-loading").hide();const e=this.getModalBody(),t=this.findInModal(this.selectorOutputContainer),o=ProgressBar.render(Severity.loading,"Loading...","");t.append(o),new AjaxRequest(Router.getUrl("extensionCompatTesterLoadedExtensionList")).get({cache:"no-cache"}).then(async t=>{const o=await t.resolve();e.empty().append(o.html),Modal.setButtons(o.buttons);const n=this.findInModal(this.selectorOutputContainer),s=ProgressBar.render(Severity.loading,"Loading...","");n.append(s),!0===o.success?this.loadExtLocalconf().then(()=>{n.append(InfoBox.render(Severity.ok,"ext_localconf.php of all loaded extensions successfully loaded","")),this.loadExtTables().then(()=>{n.append(InfoBox.render(Severity.ok,"ext_tables.php of all loaded extensions successfully loaded",""))},async e=>{this.renderFailureMessages("ext_tables.php",(await e.response.json()).brokenExtensions,n)}).finally(()=>{this.unlockModal()})},async e=>{this.renderFailureMessages("ext_localconf.php",(await e.response.json()).brokenExtensions,n),n.append(InfoBox.render(Severity.notice,"Skipped scanning ext_tables.php files due to previous errors","")),this.unlockModal()}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}unlockModal(){this.findInModal(this.selectorOutputContainer).find(".alert-loading").remove(),this.findInModal(this.selectorCheckTrigger).removeClass("disabled").prop("disabled",!1)}renderFailureMessages(e,t,o){for(let n of t){let t;n.isProtected||(t=$("<button />",{class:"btn btn-danger t3js-extensionCompatTester-uninstall"}).attr("data-extension",n.name).text('Uninstall extension "'+n.name+'"')),o.append(InfoBox.render(Severity.error,"Loading "+e+' of extension "'+n.name+'" failed',n.isProtected?"Extension is mandatory and cannot be uninstalled.":""),t)}this.unlockModal()}loadExtLocalconf(){const e=this.getModuleContent().data("extension-compat-tester-load-ext_localconf-token");return new AjaxRequest(Router.getUrl()).post({install:{action:"extensionCompatTesterLoadExtLocalconf",token:e}})}loadExtTables(){const e=this.getModuleContent().data("extension-compat-tester-load-ext_tables-token");return new AjaxRequest(Router.getUrl()).post({install:{action:"extensionCompatTesterLoadExtTables",token:e}})}uninstallExtension(e){const t=this.getModuleContent().data("extension-compat-tester-uninstall-extension-token"),o=this.getModalBody(),n=$(this.selectorOutputContainer),s=ProgressBar.render(Severity.loading,"Loading...","");n.append(s),new AjaxRequest(Router.getUrl()).post({install:{action:"extensionCompatTesterUninstallExtension",token:t,extension:e}}).then(async e=>{const t=await e.resolve();t.success?(Array.isArray(t.status)&&t.status.forEach(e=>{const t=InfoBox.render(e.severity,e.title,e.message);o.find(this.selectorOutputContainer).empty().append(t)}),this.findInModal(this.selectorUninstallTrigger).addClass("hidden"),this.getLoadedExtensionList()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,o)})}}export default new ExtensionCompatTester; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/ExtensionScanner.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/ExtensionScanner.js deleted file mode 100644 index c92fe276c3830daa1878434942d7118b5436d62d..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/ExtensionScanner.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxQueue from"TYPO3/CMS/Install/Ajax/AjaxQueue.js";import Router from"TYPO3/CMS/Install/Router.js";class ExtensionScanner extends AbstractInteractableModule{constructor(){super(...arguments),this.listOfAffectedRestFileHashes=[],this.selectorExtensionContainer=".t3js-extensionScanner-extension",this.selectorNumberOfFiles=".t3js-extensionScanner-number-of-files",this.selectorScanSingleTrigger=".t3js-extensionScanner-scan-single",this.selectorExtensionScanButton=".t3js-extensionScanner-scan-all"}initialize(e){this.currentModal=e,this.getData(),e.on("show.bs.collapse",this.selectorExtensionContainer,e=>{const n=$(e.currentTarget);if(void 0===n.data("scanned")){const e=n.data("extension");this.scanSingleExtension(e),n.data("scanned",!0)}}).on("hide.bs.modal",()=>{AjaxQueue.flush()}).on("click",this.selectorScanSingleTrigger,e=>{e.preventDefault();const n=$(e.currentTarget).closest(this.selectorExtensionContainer).data("extension");this.scanSingleExtension(n)}).on("click",this.selectorExtensionScanButton,n=>{n.preventDefault(),this.setModalButtonsState(!1);const t=e.find(this.selectorExtensionContainer);this.scanAll(t)})}getData(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("extensionScannerGetData")).get().then(async n=>{const t=await n.resolve();!0===t.success?(e.empty().append(t.html),Modal.setButtons(t.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},n=>{Router.handleAjaxError(n,e)})}getExtensionSelector(e){return this.selectorExtensionContainer+"-"+e}scanAll(e){this.findInModal(this.selectorExtensionContainer).removeClass("panel-danger panel-warning panel-success").find(".panel-progress-bar").css("width",0).attr("aria-valuenow",0).find("span").text("0%"),this.setProgressForAll(),e.each((e,n)=>{const t=$(n),s=t.data("extension");this.scanSingleExtension(s),t.data("scanned",!0)})}setStatusMessageForScan(e,n,t){this.findInModal(this.getExtensionSelector(e)).find(this.selectorNumberOfFiles).text("Checked "+n+" of "+t+" files")}setProgressForScan(e,n,t){const s=n/t*100;this.findInModal(this.getExtensionSelector(e)).find(".panel-progress-bar").css("width",s+"%").attr("aria-valuenow",s).find("span").text(s+"%")}setProgressForAll(){const e=this.findInModal(this.selectorExtensionContainer).length,n=this.findInModal(this.selectorExtensionContainer+".t3js-extensionscan-finished.panel-success").length+this.findInModal(this.selectorExtensionContainer+".t3js-extensionscan-finished.panel-warning").length+this.findInModal(this.selectorExtensionContainer+".t3js-extensionscan-finished.panel-danger").length,t=n/e*100,s=this.getModalBody();this.findInModal(".t3js-extensionScanner-progress-all-extension .progress-bar").css("width",t+"%").attr("aria-valuenow",t).find("span").text(n+" of "+e+" scanned"),n===e&&(this.findInModal(this.selectorExtensionScanButton).removeClass("disabled").prop("disabled",!1),Notification.success("Scan finished","All extensions have been scanned."),new AjaxRequest(Router.getUrl()).post({install:{action:"extensionScannerMarkFullyScannedRestFiles",token:this.getModuleContent().data("extension-scanner-mark-fully-scanned-rest-files-token"),hashes:this.uniqueArray(this.listOfAffectedRestFileHashes)}}).then(async e=>{const n=await e.resolve();!0===n.success&&Notification.success("Marked not affected files","Marked "+n.markedAsNotAffected+" ReST files as not affected.")},e=>{Router.handleAjaxError(e,s)}))}uniqueArray(e){return e.filter((e,n,t)=>t.indexOf(e)===n)}scanSingleExtension(e){const n=this.getModuleContent().data("extension-scanner-files-token"),t=this.getModalBody(),s=this.findInModal(this.getExtensionSelector(e));let i=!1;s.removeClass("panel-danger panel-warning panel-success t3js-extensionscan-finished"),s.data("hasRun","true"),s.find(".t3js-extensionScanner-scan-single").text("Scanning...").attr("disabled","disabled"),s.find(".t3js-extensionScanner-extension-body-loc").empty().text("0"),s.find(".t3js-extensionScanner-extension-body-ignored-files").empty().text("0"),s.find(".t3js-extensionScanner-extension-body-ignored-lines").empty().text("0"),this.setProgressForAll(),new AjaxRequest(Router.getUrl()).post({install:{action:"extensionScannerFiles",token:n,extension:e}}).then(async n=>{const a=await n.resolve();if(!0===a.success&&Array.isArray(a.files)){const n=a.files.length;if(n<=0)return void Notification.warning("No files found","The extension "+e+" contains no scannable files");this.setStatusMessageForScan(e,0,n),s.find(".t3js-extensionScanner-extension-body").text("");let o=0;a.files.forEach(a=>{AjaxQueue.add({method:"POST",data:{install:{action:"extensionScannerScanFile",token:this.getModuleContent().data("extension-scanner-scan-file-token"),extension:e,file:a}},url:Router.getUrl(),onfulfilled:async r=>{const l=await r.resolve();if(o++,this.setStatusMessageForScan(e,o,n),this.setProgressForScan(e,o,n),l.success&&$.isArray(l.matches)&&l.matches.forEach(e=>{i=!0;const n=t.find("#t3js-extensionScanner-file-hit-template").clone();n.find(".t3js-extensionScanner-hit-file-panel-head").attr("href","#collapse"+e.uniqueId),n.find(".t3js-extensionScanner-hit-file-panel-body").attr("id","collapse"+e.uniqueId),n.find(".t3js-extensionScanner-hit-filename").text(a),n.find(".t3js-extensionScanner-hit-message").text(e.message),"strong"===e.indicator?n.find(".t3js-extensionScanner-hit-file-panel-head .badges").append('<span class="badge" title="Reliable match, false positive unlikely">strong</span>'):n.find(".t3js-extensionScanner-hit-file-panel-head .badges").append('<span class="badge" title="Probable match, but can be a false positive">weak</span>'),!0===e.silenced&&n.find(".t3js-extensionScanner-hit-file-panel-head .badges").append('<span class="badge" title="Match has been annotated by extension author as false positive match">silenced</span>'),n.find(".t3js-extensionScanner-hit-file-lineContent").empty().text(e.lineContent),n.find(".t3js-extensionScanner-hit-file-line").empty().text(e.line+": "),$.isArray(e.restFiles)&&e.restFiles.forEach(e=>{const s=t.find("#t3js-extensionScanner-file-hit-rest-template").clone();s.find(".t3js-extensionScanner-hit-rest-panel-head").attr("href","#collapse"+e.uniqueId),s.find(".t3js-extensionScanner-hit-rest-panel-head .badge").empty().text(e.version),s.find(".t3js-extensionScanner-hit-rest-panel-body").attr("id","collapse"+e.uniqueId),s.find(".t3js-extensionScanner-hit-rest-headline").text(e.headline),s.find(".t3js-extensionScanner-hit-rest-body").text(e.content),s.addClass("panel-"+e.class),n.find(".t3js-extensionScanner-hit-file-rest-container").append(s),this.listOfAffectedRestFileHashes.push(e.file_hash)});const o=n.find(".panel-breaking",".t3js-extensionScanner-hit-file-rest-container").length>0?"panel-danger":"panel-warning";n.addClass(o),s.find(".t3js-extensionScanner-extension-body").removeClass("hide").append(n),"panel-danger"===o&&s.removeClass("panel-warning").addClass(o),"panel-warning"!==o||s.hasClass("panel-danger")||s.addClass(o)}),l.success){const e=parseInt(s.find(".t3js-extensionScanner-extension-body-loc").text(),10);if(s.find(".t3js-extensionScanner-extension-body-loc").empty().text(e+l.effectiveCodeLines),l.isFileIgnored){const e=parseInt(s.find(".t3js-extensionScanner-extension-body-ignored-files").text(),10);s.find(".t3js-extensionScanner-extension-body-ignored-files").empty().text(e+1)}const n=parseInt(s.find(".t3js-extensionScanner-extension-body-ignored-lines").text(),10);s.find(".t3js-extensionScanner-extension-body-ignored-lines").empty().text(n+l.ignoredLines)}o===n&&(i||s.addClass("panel-success"),s.addClass("t3js-extensionscan-finished"),this.setProgressForAll(),s.find(".t3js-extensionScanner-scan-single").text("Rescan").attr("disabled",null))},onrejected:t=>{o+=1,this.setStatusMessageForScan(e,o,n),this.setProgressForScan(e,o,n),this.setProgressForAll(),console.error(t)}})})}else Notification.error("Oops, an error occurred","Please look at the browser console output for details"),console.error(a)},e=>{Router.handleAjaxError(e,t)})}}export default new ExtensionScanner; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/TcaExtTablesCheck.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/TcaExtTablesCheck.js deleted file mode 100644 index 5724b2e10f9857df60e2a5e4c07da1471e7bb01b..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/TcaExtTablesCheck.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class TcaExtTablesCheck extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorCheckTrigger=".t3js-tcaExtTablesCheck-check",this.selectorOutputContainer=".t3js-tcaExtTablesCheck-output"}initialize(e){this.currentModal=e,this.check(),e.on("click",this.selectorCheckTrigger,e=>{e.preventDefault(),this.check()})}check(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=$(this.selectorOutputContainer),o=ProgressBar.render(Severity.loading,"Loading...","");t.empty().html(o),new AjaxRequest(Router.getUrl("tcaExtTablesCheck")).get({cache:"no-cache"}).then(async o=>{const r=await o.resolve();if(e.empty().append(r.html),Modal.setButtons(r.buttons),!0===r.success&&Array.isArray(r.status))if(r.status.length>0){const o=InfoBox.render(Severity.warning,"Following extensions change TCA in ext_tables.php","Check ext_tables.php files, look for ExtensionManagementUtility calls and $GLOBALS['TCA'] modifications");e.find(this.selectorOutputContainer).append(o),r.status.forEach(o=>{const r=InfoBox.render(o.severity,o.title,o.message);t.append(r),e.append(r)})}else{const t=InfoBox.render(Severity.ok,"No TCA changes in ext_tables.php files. Good job!","");e.find(this.selectorOutputContainer).append(t)}else Notification.error("Something went wrong",'Please use the module "Check for broken extensions" to find a possible extension causing this issue.')},t=>{Router.handleAjaxError(t,e)})}}export default new TcaExtTablesCheck; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/TcaMigrationsCheck.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/TcaMigrationsCheck.js deleted file mode 100644 index 6bac45482739c22e8edc22d33f3f5d8f860d2a59..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/TcaMigrationsCheck.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import FlashMessage from"TYPO3/CMS/Install/Renderable/FlashMessage.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class TcaMigrationsCheck extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorCheckTrigger=".t3js-tcaMigrationsCheck-check",this.selectorOutputContainer=".t3js-tcaMigrationsCheck-output"}initialize(e){this.currentModal=e,this.check(),e.on("click",this.selectorCheckTrigger,e=>{e.preventDefault(),this.check()})}check(){this.setModalButtonsState(!1);const e=$(this.selectorOutputContainer),t=this.getModalBody(),r=ProgressBar.render(Severity.loading,"Loading...","");e.empty().html(r),new AjaxRequest(Router.getUrl("tcaMigrationsCheck")).get({cache:"no-cache"}).then(async e=>{const r=await e.resolve();if(t.empty().append(r.html),Modal.setButtons(r.buttons),!0===r.success&&Array.isArray(r.status))if(r.status.length>0){const e=InfoBox.render(Severity.warning,"TCA migrations need to be applied","Check the following list and apply needed changes.");t.find(this.selectorOutputContainer).empty(),t.find(this.selectorOutputContainer).append(e),r.status.forEach(e=>{const r=InfoBox.render(e.severity,e.title,e.message);t.find(this.selectorOutputContainer).append(r)})}else{const e=InfoBox.render(Severity.ok,"No TCA migrations need to be applied","Your TCA looks good.");t.find(this.selectorOutputContainer).append(e)}else{const e=FlashMessage.render(Severity.error,"Something went wrong",'Use "Check for broken extensions"');t.find(this.selectorOutputContainer).append(e)}},e=>{Router.handleAjaxError(e,t)})}}export default new TcaMigrationsCheck; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/UpgradeDocs.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/UpgradeDocs.js deleted file mode 100644 index c0b646e96b0a155042fa66222b43921e3083bb7b..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/UpgradeDocs.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import"TYPO3/CMS/Install/Renderable/Clearable.js";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import{topLevelModuleImport}from"TYPO3/CMS/Backend/Utility/TopLevelModuleImport.js";import Router from"TYPO3/CMS/Install/Router.js";import DebounceEvent from"TYPO3/CMS/Core/Event/DebounceEvent.js";class UpgradeDocs extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorFulltextSearch=".t3js-upgradeDocs-fulltext-search",this.selectorChosenField=".t3js-upgradeDocs-chosen-select",this.selectorChangeLogsForVersionContainer=".t3js-version-changes",this.selectorChangeLogsForVersion=".t3js-changelog-list",this.selectorUpgradeDoc=".t3js-upgrade-doc"}static trimExplodeAndUnique(e,t){const s=[],o=t.split(e);for(let e=0;e<o.length;e++){const t=o[e].trim();t.length>0&&-1===$.inArray(t,s)&&s.push(t)}return s}initialize(e){this.currentModal=e;window.location!==window.parent.location?topLevelModuleImport("TYPO3/CMS/Install/chosen.jquery.min.js").then(()=>{this.getContent()}):import("TYPO3/CMS/Install/chosen.jquery.min.js").then(()=>{this.getContent()}),e.on("click",".t3js-upgradeDocs-markRead",e=>{this.markRead(e.target)}),e.on("click",".t3js-upgradeDocs-unmarkRead",e=>{this.unmarkRead(e.target)}),$.expr[":"].contains=$.expr.createPseudo(e=>t=>$(t).text().toUpperCase().includes(e.toUpperCase()))}getContent(){const e=this.getModalBody();e.on("show.bs.collapse",this.selectorUpgradeDoc,e=>{this.renderTags($(e.currentTarget))}),new AjaxRequest(Router.getUrl("upgradeDocsGetContent")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success&&"undefined"!==s.html&&s.html.length>0&&(e.empty().append(s.html),this.initializeFullTextSearch(),this.initializeChosenSelector(),this.loadChangelogs())},t=>{Router.handleAjaxError(t,e)})}loadChangelogs(){const e=[],t=this.getModalBody();this.findInModal(this.selectorChangeLogsForVersionContainer).each((s,o)=>{const a=new AjaxRequest(Router.getUrl("upgradeDocsGetChangelogForVersion")).withQueryArguments({install:{version:o.dataset.version}}).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();if(!0===t.success){const e=$(o),s=e.find(this.selectorChangeLogsForVersion);s.html(t.html),this.moveNotRelevantDocuments(s),e.find(".t3js-panel-loading").remove()}else Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)});e.push(a)}),Promise.all(e).then(()=>{this.fulltextSearchField.prop("disabled",!1),this.appendItemsToChosenSelector()})}initializeFullTextSearch(){this.fulltextSearchField=this.findInModal(this.selectorFulltextSearch);const e=this.fulltextSearchField.get(0);e.clearable({onClear:()=>{this.combinedFilterSearch()}}),e.focus(),this.initializeChosenSelector(),new DebounceEvent("keyup",()=>{this.combinedFilterSearch()}).bindTo(e)}initializeChosenSelector(){this.chosenField=this.getModalBody().find(this.selectorChosenField);const e={".chosen-select":{width:"100%",placeholder_text_multiple:"tags"},".chosen-select-deselect":{allow_single_deselect:!0},".chosen-select-no-single":{disable_search_threshold:10},".chosen-select-no-results":{no_results_text:"Oops, nothing found!"},".chosen-select-width":{width:"100%"}};for(const t in e)e.hasOwnProperty(t)&&this.findInModal(t).chosen(e[t]);this.chosenField.on("change",()=>{this.combinedFilterSearch()})}appendItemsToChosenSelector(){let e="";$(this.findInModal(this.selectorUpgradeDoc)).each((t,s)=>{e+=$(s).data("item-tags")+","});const t=UpgradeDocs.trimExplodeAndUnique(",",e).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()));this.chosenField.prop("disabled",!1),$.each(t,(e,t)=>{this.chosenField.append($("<option>").text(t))}),this.chosenField.trigger("chosen:updated")}combinedFilterSearch(){const e=this.getModalBody(),t=e.find("div.item");if(this.chosenField.val().length<1&&this.fulltextSearchField.val().length<1)return this.currentModal.find(".panel-version .panel-collapse.show").collapse("hide"),t.removeClass("hidden searchhit filterhit"),!1;if(t.addClass("hidden").removeClass("searchhit filterhit"),this.chosenField.val().length>0){t.addClass("hidden").removeClass("filterhit");const s=[],o=[];$.each(this.chosenField.val(),(e,t)=>{const a='[data-item-tags*="'+t+'"]';t.includes(":",1)?s.push(a):o.push(a)});const a=o.join(""),n=[];if(s.length)for(let e of s)n.push(a+e);else n.push(a);const l=n.join(",");e.find(l).removeClass("hidden").addClass("searchhit filterhit")}else t.addClass("filterhit").removeClass("hidden");const s=this.fulltextSearchField.val();return e.find("div.item.filterhit").each((e,t)=>{const o=$(t);$(":contains("+s+")",o).length>0||$('input[value*="'+s+'"]',o).length>0?o.removeClass("hidden").addClass("searchhit"):o.removeClass("searchhit").addClass("hidden")}),e.find(".searchhit").closest(".panel-collapse").collapse("show"),e.find(".panel-version").each((e,t)=>{const s=$(t);s.find(".searchhit",".filterhit").length<1&&s.find(" > .panel-collapse").collapse("hide")}),!0}renderTags(e){const t=e.find(".t3js-tags");if(0===t.children().length){e.data("item-tags").split(",").forEach(e=>{t.append($("<span />",{class:"label"}).text(e))})}}moveNotRelevantDocuments(e){e.find('[data-item-state="read"]').appendTo(this.findInModal(".panel-body-read")),e.find('[data-item-state="notAffected"]').appendTo(this.findInModal(".panel-body-not-affected"))}markRead(e){const t=this.getModalBody(),s=this.getModuleContent().data("upgrade-docs-mark-read-token"),o=$(e).closest("button");o.toggleClass("t3js-upgradeDocs-unmarkRead t3js-upgradeDocs-markRead"),o.find("i").toggleClass("fa-check fa-ban"),o.closest(".panel").appendTo(this.findInModal(".panel-body-read")),new AjaxRequest(Router.getUrl()).post({install:{ignoreFile:o.data("filepath"),token:s,action:"upgradeDocsMarkRead"}}).catch(e=>{Router.handleAjaxError(e,t)})}unmarkRead(e){const t=this.getModalBody(),s=this.getModuleContent().data("upgrade-docs-unmark-read-token"),o=$(e).closest("button"),a=o.closest(".panel").data("item-version");o.toggleClass("t3js-upgradeDocs-markRead t3js-upgradeDocs-unmarkRead"),o.find("i").toggleClass("fa-check fa-ban"),o.closest(".panel").appendTo(this.findInModal('*[data-group-version="'+a+'"] .panel-body')),new AjaxRequest(Router.getUrl()).post({install:{ignoreFile:o.data("filepath"),token:s,action:"upgradeDocsUnmarkRead"}}).catch(e=>{Router.handleAjaxError(e,t)})}}export default new UpgradeDocs; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/UpgradeWizards.js b/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/UpgradeWizards.js deleted file mode 100644 index d7913e646816f0a16ac83ea384099c985f06501c..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Module/Upgrade/UpgradeWizards.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"TYPO3/CMS/Install/Module/AbstractInteractableModule.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";import FlashMessage from"TYPO3/CMS/Install/Renderable/FlashMessage.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";import Router from"TYPO3/CMS/Install/Router.js";class UpgradeWizards extends AbstractInteractableModule{constructor(){super(),this.selectorOutputWizardsContainer=".t3js-upgradeWizards-wizards-output",this.selectorOutputDoneContainer=".t3js-upgradeWizards-done-output",this.selectorWizardsBlockingAddsTemplate=".t3js-upgradeWizards-blocking-adds-template",this.selectorWizardsBlockingAddsRows=".t3js-upgradeWizards-blocking-adds-rows",this.selectorWizardsBlockingAddsExecute=".t3js-upgradeWizards-blocking-adds-execute",this.selectorWizardsBlockingCharsetTemplate=".t3js-upgradeWizards-blocking-charset-template",this.selectorWizardsBlockingCharsetFix=".t3js-upgradeWizards-blocking-charset-fix",this.selectorWizardsDoneBodyTemplate=".t3js-upgradeWizards-done-body-template",this.selectorWizardsDoneRows=".t3js-upgradeWizards-done-rows",this.selectorWizardsDoneRowTemplate=".t3js-upgradeWizards-done-row-template table tr",this.selectorWizardsDoneRowMarkUndone=".t3js-upgradeWizards-done-markUndone",this.selectorWizardsDoneRowTitle=".t3js-upgradeWizards-done-title",this.selectorWizardsListTemplate=".t3js-upgradeWizards-list-template",this.selectorWizardsListRows=".t3js-upgradeWizards-list-rows",this.selectorWizardsListRowTemplate=".t3js-upgradeWizards-list-row-template",this.selectorWizardsListRowTitle=".t3js-upgradeWizards-list-row-title",this.selectorWizardsListRowExplanation=".t3js-upgradeWizards-list-row-explanation",this.selectorWizardsListRowExecute=".t3js-upgradeWizards-list-row-execute",this.selectorWizardsInputTemplate=".t3js-upgradeWizards-input",this.selectorWizardsInputTitle=".t3js-upgradeWizards-input-title",this.selectorWizardsInputDescription=".t3js-upgradeWizards-input-description",this.selectorWizardsInputHtml=".t3js-upgradeWizards-input-html",this.selectorWizardsInputPerform=".t3js-upgradeWizards-input-perform",this.selectorWizardsInputAbort=".t3js-upgradeWizards-input-abort",this.securityUtility=new SecurityUtility}static removeLoadingMessage(e){e.find(".alert-loading").remove()}static renderProgressBar(e){return ProgressBar.render(Severity.loading,e,"")}initialize(e){this.currentModal=e,this.getData().then(()=>{this.doneUpgrades()}),e.on("click",this.selectorWizardsDoneRowMarkUndone,e=>{this.markUndone(e.target.dataset.identifier)}),e.on("click",this.selectorWizardsBlockingCharsetFix,()=>{this.blockingUpgradesDatabaseCharsetFix()}),e.on("click",this.selectorWizardsBlockingAddsExecute,()=>{this.blockingUpgradesDatabaseAddsExecute()}),e.on("click",this.selectorWizardsListRowExecute,e=>{this.wizardInput(e.target.dataset.identifier,e.target.dataset.title)}),e.on("click",this.selectorWizardsInputPerform,e=>{this.wizardExecute(e.target.dataset.identifier,e.target.dataset.title)}),e.on("click",this.selectorWizardsInputAbort,e=>{this.findInModal(this.selectorOutputWizardsContainer).empty(),this.wizardsList()})}getData(){const e=this.getModalBody();return new AjaxRequest(Router.getUrl("upgradeWizardsGetData")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success?(e.empty().append(s.html),this.blockingUpgradesDatabaseCharsetTest()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e)})}blockingUpgradesDatabaseCharsetTest(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.empty().html(UpgradeWizards.renderProgressBar("Checking database charset...")),new AjaxRequest(Router.getUrl("upgradeWizardsBlockingDatabaseCharsetTest")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();UpgradeWizards.removeLoadingMessage(t),!0===r.success&&(!0===r.needsUpdate?e.find(this.selectorOutputWizardsContainer).append(e.find(this.selectorWizardsBlockingCharsetTemplate)).clone():this.blockingUpgradesDatabaseAdds())},e=>{Router.handleAjaxError(e,t)})}blockingUpgradesDatabaseCharsetFix(){const e=$(this.selectorOutputWizardsContainer);e.empty().html(UpgradeWizards.renderProgressBar("Setting database charset to UTF-8...")),new AjaxRequest(Router.getUrl("upgradeWizardsBlockingDatabaseCharsetFix")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();if(UpgradeWizards.removeLoadingMessage(e),!0===s.success)Array.isArray(s.status)&&s.status.length>0&&s.status.forEach(t=>{const s=InfoBox.render(t.severity,t.title,t.message);e.append(s)});else{const t=FlashMessage.render(Severity.error,"Something went wrong","");UpgradeWizards.removeLoadingMessage(e),e.append(t)}},t=>{Router.handleAjaxError(t,e)})}blockingUpgradesDatabaseAdds(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.empty().html(UpgradeWizards.renderProgressBar("Check for missing mandatory database tables and fields...")),new AjaxRequest(Router.getUrl("upgradeWizardsBlockingDatabaseAdds")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();if(UpgradeWizards.removeLoadingMessage(t),!0===r.success)if(!0===r.needsUpdate){const t=e.find(this.selectorWizardsBlockingAddsTemplate).clone();"object"==typeof r.adds.tables&&r.adds.tables.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),"object"==typeof r.adds.columns&&r.adds.columns.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table)+", Field: "+this.securityUtility.encodeHtml(e.field);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),"object"==typeof r.adds.indexes&&r.adds.indexes.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table)+", Index: "+this.securityUtility.encodeHtml(e.index);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),e.find(this.selectorOutputWizardsContainer).append(t)}else this.wizardsList();else Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e)})}blockingUpgradesDatabaseAddsExecute(){const e=this.findInModal(this.selectorOutputWizardsContainer);e.empty().html(UpgradeWizards.renderProgressBar("Adding database tables and fields...")),new AjaxRequest(Router.getUrl("upgradeWizardsBlockingDatabaseExecute")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();if(UpgradeWizards.removeLoadingMessage(e),Array.isArray(s.status)&&s.status.length>0&&s.status.forEach(t=>{const s=InfoBox.render(t.severity,t.title,t.message);e.append(s)}),!0===s.success)this.wizardsList();else if(Array.isArray(s.status)&&0!==s.status.length){const t=$('<div class="btn-toolbar mt-3 mb-4"></div>'),s=$('<button class="btn btn-default">Retry database migration</button>'),r=$('<button class="btn btn-danger">Proceed despite of errors</button>');s.click(()=>{this.blockingUpgradesDatabaseAddsExecute()}),r.click(()=>{t.remove(),this.wizardsList()}),t.append(s),t.append(r),e.append(t)}else{const t=FlashMessage.render(Severity.error,"Something went wrong","");e.append(t)}},t=>{Router.handleAjaxError(t,e)})}wizardsList(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.append(UpgradeWizards.renderProgressBar("Loading upgrade wizards...")),new AjaxRequest(Router.getUrl("upgradeWizardsList")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();UpgradeWizards.removeLoadingMessage(t);const a=e.find(this.selectorWizardsListTemplate).clone();if(a.removeClass("t3js-upgradeWizards-list-template"),!0===r.success){let t=0,s=0;Array.isArray(r.wizards)&&r.wizards.length>0&&(s=r.wizards.length,r.wizards.forEach(s=>{if(!0===s.shouldRenderWizard){const r=e.find(this.selectorWizardsListRowTemplate).clone();t+=1,r.removeClass("t3js-upgradeWizards-list-row-template"),r.find(this.selectorWizardsListRowTitle).empty().text(s.title),r.find(this.selectorWizardsListRowExplanation).empty().text(s.explanation),r.find(this.selectorWizardsListRowExecute).attr("data-identifier",s.identifier).attr("data-title",s.title),a.find(this.selectorWizardsListRows).append(r)}}),a.find(this.selectorWizardsListRows+" hr:last").remove());let i=100;const o=a.find(".progress-bar");t>0?i=Math.round((s-t)/r.wizards.length*100):o.removeClass("progress-bar-info").addClass("progress-bar-success"),o.removeClass("progress-bar-striped").css("width",i+"%").attr("aria-valuenow",i).find("span").text(i+"%"),e.find(this.selectorOutputWizardsContainer).append(a),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!1)}else Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e)})}wizardInput(e,t){const s=this.getModuleContent().data("upgrade-wizards-input-token"),r=this.getModalBody(),a=this.findInModal(this.selectorOutputWizardsContainer);a.empty().html(UpgradeWizards.renderProgressBar('Loading "'+t+'"...')),r.animate({scrollTop:r.scrollTop()-Math.abs(r.find(".t3js-upgrade-status-section").position().top)},250),new AjaxRequest(Router.getUrl("upgradeWizardsInput")).post({install:{action:"upgradeWizardsInput",token:s,identifier:e}}).then(async e=>{const t=await e.resolve();a.empty();const s=r.find(this.selectorWizardsInputTemplate).clone();s.removeClass("t3js-upgradeWizards-input"),!0===t.success&&(Array.isArray(t.status)&&t.status.forEach(e=>{const t=FlashMessage.render(e.severity,e.title,e.message);a.append(t)}),t.userInput.wizardHtml.length>0&&s.find(this.selectorWizardsInputHtml).html(t.userInput.wizardHtml),s.find(this.selectorWizardsInputTitle).text(t.userInput.title),s.find(this.selectorWizardsInputDescription).html(this.securityUtility.stripHtml(t.userInput.description).replace(/\n/g,"<br>")),s.find(this.selectorWizardsInputPerform).attr("data-identifier",t.userInput.identifier).attr("data-title",t.userInput.title)),r.find(this.selectorOutputWizardsContainer).append(s)},e=>{Router.handleAjaxError(e,a)})}wizardExecute(e,t){const s=this.getModuleContent().data("upgrade-wizards-execute-token"),r=this.getModalBody(),a={"install[action]":"upgradeWizardsExecute","install[token]":s,"install[identifier]":e};$(this.findInModal(this.selectorOutputWizardsContainer+" form").serializeArray()).each((e,t)=>{a[t.name]=t.value});const i=this.findInModal(this.selectorOutputWizardsContainer);i.empty().html(UpgradeWizards.renderProgressBar('Executing "'+t+'"...')),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!0),new AjaxRequest(Router.getUrl()).post(a).then(async e=>{const t=await e.resolve();i.empty(),!0===t.success?(Array.isArray(t.status)&&t.status.forEach(e=>{const t=InfoBox.render(e.severity,e.title,e.message);i.append(t)}),this.wizardsList(),r.find(this.selectorOutputDoneContainer).empty(),this.doneUpgrades()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,i)})}doneUpgrades(){const e=this.getModalBody(),t=e.find(this.selectorOutputDoneContainer);t.empty().html(UpgradeWizards.renderProgressBar("Loading executed upgrade wizards...")),new AjaxRequest(Router.getUrl("upgradeWizardsDoneUpgrades")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();if(UpgradeWizards.removeLoadingMessage(t),!0===r.success){Array.isArray(r.status)&&r.status.length>0&&r.status.forEach(e=>{const s=InfoBox.render(e.severity,e.title,e.message);t.append(s)});const s=e.find(this.selectorWizardsDoneBodyTemplate).clone(),a=s.find(this.selectorWizardsDoneRows);let i=!1;Array.isArray(r.wizardsDone)&&r.wizardsDone.length>0&&r.wizardsDone.forEach(t=>{i=!0;const s=e.find(this.selectorWizardsDoneRowTemplate).clone();s.find(this.selectorWizardsDoneRowMarkUndone).attr("data-identifier",t.identifier),s.find(this.selectorWizardsDoneRowTitle).text(t.title),a.append(s)}),Array.isArray(r.rowUpdatersDone)&&r.rowUpdatersDone.length>0&&r.rowUpdatersDone.forEach(t=>{i=!0;const s=e.find(this.selectorWizardsDoneRowTemplate).clone();s.find(this.selectorWizardsDoneRowMarkUndone).attr("data-identifier",t.identifier),s.find(this.selectorWizardsDoneRowTitle).text(t.title),a.append(s)}),i&&(e.find(this.selectorOutputDoneContainer).append(s),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!0))}else Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}markUndone(e){const t=this.getModuleContent().data("upgrade-wizards-mark-undone-token"),s=this.getModalBody(),r=this.findInModal(this.selectorOutputDoneContainer);r.empty().html(UpgradeWizards.renderProgressBar("Marking upgrade wizard as undone...")),new AjaxRequest(Router.getUrl()).post({install:{action:"upgradeWizardsMarkUndone",token:t,identifier:e}}).then(async e=>{const t=await e.resolve();r.empty(),s.find(this.selectorOutputDoneContainer).empty(),!0===t.success&&Array.isArray(t.status)?t.status.forEach(e=>{Notification.success(e.title,e.message),this.doneUpgrades(),this.blockingUpgradesDatabaseCharsetTest()}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,r)})}}export default new UpgradeWizards; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Renderable/FlashMessage.js b/typo3/sysext/install/Resources/Public/JavaScript/Renderable/FlashMessage.js deleted file mode 100644 index 79091bc200ca2892623879b46d11c4186c477bd2..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Renderable/FlashMessage.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";class FlashMessage{constructor(){this.template=$('<div class="t3js-message typo3-message alert"><h4></h4><p class="messageText"></p></div>')}render(e,s,t){let a=this.template.clone();return a.addClass("alert-"+Severity.getCssClass(e)),s&&a.find("h4").text(s),t?a.find(".messageText").text(t):a.find(".messageText").remove(),a}}export default new FlashMessage; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Renderable/InfoBox.js b/typo3/sysext/install/Resources/Public/JavaScript/Renderable/InfoBox.js deleted file mode 100644 index 1c20ef3477180ee0dc9b8e0fabb9698aa45411dc..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Renderable/InfoBox.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";class InfoBox{constructor(){this.template=$('<div class="t3js-infobox callout callout-sm"><h4 class="callout-title"></h4><div class="callout-body"></div></div>')}render(t,l,e){let o=this.template.clone();return o.addClass("callout-"+Severity.getCssClass(t)),l&&o.find("h4").text(l),e?o.find(".callout-body").text(e):o.find(".callout-body").remove(),o}}export default new InfoBox; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Renderable/ProgressBar.js b/typo3/sysext/install/Resources/Public/JavaScript/Renderable/ProgressBar.js deleted file mode 100644 index aacbf52d1d92bd0497086290a644047fd225ab61..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Renderable/ProgressBar.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";class ProgressBar{constructor(){this.template=$('<div class="progress"><div class="t3js-progressbar progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"> <span></span></div></div>')}render(r,s,e){let a=this.template.clone();return a.addClass("progress-bar-"+Severity.getCssClass(r)),e&&(a.css("width",e+"%"),a.attr("aria-valuenow",e)),s&&a.find("span").text(s),a}}export default new ProgressBar; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Router.js b/typo3/sysext/install/Resources/Public/JavaScript/Router.js deleted file mode 100644 index 32ae21f395f7596be2e7f98b4552f201ec21970b..0000000000000000000000000000000000000000 --- a/typo3/sysext/install/Resources/Public/JavaScript/Router.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import InfoBox from"TYPO3/CMS/Install/Renderable/InfoBox.js";import ProgressBar from"TYPO3/CMS/Install/Renderable/ProgressBar.js";import Severity from"TYPO3/CMS/Install/Renderable/Severity.js";class Router{constructor(){this.selectorBody=".t3js-body",this.selectorMainContent=".t3js-module-body"}initialize(){this.registerInstallToolRoutes(),$(document).on("click",".t3js-login-lockInstallTool",e=>{e.preventDefault(),this.logout()}),$(document).on("click",".t3js-login-login",e=>{e.preventDefault(),this.login()}),$(document).on("keydown","#t3-install-form-password",e=>{"Enter"===e.key&&(e.preventDefault(),$(".t3js-login-login").trigger("click"))}),$(document).on("click",".card .btn",e=>{e.preventDefault();const t=$(e.currentTarget),o=t.data("import"),a=t.data("inline");if(void 0!==a&&1===parseInt(a,10))import(o).then(({default:e})=>{e.initialize(t)});else{const e=t.closest(".card").find(".card-title").html(),a=t.data("modalSize")||Modal.sizes.large,n=Modal.advanced({type:Modal.types.default,title:e,size:a,content:$('<div class="modal-loading">'),additionalCssClasses:["install-tool-modal"],callback:e=>{import(o).then(({default:t})=>{t.initialize(e)})}});Icons.getIcon("spinner-circle",Icons.sizes.default,null,null,Icons.markupIdentifiers.inline).then(e=>{n.find(".modal-loading").append(e)})}});"backend"===$(this.selectorBody).data("context")?this.executeSilentConfigurationUpdate():this.preAccessCheck()}registerInstallToolRoutes(){void 0===TYPO3.settings&&(TYPO3.settings={ajaxUrls:{icons:window.location.origin+window.location.pathname+"?install[controller]=icon&install[action]=getIcon",icons_cache:window.location.origin+window.location.pathname+"?install[controller]=icon&install[action]=getCacheIdentifier"}})}getUrl(e,t,o){const a=$(this.selectorBody).data("context");let n=location.href;return n=n.replace(location.search,""),void 0===t&&(t=$(this.selectorBody).data("controller")),n=n+"?install[controller]="+t,void 0!==a&&""!==a&&(n=n+"&install[context]="+a),void 0!==e&&(n=n+"&install[action]="+e),void 0!==o&&(n=n+"&"+o),n}executeSilentConfigurationUpdate(){this.updateLoadingInfo("Checking session and executing silent configuration update"),new AjaxRequest(this.getUrl("executeSilentConfigurationUpdate","layout")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.executeSilentTemplateFileUpdate():this.executeSilentConfigurationUpdate()},e=>{this.handleAjaxError(e)})}executeSilentTemplateFileUpdate(){this.updateLoadingInfo("Checking session and executing silent template file update"),new AjaxRequest(this.getUrl("executeSilentTemplateFileUpdate","layout")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.executeSilentExtensionConfigurationSynchronization():this.executeSilentTemplateFileUpdate()},e=>{this.handleAjaxError(e)})}executeSilentExtensionConfigurationSynchronization(){const e=$(this.selectorBody);this.updateLoadingInfo("Executing silent extension configuration synchronization"),new AjaxRequest(this.getUrl("executeSilentExtensionConfigurationSynchronization","layout")).get({cache:"no-cache"}).then(async t=>{if(!0===(await t.resolve()).success)this.loadMainLayout();else{const t=InfoBox.render(Severity.error,"Something went wrong","");e.empty().append(t)}},e=>{this.handleAjaxError(e)})}loadMainLayout(){const e=$(this.selectorBody),t=e.data("controller");this.updateLoadingInfo("Loading main layout"),new AjaxRequest(this.getUrl("mainLayout","layout","install[module]="+t)).get({cache:"no-cache"}).then(async o=>{const a=await o.resolve();if(!0===a.success&&"undefined"!==a.html&&a.html.length>0)e.empty().append(a.html),"backend"!==$(this.selectorBody).data("context")&&e.find('.t3js-modulemenu-action[data-controller="'+t+'"]').addClass("modulemenu-action-active"),this.loadCards();else{const t=InfoBox.render(Severity.error,"Something went wrong","");e.empty().append(t)}},e=>{this.handleAjaxError(e)})}async handleAjaxError(e,t){let o;if(403===e.response.status){"backend"===$(this.selectorBody).data("context")?(o=InfoBox.render(Severity.error,"The install tool session expired. Please reload the backend and try again."),$(this.selectorBody).empty().append(o)):this.checkEnableInstallToolFile()}else{const a=this.getUrl(void 0,"upgrade");o=$('<div class="t3js-infobox callout callout-sm callout-danger"><div class="callout-body"><p>Something went wrong. Please use <b><a href="'+a+'">Check for broken extensions</a></b> to see if a loaded extension breaks this part of the install tool and unload it.</p><p>The box below may additionally reveal further details on what went wrong depending on your debug settings. It may help to temporarily switch to debug mode using <b>Settings > Configuration Presets > Debug settings.</b></p><p>If this error happens at an early state and no full exception back trace is shown, it may also help to manually increase debugging output in <code>typo3conf/LocalConfiguration.php</code>:<code>[\'BE\'][\'debug\'] => true</code>, <code>[\'SYS\'][\'devIPmask\'] => \'*\'</code>, <code>[\'SYS\'][\'displayErrors\'] => 1</code>,<code>[\'SYS\'][\'exceptionalErrors\'] => 12290</code></p></div></div><div class="panel-group" role="tablist" aria-multiselectable="true"><div class="panel panel-default panel-flat searchhit"><div class="panel-heading" role="tab" id="heading-error"><h3 class="panel-title"><a role="button" data-bs-toggle="collapse" data-bs-parent="#accordion" href="#collapse-error" aria-expanded="true" aria-controls="collapse-error" class="collapsed"><span class="caret"></span><strong>Ajax error</strong></a></h3></div><div id="collapse-error" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-error"><div class="panel-body">'+await e.response.text()+"</div></div></div></div>"),void 0!==t?$(t).empty().html(o):$(this.selectorBody).empty().html(o)}}checkEnableInstallToolFile(){new AjaxRequest(this.getUrl("checkEnableInstallToolFile")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkLogin():this.showEnableInstallTool()},e=>{this.handleAjaxError(e)})}showEnableInstallTool(){new AjaxRequest(this.getUrl("showEnableInstallToolFile")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();!0===t.success&&$(this.selectorBody).empty().append(t.html)},e=>{this.handleAjaxError(e)})}checkLogin(){new AjaxRequest(this.getUrl("checkLogin")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.loadMainLayout():this.showLogin()},e=>{this.handleAjaxError(e)})}showLogin(){new AjaxRequest(this.getUrl("showLogin")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();!0===t.success&&$(this.selectorBody).empty().append(t.html)},e=>{this.handleAjaxError(e)})}login(){const e=$(".t3js-login-output"),t=ProgressBar.render(Severity.loading,"Loading...","");e.empty().html(t),new AjaxRequest(this.getUrl()).post({install:{action:"login",token:$("[data-login-token]").data("login-token"),password:$(".t3-install-form-input-text").val()}}).then(async t=>{const o=await t.resolve();!0===o.success?this.executeSilentConfigurationUpdate():o.status.forEach(t=>{const o=InfoBox.render(t.severity,t.title,t.message);e.empty().html(o)})},e=>{this.handleAjaxError(e)})}logout(){new AjaxRequest(this.getUrl("logout")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success&&this.showEnableInstallTool()},e=>{this.handleAjaxError(e)})}loadCards(){const e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("cards")).get({cache:"no-cache"}).then(async t=>{const o=await t.resolve();if(!0===o.success&&"undefined"!==o.html&&o.html.length>0)e.empty().append(o.html);else{const t=InfoBox.render(Severity.error,"Something went wrong","");e.empty().append(t)}},e=>{this.handleAjaxError(e)})}updateLoadingInfo(e){$(this.selectorBody).find("#t3js-ui-block-detail").text(e)}preAccessCheck(){this.updateLoadingInfo("Execute pre access check"),new AjaxRequest(this.getUrl("preAccessCheck","layout")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();t.installToolLocked?this.checkEnableInstallToolFile():t.isAuthorized?this.executeSilentConfigurationUpdate():this.showLogin()},e=>{this.handleAjaxError(e)})}}export default new Router; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/ajax/ajax-queue.js b/typo3/sysext/install/Resources/Public/JavaScript/ajax/ajax-queue.js new file mode 100644 index 0000000000000000000000000000000000000000..c0610f17d9bce24e94cc662c85df563748e6fa7f --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/ajax/ajax-queue.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";class AjaxQueue{constructor(){this.requests=[],this.requestCount=0,this.threshold=5,this.queue=[]}add(e){this.queue.push(e),this.handleNext()}flush(){this.queue=[],this.requests.forEach(e=>e.abort()),this.requests=[]}handleNext(){this.queue.length>0&&this.requestCount<this.threshold&&(this.incrementRequestCount(),this.sendRequest(this.queue.shift()).finally(()=>{this.decrementRequestCount(),this.handleNext()}))}async sendRequest(e){const t=new AjaxRequest(e.url);let s;return s=void 0!==e.method&&"POST"===e.method.toUpperCase()?t.post(e.data):t.withQueryArguments(e.data||{}).get(),this.requests.push(t),s.then(e.onfulfilled,e.onrejected).then(()=>{const e=this.requests.indexOf(t);delete this.requests[e]})}incrementRequestCount(){this.requestCount++}decrementRequestCount(){this.requestCount>0&&this.requestCount--}}export default new AjaxQueue; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/backend-user-confirmation.js b/typo3/sysext/install/Resources/Public/JavaScript/backend-user-confirmation.js new file mode 100644 index 0000000000000000000000000000000000000000..d45cde9895a8d9a2de22bbf68aa097100ff747dc --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/backend-user-confirmation.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";class BackendUserConfirmation{constructor(){DocumentService.ready().then(()=>this.addFocusToFormInput())}addFocusToFormInput(){const o=document.getElementById("confirmationPassword");null!==o&&o.focus()}}export default new BackendUserConfirmation; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/InitInstall.js b/typo3/sysext/install/Resources/Public/JavaScript/init-install.js similarity index 86% rename from typo3/sysext/install/Resources/Public/JavaScript/InitInstall.js rename to typo3/sysext/install/Resources/Public/JavaScript/init-install.js index 34b9f157dc19d9c16bf2b1395409b90cef50c755..4a2d028c5e4ade0318159c62fd55c0c9dc285de4 100644 --- a/typo3/sysext/install/Resources/Public/JavaScript/InitInstall.js +++ b/typo3/sysext/install/Resources/Public/JavaScript/init-install.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -"use strict";self.TYPO3={},import("TYPO3/CMS/Install/Install.js"); \ No newline at end of file +"use strict";self.TYPO3={},import("@typo3/install/install.js"); \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/InitInstaller.js b/typo3/sysext/install/Resources/Public/JavaScript/init-installer.js similarity index 86% rename from typo3/sysext/install/Resources/Public/JavaScript/InitInstaller.js rename to typo3/sysext/install/Resources/Public/JavaScript/init-installer.js index c7cd9c85b591b2bea3ffce25301e607eb7c1a5c9..1527ee99f7e0bce11d6542541127358b83e39399 100644 --- a/typo3/sysext/install/Resources/Public/JavaScript/InitInstaller.js +++ b/typo3/sysext/install/Resources/Public/JavaScript/init-installer.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -"use strict";self.TYPO3={},import("TYPO3/CMS/Install/Installer.js"); \ No newline at end of file +"use strict";self.TYPO3={},import("@typo3/install/installer.js"); \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Install.js b/typo3/sysext/install/Resources/Public/JavaScript/install.js similarity index 73% rename from typo3/sysext/install/Resources/Public/JavaScript/Install.js rename to typo3/sysext/install/Resources/Public/JavaScript/install.js index 40a286e5dea4e32e869e939abe68e82830f90583..8d4de86fb01eebc80e083c95c35e2822a24beac4 100644 --- a/typo3/sysext/install/Resources/Public/JavaScript/Install.js +++ b/typo3/sysext/install/Resources/Public/JavaScript/install.js @@ -10,4 +10,4 @@ * * The TYPO3 project - inspiring people to share! */ -import $ from"jquery";import Router from"TYPO3/CMS/Install/Router.js";class Install{constructor(){$(()=>{Router.initialize()})}}export default new Install; \ No newline at end of file +import $ from"jquery";import Router from"@typo3/install/router.js";class Install{constructor(){$(()=>{Router.initialize()})}}export default new Install; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/installer.js b/typo3/sysext/install/Resources/Public/JavaScript/installer.js new file mode 100644 index 0000000000000000000000000000000000000000..998699a2c1fc2298460d09b932a25d2aebed8f72 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/installer.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import PasswordStrength from"@typo3/install/module/password-strength.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";class Installer{constructor(){this.selectorBody=".t3js-body",this.selectorModuleContent=".t3js-module-content",this.selectorMainContent=".t3js-installer-content",this.selectorProgressBar=".t3js-installer-progress",this.selectorDatabaseConnectOutput=".t3js-installer-databaseConnect-output",this.selectorDatabaseSelectOutput=".t3js-installer-databaseSelect-output",this.selectorDatabaseDataOutput=".t3js-installer-databaseData-output",this.initializeEvents(),$(()=>{this.initialize()})}initializeEvents(){$(document).on("click",".t3js-installer-environmentFolders-retry",e=>{e.preventDefault(),this.showEnvironmentAndFolders()}),$(document).on("click",".t3js-installer-environmentFolders-execute",e=>{e.preventDefault(),this.executeEnvironmentAndFolders()}),$(document).on("click",".t3js-installer-databaseConnect-execute",e=>{e.preventDefault(),this.executeDatabaseConnect()}),$(document).on("click",".t3js-installer-databaseSelect-execute",e=>{e.preventDefault(),this.executeDatabaseSelect()}),$(document).on("click",".t3js-installer-databaseData-execute",e=>{e.preventDefault(),this.executeDatabaseData()}),$(document).on("click",".t3js-installer-defaultConfiguration-execute",e=>{e.preventDefault(),this.executeDefaultConfiguration()}),$(document).on("click",".t3-install-form-password-toggle",e=>{e.preventDefault();const t=$(e.currentTarget),a=$(t.data("toggleTarget")),s=t.find(t.data("toggleIcon"));"password"===a.attr("type")?(s.removeClass("fa-lock").addClass("fa-eye"),a.attr("type","text")):(a.attr("type","password"),s.removeClass("fa-eye").addClass("fa-lock"))}),$(document).on("keyup",".t3-install-form-password-strength",()=>{PasswordStrength.initialize(".t3-install-form-password-strength")}),$(document).on("change","#t3js-connect-database-driver",e=>{let t=$(e.currentTarget).val();$(".t3-install-driver-data").hide(),$(".t3-install-driver-data input").attr("disabled","disabled"),$("#"+t+" input").attr("disabled",null),$("#"+t).show()})}initialize(){this.setProgress(0),this.getMainLayout()}getUrl(e){let t=location.href;return t=t.replace(location.search,""),void 0!==e&&(t=t+"?install[action]="+e),t}setProgress(e){let t=$(this.selectorProgressBar),a=0;0!==e&&(a=e/5*100,t.find(".progress-bar").empty().text(e+" / 5 - "+a+"% Complete")),t.find(".progress-bar").css("width",a+"%").attr("aria-valuenow",a)}getMainLayout(){new AjaxRequest(this.getUrl("mainLayout")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();$(this.selectorBody).empty().append(t.html),this.checkInstallerAvailable()})}checkInstallerAvailable(){new AjaxRequest(this.getUrl("checkInstallerAvailable")).get({cache:"no-cache"}).then(async e=>{(await e.resolve()).success?this.checkEnvironmentAndFolders():this.showInstallerNotAvailable()})}showInstallerNotAvailable(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showInstallerNotAvailable")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&e.empty().append(a.html)})}checkEnvironmentAndFolders(){this.setProgress(1),new AjaxRequest(this.getUrl("checkEnvironmentAndFolders")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkTrustedHostsPattern():this.showEnvironmentAndFolders()})}showEnvironmentAndFolders(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showEnvironmentAndFolders")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();if(!0===a.success){e.empty().html(a.html);let t=$(".t3js-installer-environment-details"),s=!1;Array.isArray(a.environmentStatusErrors)&&a.environmentStatusErrors.forEach(e=>{s=!0;let a=InfoBox.render(e.severity,e.title,e.message);t.append(a)}),Array.isArray(a.environmentStatusWarnings)&&a.environmentStatusWarnings.forEach(e=>{s=!0;let a=InfoBox.render(e.severity,e.title,e.message);t.append(a)}),Array.isArray(a.structureErrors)&&a.structureErrors.forEach(e=>{s=!0;let a=InfoBox.render(e.severity,e.title,e.message);t.append(a)}),s?(t.show(),$(".t3js-installer-environmentFolders-bad").show()):$(".t3js-installer-environmentFolders-good").show()}})}executeEnvironmentAndFolders(){new AjaxRequest(this.getUrl("executeEnvironmentAndFolders")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success&&this.checkTrustedHostsPattern()})}checkTrustedHostsPattern(){new AjaxRequest(this.getUrl("checkTrustedHostsPattern")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.executeSilentConfigurationUpdate():this.executeAdjustTrustedHostsPattern()})}executeAdjustTrustedHostsPattern(){new AjaxRequest(this.getUrl("executeAdjustTrustedHostsPattern")).get({cache:"no-cache"}).then(()=>{this.executeSilentConfigurationUpdate()})}executeSilentConfigurationUpdate(){new AjaxRequest(this.getUrl("executeSilentConfigurationUpdate")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.executeSilentTemplateFileUpdate():this.executeSilentConfigurationUpdate()})}executeSilentTemplateFileUpdate(){new AjaxRequest(this.getUrl("executeSilentTemplateFileUpdate")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkDatabaseConnect():this.executeSilentTemplateFileUpdate()})}checkDatabaseConnect(){this.setProgress(2),new AjaxRequest(this.getUrl("checkDatabaseConnect")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkDatabaseSelect():this.showDatabaseConnect()})}showDatabaseConnect(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showDatabaseConnect")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&(e.empty().html(a.html),$("#t3js-connect-database-driver").trigger("change"))})}executeDatabaseConnect(){let e=$(this.selectorDatabaseConnectOutput),t={"install[action]":"executeDatabaseConnect","install[token]":$(this.selectorModuleContent).data("installer-database-connect-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((e,a)=>{t[a.name]=a.value}),new AjaxRequest(this.getUrl()).post(t).then(async t=>{const a=await t.resolve();!0===a.success?this.checkDatabaseSelect():Array.isArray(a.status)&&(e.empty(),a.status.forEach(t=>{let a=InfoBox.render(t.severity,t.title,t.message);e.append(a)}))})}checkDatabaseSelect(){this.setProgress(3),new AjaxRequest(this.getUrl("checkDatabaseSelect")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkDatabaseData():this.showDatabaseSelect()})}showDatabaseSelect(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showDatabaseSelect")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&e.empty().html(a.html)})}executeDatabaseSelect(){let e=$(this.selectorDatabaseSelectOutput),t={"install[action]":"executeDatabaseSelect","install[token]":$(this.selectorModuleContent).data("installer-database-select-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((e,a)=>{t[a.name]=a.value}),new AjaxRequest(this.getUrl()).post(t).then(async t=>{const a=await t.resolve();!0===a.success?this.checkDatabaseRequirements():Array.isArray(a.status)&&a.status.forEach(t=>{let a=InfoBox.render(t.severity,t.title,t.message);e.empty().append(a)})})}checkDatabaseRequirements(){let e=$(this.selectorDatabaseSelectOutput),t={"install[action]":"checkDatabaseRequirements","install[token]":$(this.selectorModuleContent).data("installer-database-check-requirements-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((e,a)=>{t[a.name]=a.value}),new AjaxRequest(this.getUrl()).post(t).then(async t=>{const a=await t.resolve();!0===a.success?this.checkDatabaseData():Array.isArray(a.status)&&(e.empty(),a.status.forEach(t=>{let a=InfoBox.render(t.severity,t.title,t.message);e.append(a)}))})}checkDatabaseData(){this.setProgress(4),new AjaxRequest(this.getUrl("checkDatabaseData")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.showDefaultConfiguration():this.showDatabaseData()})}showDatabaseData(){let e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("showDatabaseData")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&e.empty().html(a.html)})}executeDatabaseData(){let e=$(this.selectorDatabaseDataOutput),t={"install[action]":"executeDatabaseData","install[token]":$(this.selectorModuleContent).data("installer-database-data-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((e,a)=>{t[a.name]=a.value});let a=ProgressBar.render(Severity.loading,"Loading...","");e.empty().html(a),new AjaxRequest(this.getUrl()).post(t).then(async t=>{const a=await t.resolve();!0===a.success?this.showDefaultConfiguration():Array.isArray(a.status)&&a.status.forEach(t=>{let a=InfoBox.render(t.severity,t.title,t.message);e.empty().append(a)})})}showDefaultConfiguration(){let e=$(this.selectorMainContent);this.setProgress(5),new AjaxRequest(this.getUrl("showDefaultConfiguration")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success&&e.empty().html(a.html)})}executeDefaultConfiguration(){let e={"install[action]":"executeDefaultConfiguration","install[token]":$(this.selectorModuleContent).data("installer-default-configuration-execute-token")};$($(this.selectorBody+" form").serializeArray()).each((t,a)=>{e[a.name]=a.value}),new AjaxRequest(this.getUrl()).post(e).then(async e=>{const t=await e.resolve();top.location.href=t.redirect})}}export default new Installer; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/AbstractInlineModule.js b/typo3/sysext/install/Resources/Public/JavaScript/module/abstract-inline-module.js similarity index 100% rename from typo3/sysext/install/Resources/Public/JavaScript/Module/AbstractInlineModule.js rename to typo3/sysext/install/Resources/Public/JavaScript/module/abstract-inline-module.js diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/AbstractInteractableModule.js b/typo3/sysext/install/Resources/Public/JavaScript/module/abstract-interactable-module.js similarity index 100% rename from typo3/sysext/install/Resources/Public/JavaScript/Module/AbstractInteractableModule.js rename to typo3/sysext/install/Resources/Public/JavaScript/module/abstract-interactable-module.js diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/environment/environment-check.js b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/environment-check.js new file mode 100644 index 0000000000000000000000000000000000000000..4616f1eb43b5c21fb10e3eed55c99f7e99f63e10 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/environment-check.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class EnvironmentCheck extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorGridderBadge=".t3js-environmentCheck-badge",this.selectorExecuteTrigger=".t3js-environmentCheck-execute",this.selectorOutputContainer=".t3js-environmentCheck-output"}initialize(e){this.currentModal=e,this.runTests(),e.on("click",this.selectorExecuteTrigger,e=>{e.preventDefault(),this.runTests()})}runTests(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=$(this.selectorGridderBadge);t.text("").hide();const r=ProgressBar.render(Severity.loading,"Loading...","");e.find(this.selectorOutputContainer).empty().append(r),new AjaxRequest(Router.getUrl("environmentCheckGetStatus")).get({cache:"no-cache"}).then(async r=>{const o=await r.resolve();e.empty().append(o.html),Modal.setButtons(o.buttons);let s=0,n=0;!0===o.success&&"object"==typeof o.status?($.each(o.status,(t,r)=>{Array.isArray(r)&&r.length>0&&r.forEach(t=>{1===t.severity&&s++,2===t.severity&&n++;const r=InfoBox.render(t.severity,t.title,t.message);e.find(this.selectorOutputContainer).append(r)})}),n>0?t.removeClass("label-warning").addClass("label-danger").text(n).show():s>0&&t.removeClass("label-error").addClass("label-warning").text(s).show()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}}export default new EnvironmentCheck; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/environment/folder-structure.js b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/folder-structure.js new file mode 100644 index 0000000000000000000000000000000000000000..58ed07e595681f1fcd65755a6659a66a7d9c5478 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/folder-structure.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class FolderStructure extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorGridderBadge=".t3js-folderStructure-badge",this.selectorOutputContainer=".t3js-folderStructure-output",this.selectorErrorContainer=".t3js-folderStructure-errors",this.selectorErrorList=".t3js-folderStructure-errors-list",this.selectorErrorFixTrigger=".t3js-folderStructure-errors-fix",this.selectorOkContainer=".t3js-folderStructure-ok",this.selectorOkList=".t3js-folderStructure-ok-list",this.selectorPermissionContainer=".t3js-folderStructure-permissions"}static removeLoadingMessage(e){e.find(".alert-loading").remove()}initialize(e){this.currentModal=e,this.getStatus(),e.on("click",this.selectorErrorFixTrigger,e=>{e.preventDefault(),this.fix()})}getStatus(){const e=this.getModalBody(),t=$(this.selectorGridderBadge);t.text("").hide(),e.find(this.selectorOutputContainer).empty().append(ProgressBar.render(Severity.loading,"Loading...","")),new AjaxRequest(Router.getUrl("folderStructureGetStatus")).get({cache:"no-cache"}).then(async r=>{const o=await r.resolve();if(e.empty().append(o.html),Modal.setButtons(o.buttons),!0===o.success&&Array.isArray(o.errorStatus)){let r=0;o.errorStatus.length>0?(e.find(this.selectorErrorContainer).show(),e.find(this.selectorErrorList).empty(),o.errorStatus.forEach(o=>{r++,t.text(r).show();const s=InfoBox.render(o.severity,o.title,o.message);e.find(this.selectorErrorList).append(s)})):e.find(this.selectorErrorContainer).hide()}!0===o.success&&Array.isArray(o.okStatus)&&(o.okStatus.length>0?(e.find(this.selectorOkContainer).show(),e.find(this.selectorOkList).empty(),o.okStatus.forEach(t=>{const r=InfoBox.render(t.severity,t.title,t.message);e.find(this.selectorOkList).append(r)})):e.find(this.selectorOkContainer).hide());let s=o.folderStructureFilePermissionStatus;e.find(this.selectorPermissionContainer).empty().append(InfoBox.render(s.severity,s.title,s.message)),s=o.folderStructureDirectoryPermissionStatus,e.find(this.selectorPermissionContainer).append(InfoBox.render(s.severity,s.title,s.message))},t=>{Router.handleAjaxError(t,e)})}fix(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.findInModal(this.selectorOutputContainer),r=ProgressBar.render(Severity.loading,"Loading...","");t.empty().html(r),new AjaxRequest(Router.getUrl("folderStructureFix")).get({cache:"no-cache"}).then(async e=>{const r=await e.resolve();FolderStructure.removeLoadingMessage(t),!0===r.success&&Array.isArray(r.fixedStatus)?(r.fixedStatus.length>0?r.fixedStatus.forEach(e=>{t.append(InfoBox.render(e.severity,e.title,e.message))}):t.append(InfoBox.render(Severity.warning,"Nothing fixed","")),this.getStatus()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}}export default new FolderStructure; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/environment/image-processing.js b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/image-processing.js new file mode 100644 index 0000000000000000000000000000000000000000..e03b65f6970c5892c57773322a44fae27b37fc17 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/image-processing.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import InfoBox from"@typo3/install/renderable/info-box.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class ImageProcessing extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorExecuteTrigger=".t3js-imageProcessing-execute",this.selectorTestContainer=".t3js-imageProcessing-twinContainer",this.selectorTwinImageTemplate=".t3js-imageProcessing-twinImage-template",this.selectorCommandContainer=".t3js-imageProcessing-command",this.selectorCommandText=".t3js-imageProcessing-command-text",this.selectorTwinImages=".t3js-imageProcessing-images"}initialize(e){this.currentModal=e,this.getData(),e.on("click",this.selectorExecuteTrigger,e=>{e.preventDefault(),this.runTests()})}getData(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("imageProcessingGetData")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success?(e.empty().append(s.html),Modal.setButtons(s.buttons),this.runTests()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}runTests(){const e=this.getModalBody(),t=this.findInModal(this.selectorExecuteTrigger);this.setModalButtonsState(!1);const s=this.findInModal(this.selectorTwinImageTemplate),o=[];e.find(this.selectorTestContainer).each((t,r)=>{const a=$(r),n=a.data("test"),i=InfoBox.render(Severity.loading,"Loading...","");a.empty().html(i);const c=new AjaxRequest(Router.getUrl(n)).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();if(!0===t.success){a.empty(),Array.isArray(t.status)&&t.status.forEach(e=>{const t=InfoBox.render(e.severity,e.title,e.message);a.append(t)});const e=s.clone();if(e.removeClass("t3js-imageProcessing-twinImage-template"),!0===t.fileExists&&(e.find("img.reference").attr("src",t.referenceFile),e.find("img.result").attr("src",t.outputFile),e.find(this.selectorTwinImages).show()),Array.isArray(t.command)&&t.command.length>0){e.find(this.selectorCommandContainer).show();const s=[];t.command.forEach(e=>{s.push("<strong>Command:</strong>\n"+e[1]),3===e.length&&s.push("<strong>Result:</strong>\n"+e[2])}),e.find(this.selectorCommandText).html(s.join("\n"))}a.append(e)}},t=>{Router.handleAjaxError(t,e)});o.push(c)}),Promise.all(o).then(()=>{t.removeClass("disabled").prop("disabled",!1)})}}export default new ImageProcessing; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/environment/mail-test.js b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/mail-test.js new file mode 100644 index 0000000000000000000000000000000000000000..952d33778f5dcdef80e0bec5643e9ab97544d2a4 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/mail-test.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class MailTest extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorOutputContainer=".t3js-mailTest-output",this.selectorMailTestButton=".t3js-mailTest-execute"}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorMailTestButton,t=>{t.preventDefault(),this.send()}),t.on("submit","form",t=>{t.preventDefault(),this.send()})}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("mailTestGetData")).get({cache:"no-cache"}).then(async e=>{const o=await e.resolve();!0===o.success?(t.empty().append(o.html),Modal.setButtons(o.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}send(){this.setModalButtonsState(!1);const t=this.getModuleContent().data("mail-test-token"),e=this.findInModal(this.selectorOutputContainer),o=ProgressBar.render(Severity.loading,"Loading...","");e.empty().html(o),new AjaxRequest(Router.getUrl()).post({install:{action:"mailTest",token:t,email:this.findInModal(".t3js-mailTest-email").val()}}).then(async t=>{const o=await t.resolve();e.empty(),Array.isArray(o.status)?o.status.forEach(t=>{const o=InfoBox.render(t.severity,t.title,t.message);e.html(o)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},()=>{Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")}).finally(()=>{this.setModalButtonsState(!0)})}}export default new MailTest; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/environment/php-info.js b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/php-info.js new file mode 100644 index 0000000000000000000000000000000000000000..920b5bca2e63b7e74129137a4e6cd20b7ed4e14b --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/php-info.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";class PhpInfo extends AbstractInteractableModule{initialize(e){this.currentModal=e,this.getData()}getData(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("phpInfoGetData")).get({cache:"no-cache"}).then(async t=>{const o=await t.resolve();!0===o.success?e.empty().append(o.html):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}}export default new PhpInfo; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/environment/system-information.js b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/system-information.js new file mode 100644 index 0000000000000000000000000000000000000000..cd70a09b106d891136d09d4f3535f4735dca1932 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/environment/system-information.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";class SystemInformation extends AbstractInteractableModule{initialize(t){this.currentModal=t,this.getData()}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("systemInformationGetData")).get({cache:"no-cache"}).then(async e=>{const o=await e.resolve();!0===o.success?t.empty().append(o.html):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}}export default new SystemInformation; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/cache.js b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/cache.js new file mode 100644 index 0000000000000000000000000000000000000000..c0727f3b5d3ba7518544efddabdfcd0cd8b355e2 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/cache.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";import{AbstractInlineModule}from"@typo3/install/module/abstract-inline-module.js";class Cache extends AbstractInlineModule{initialize(e){this.setButtonState(e,!1),new AjaxRequest(Router.getUrl("cacheClearAll","maintenance")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?t.status.length>0&&t.status.forEach(e=>{Notification.success(e.title,e.message)}):Notification.error("Something went wrong clearing caches")},()=>{Notification.error("Clearing caches failed","Clearing caches went wrong on the server side. Check the system for broken extensions or missing database tables and try again.")}).finally(()=>{this.setButtonState(e,!0)})}}export default new Cache; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/clear-tables.js b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/clear-tables.js new file mode 100644 index 0000000000000000000000000000000000000000..8fc0598b8ee4d37acc3aeeddeb3f2de7e31b6263 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/clear-tables.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";class ClearTables extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorClearTrigger=".t3js-clearTables-clear",this.selectorStatsTrigger=".t3js-clearTables-stats",this.selectorOutputContainer=".t3js-clearTables-output",this.selectorStatContainer=".t3js-clearTables-stat-container",this.selectorStatTemplate=".t3js-clearTables-stat-template",this.selectorStatDescription=".t3js-clearTables-stat-description",this.selectorStatRows=".t3js-clearTables-stat-rows",this.selectorStatName=".t3js-clearTables-stat-name"}initialize(t){this.currentModal=t,this.getStats(),t.on("click",this.selectorStatsTrigger,t=>{t.preventDefault(),$(this.selectorOutputContainer).empty(),this.getStats()}),t.on("click",this.selectorClearTrigger,t=>{const e=$(t.target).closest(this.selectorClearTrigger).data("table");t.preventDefault(),this.clear(e)})}getStats(){this.setModalButtonsState(!1);const t=this.getModalBody();new AjaxRequest(Router.getUrl("clearTablesStats")).get({cache:"no-cache"}).then(async e=>{const s=await e.resolve();!0===s.success?(t.empty().append(s.html),Modal.setButtons(s.buttons),Array.isArray(s.stats)&&s.stats.length>0&&s.stats.forEach(e=>{if(e.rowCount>0){const s=t.find(this.selectorStatTemplate).clone();s.find(this.selectorStatDescription).text(e.description),s.find(this.selectorStatName).text(e.name),s.find(this.selectorStatRows).text(e.rowCount),s.find(this.selectorClearTrigger).attr("data-table",e.name),t.find(this.selectorStatContainer).append(s.html())}})):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}clear(t){const e=this.getModalBody(),s=this.getModuleContent().data("clear-tables-clear-token");new AjaxRequest(Router.getUrl()).post({install:{action:"clearTablesClear",token:s,table:t}}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?e.status.forEach(t=>{Notification.success(t.title,t.message)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log."),this.getStats()},t=>{Router.handleAjaxError(t,e)})}}export default new ClearTables; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/clear-typo3temp-files.js b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/clear-typo3temp-files.js new file mode 100644 index 0000000000000000000000000000000000000000..fbc4cc4eb18b7b6572b43f4d579f3255e5046959 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/clear-typo3temp-files.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";class ClearTypo3tempFiles extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorDeleteTrigger=".t3js-clearTypo3temp-delete",this.selectorOutputContainer=".t3js-clearTypo3temp-output",this.selectorStatContainer=".t3js-clearTypo3temp-stat-container",this.selectorStatsTrigger=".t3js-clearTypo3temp-stats",this.selectorStatTemplate=".t3js-clearTypo3temp-stat-template",this.selectorStatNumberOfFiles=".t3js-clearTypo3temp-stat-numberOfFiles",this.selectorStatDirectory=".t3js-clearTypo3temp-stat-directory"}initialize(t){this.currentModal=t,this.getStats(),t.on("click",this.selectorStatsTrigger,t=>{t.preventDefault(),$(this.selectorOutputContainer).empty(),this.getStats()}),t.on("click",this.selectorDeleteTrigger,t=>{const e=$(t.currentTarget).data("folder"),s=$(t.currentTarget).data("storage-uid");t.preventDefault(),this.delete(e,s)})}getStats(){this.setModalButtonsState(!1);const t=this.getModalBody();new AjaxRequest(Router.getUrl("clearTypo3tempFilesStats")).get({cache:"no-cache"}).then(async e=>{const s=await e.resolve();!0===s.success?(t.empty().append(s.html),Modal.setButtons(s.buttons),Array.isArray(s.stats)&&s.stats.length>0&&s.stats.forEach(e=>{if(e.numberOfFiles>0){const s=t.find(this.selectorStatTemplate).clone();s.find(this.selectorStatNumberOfFiles).text(e.numberOfFiles),s.find(this.selectorStatDirectory).text(e.directory),s.find(this.selectorDeleteTrigger).attr("data-folder",e.directory),s.find(this.selectorDeleteTrigger).attr("data-storage-uid",e.storageUid),t.find(this.selectorStatContainer).append(s.html())}})):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}delete(t,e){const s=this.getModalBody(),r=this.getModuleContent().data("clear-typo3temp-delete-token");new AjaxRequest(Router.getUrl()).post({install:{action:"clearTypo3tempFiles",token:r,folder:t,storageUid:e}}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?(e.status.forEach(t=>{Notification.success(t.title,t.message)}),this.getStats()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,s)})}}export default new ClearTypo3tempFiles; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/create-admin.js b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/create-admin.js new file mode 100644 index 0000000000000000000000000000000000000000..8cfc8f24e4ad38bcea91e62524a730386570369b --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/create-admin.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";import PasswordStrength from"@typo3/install/module/password-strength.js";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";class CreateAdmin extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorAdminCreateButton=".t3js-createAdmin-create"}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorAdminCreateButton,t=>{t.preventDefault(),this.create()}),t.on("click",".t3-install-form-password-strength",()=>{PasswordStrength.initialize(".t3-install-form-password-strength")})}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("createAdminGetData")).get({cache:"no-cache"}).then(async e=>{const s=await e.resolve();!0===s.success?(t.empty().append(s.html),Modal.setButtons(s.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}create(){this.setModalButtonsState(!1);const t=this.getModalBody(),e={install:{action:"createAdmin",token:this.getModuleContent().data("create-admin-token"),userName:this.findInModal(".t3js-createAdmin-user").val(),userPassword:this.findInModal(".t3js-createAdmin-password").val(),userPasswordCheck:this.findInModal(".t3js-createAdmin-password-check").val(),userEmail:this.findInModal(".t3js-createAdmin-email").val(),userSystemMaintainer:this.findInModal(".t3js-createAdmin-system-maintainer").is(":checked")?1:0}};this.getModuleContent().find(":input").prop("disabled",!0),new AjaxRequest(Router.getUrl()).post(e).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?e.status.forEach(t=>{Notification.showMessage(t.title,t.message,t.severity)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)}).finally(()=>{this.setModalButtonsState(!0),this.getModuleContent().find(":input").prop("disabled",!1),this.findInModal(".t3js-createAdmin-user").val(""),this.findInModal(".t3js-createAdmin-password").val(""),this.findInModal(".t3js-createAdmin-password-check").val(""),this.findInModal(".t3js-createAdmin-email").val(""),this.findInModal(".t3js-createAdmin-system-maintainer").prop("checked",!1)})}}export default new CreateAdmin; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/database-analyzer.js b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/database-analyzer.js new file mode 100644 index 0000000000000000000000000000000000000000..3b179b46e74e703810997aea44a92133a8f1ab65 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/database-analyzer.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class DatabaseAnalyzer extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorAnalyzeTrigger=".t3js-databaseAnalyzer-analyze",this.selectorExecuteTrigger=".t3js-databaseAnalyzer-execute",this.selectorOutputContainer=".t3js-databaseAnalyzer-output",this.selectorSuggestionBlock=".t3js-databaseAnalyzer-suggestion-block",this.selectorSuggestionList=".t3js-databaseAnalyzer-suggestion-list",this.selectorSuggestionLineTemplate=".t3js-databaseAnalyzer-suggestion-line-template"}initialize(e){this.currentModal=e,this.getData(),e.on("click",".t3js-databaseAnalyzer-suggestion-block-checkbox",e=>{const t=$(e.currentTarget);t.closest("fieldset").find(":checkbox").prop("checked",t.get(0).checked)}),e.on("click",this.selectorAnalyzeTrigger,e=>{e.preventDefault(),this.analyze()}),e.on("click",this.selectorExecuteTrigger,e=>{e.preventDefault(),this.execute()})}getData(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("databaseAnalyzer")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success?(e.empty().append(a.html),Modal.setButtons(a.buttons),this.analyze()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}analyze(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModalFooter(),a=e.find(this.selectorOutputContainer),s=t.find(this.selectorExecuteTrigger),n=t.find(this.selectorAnalyzeTrigger);a.empty().append(ProgressBar.render(Severity.loading,"Analyzing current database schema...","")),a.on("change",'input[type="checkbox"]',()=>{const e=a.find(":checked").length>0;this.setModalButtonState(s,e)}),new AjaxRequest(Router.getUrl("databaseAnalyzerAnalyze")).get({cache:"no-cache"}).then(async t=>{const o=await t.resolve();!0===o.success?(Array.isArray(o.status)&&(a.find(".alert-loading").remove(),o.status.forEach(e=>{const t=InfoBox.render(e.severity,e.title,e.message);a.append(t)})),Array.isArray(o.suggestions)&&(o.suggestions.forEach(t=>{const s=e.find(this.selectorSuggestionBlock).clone();s.removeClass(this.selectorSuggestionBlock.substr(1));const n=t.key;s.find(".t3js-databaseAnalyzer-suggestion-block-legend").text(t.label),s.find(".t3js-databaseAnalyzer-suggestion-block-checkbox").attr("id","t3-install-"+n+"-checkbox"),t.enabled&&s.find(".t3js-databaseAnalyzer-suggestion-block-checkbox").attr("checked","checked"),s.find(".t3js-databaseAnalyzer-suggestion-block-label").attr("for","t3-install-"+n+"-checkbox"),t.children.forEach(a=>{const n=e.find(this.selectorSuggestionLineTemplate).children().clone(),o=a.hash,r=n.find(".t3js-databaseAnalyzer-suggestion-line-checkbox");r.attr("id","t3-install-db-"+o).attr("data-hash",o),t.enabled&&r.attr("checked","checked"),n.find(".t3js-databaseAnalyzer-suggestion-line-label").attr("for","t3-install-db-"+o),n.find(".t3js-databaseAnalyzer-suggestion-line-statement").text(a.statement),void 0!==a.current&&(n.find(".t3js-databaseAnalyzer-suggestion-line-current-value").text(a.current),n.find(".t3js-databaseAnalyzer-suggestion-line-current").show()),void 0!==a.rowCount&&(n.find(".t3js-databaseAnalyzer-suggestion-line-count-value").text(a.rowCount),n.find(".t3js-databaseAnalyzer-suggestion-line-count").show()),s.find(this.selectorSuggestionList).append(n)}),a.append(s.html())}),this.setModalButtonState(n,!0),this.setModalButtonState(s,a.find(":checked").length>0)),0===o.suggestions.length&&0===o.status.length&&a.append(InfoBox.render(Severity.ok,"Database schema is up to date. Good job!",""))):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}execute(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModuleContent().data("database-analyzer-execute-token"),a=e.find(this.selectorOutputContainer),s=[];a.find(".t3js-databaseAnalyzer-suggestion-line input:checked").each((e,t)=>{s.push($(t).data("hash"))}),a.empty().append(ProgressBar.render(Severity.loading,"Executing database updates...","")),new AjaxRequest(Router.getUrl()).post({install:{action:"databaseAnalyzerExecute",token:t,hashes:s}}).then(async e=>{const t=await e.resolve();Array.isArray(t.status)&&t.status.forEach(e=>{Notification.showMessage(e.title,e.message,e.severity)}),this.analyze()},t=>{Router.handleAjaxError(t,e)})}}export default new DatabaseAnalyzer; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/dump-autoload.js b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/dump-autoload.js new file mode 100644 index 0000000000000000000000000000000000000000..33703c5ccdbc80d50cb7b5c26296ceb663dd7948 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/dump-autoload.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";import{AbstractInlineModule}from"@typo3/install/module/abstract-inline-module.js";class DumpAutoload extends AbstractInlineModule{initialize(t){this.setButtonState(t,!1),new AjaxRequest(Router.getUrl("dumpAutoload")).get({cache:"no-cache"}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?e.status.length>0&&e.status.forEach(t=>{Notification.success(t.message)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},()=>{Notification.error("Autoloader not dumped","Dumping autoload files failed for unknown reasons. Check the system for broken extensions and try again.")}).finally(()=>{this.setButtonState(t,!0)})}}export default new DumpAutoload; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/language-packs.js b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/language-packs.js new file mode 100644 index 0000000000000000000000000000000000000000..4a80c291cf06d0886d13c9fc009ad55ebcdd9b19 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/language-packs.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import SecurityUtility from"@typo3/core/security-utility.js";import FlashMessage from"@typo3/install/renderable/flash-message.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class LanguagePacks extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorOutputContainer=".t3js-languagePacks-output",this.selectorContentContainer=".t3js-languagePacks-mainContent",this.selectorActivateLanguage=".t3js-languagePacks-activateLanguage",this.selectorActivateLanguageIcon="#t3js-languagePacks-activate-icon",this.selectorAddLanguageToggle=".t3js-languagePacks-addLanguage-toggle",this.selectorLanguageInactive=".t3js-languagePacks-inactive",this.selectorDeactivateLanguage=".t3js-languagePacks-deactivateLanguage",this.selectorDeactivateLanguageIcon="#t3js-languagePacks-deactivate-icon",this.selectorUpdate=".t3js-languagePacks-update",this.selectorLanguageUpdateIcon="#t3js-languagePacks-languageUpdate-icon",this.selectorNotifications=".t3js-languagePacks-notifications",this.activeLanguages=[],this.activeExtensions=[],this.packsUpdateDetails={toHandle:0,handled:0,updated:0,new:0,failed:0},this.notifications=[]}static pluralize(t,a="pack",e="s",s=0){return 1!==t&&1!==s?a+e:a}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorAddLanguageToggle,()=>{t.find(this.selectorContentContainer+" "+this.selectorLanguageInactive).toggle()}),t.on("click",this.selectorActivateLanguage,t=>{const a=$(t.target).closest(this.selectorActivateLanguage).data("iso");t.preventDefault(),this.activateLanguage(a)}),t.on("click",this.selectorDeactivateLanguage,t=>{const a=$(t.target).closest(this.selectorDeactivateLanguage).data("iso");t.preventDefault(),this.deactivateLanguage(a)}),t.on("click",this.selectorUpdate,t=>{const a=$(t.target).closest(this.selectorUpdate).data("iso"),e=$(t.target).closest(this.selectorUpdate).data("extension");t.preventDefault(),this.updatePacks(a,e)})}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("languagePacksGetData")).get({cache:"no-cache"}).then(async a=>{const e=await a.resolve();if(!0===e.success){this.activeLanguages=e.activeLanguages,this.activeExtensions=e.activeExtensions,t.empty().append(e.html);const a=t.parent().find(this.selectorContentContainer);a.empty(),a.append(this.languageMatrixHtml(e)),a.append(this.extensionMatrixHtml(e)),$('[data-bs-toggle="tooltip"]').tooltip({container:a})}else{const t=InfoBox.render(Severity.error,"Something went wrong","");this.addNotification(t)}this.renderNotifications()},a=>{Router.handleAjaxError(a,t)})}activateLanguage(t){const a=this.getModalBody(),e=this.findInModal(this.selectorOutputContainer),s=ProgressBar.render(Severity.loading,"Loading...","");e.empty().append(s),this.getNotificationBox().empty(),new AjaxRequest(Router.getUrl()).post({install:{action:"languagePacksActivateLanguage",token:this.getModuleContent().data("language-packs-activate-language-token"),iso:t}}).then(async t=>{const a=await t.resolve();if(e.empty(),!0===a.success&&Array.isArray(a.status))a.status.forEach(t=>{const a=InfoBox.render(t.severity,t.title,t.message);this.addNotification(a)});else{const t=FlashMessage.render(Severity.error,"Something went wrong","");this.addNotification(t)}this.getData()},t=>{Router.handleAjaxError(t,a)})}deactivateLanguage(t){const a=this.getModalBody(),e=this.findInModal(this.selectorOutputContainer),s=ProgressBar.render(Severity.loading,"Loading...","");e.empty().append(s),this.getNotificationBox().empty(),new AjaxRequest(Router.getUrl()).post({install:{action:"languagePacksDeactivateLanguage",token:this.getModuleContent().data("language-packs-deactivate-language-token"),iso:t}}).then(async t=>{const a=await t.resolve();if(e.empty(),!0===a.success&&Array.isArray(a.status))a.status.forEach(t=>{const a=InfoBox.render(t.severity,t.title,t.message);this.addNotification(a)});else{const t=FlashMessage.render(Severity.error,"Something went wrong","");this.addNotification(t)}this.getData()},t=>{Router.handleAjaxError(t,a)})}updatePacks(t,a){const e=this.findInModal(this.selectorOutputContainer),s=this.findInModal(this.selectorContentContainer),n=void 0===t?this.activeLanguages:[t];let i=!0,o=this.activeExtensions;void 0!==a&&(o=[a],i=!1),this.packsUpdateDetails={toHandle:n.length*o.length,handled:0,updated:0,new:0,failed:0},e.empty().append($("<div>",{class:"progress"}).append($("<div>",{class:"progress-bar progress-bar-info",role:"progressbar","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,style:"width: 0;"}).append($("<span>",{class:"text-nowrap"}).text("0 of "+this.packsUpdateDetails.toHandle+" language "+LanguagePacks.pluralize(this.packsUpdateDetails.toHandle)+" updated")))),s.empty(),n.forEach(t=>{o.forEach(a=>{this.getNotificationBox().empty(),new AjaxRequest(Router.getUrl()).post({install:{action:"languagePacksUpdatePack",token:this.getModuleContent().data("language-packs-update-pack-token"),iso:t,extension:a}}).then(async t=>{const a=await t.resolve();!0===a.success?(this.packsUpdateDetails.handled++,"new"===a.packResult?this.packsUpdateDetails.new++:"update"===a.packResult?this.packsUpdateDetails.updated++:this.packsUpdateDetails.failed++,this.packUpdateDone(i,n)):(this.packsUpdateDetails.handled++,this.packsUpdateDetails.failed++,this.packUpdateDone(i,n))},()=>{this.packsUpdateDetails.handled++,this.packsUpdateDetails.failed++,this.packUpdateDone(i,n)})})})}packUpdateDone(t,a){const e=this.getModalBody(),s=this.findInModal(this.selectorOutputContainer);if(this.packsUpdateDetails.handled===this.packsUpdateDetails.toHandle){const s=InfoBox.render(Severity.ok,"Language packs updated",this.packsUpdateDetails.new+" new language "+LanguagePacks.pluralize(this.packsUpdateDetails.new)+" downloaded, "+this.packsUpdateDetails.updated+" language "+LanguagePacks.pluralize(this.packsUpdateDetails.updated)+" updated, "+this.packsUpdateDetails.failed+" language "+LanguagePacks.pluralize(this.packsUpdateDetails.failed)+" not available");this.addNotification(s),!0===t?new AjaxRequest(Router.getUrl()).post({install:{action:"languagePacksUpdateIsoTimes",token:this.getModuleContent().data("language-packs-update-iso-times-token"),isos:a}}).then(async t=>{if(!0===(await t.resolve()).success)this.getData();else{const t=FlashMessage.render(Severity.error,"Something went wrong","");this.addNotification(t)}},t=>{Router.handleAjaxError(t,e)}):this.getData()}else{const t=this.packsUpdateDetails.handled/this.packsUpdateDetails.toHandle*100;s.find(".progress-bar").css("width",t+"%").attr("aria-valuenow",t).find("span").text(this.packsUpdateDetails.handled+" of "+this.packsUpdateDetails.toHandle+" language "+LanguagePacks.pluralize(this.packsUpdateDetails.handled,"pack","s",this.packsUpdateDetails.toHandle)+" updated")}}languageMatrixHtml(t){const a=this.findInModal(this.selectorActivateLanguageIcon).html(),e=this.findInModal(this.selectorDeactivateLanguageIcon).html(),s=this.findInModal(this.selectorLanguageUpdateIcon).html(),n=$("<div>"),i=$("<tbody>");return t.languages.forEach(t=>{const n=t.active,o=$("<tr>");n?i.append(o.append($("<td>").text(" "+t.name).prepend($("<div />",{class:"btn-group"}).append($("<a>",{class:"btn btn-default t3js-languagePacks-deactivateLanguage","data-iso":t.iso,"data-bs-toggle":"tooltip",title:"Deactivate"}).append(e),$("<a>",{class:"btn btn-default t3js-languagePacks-update","data-iso":t.iso,"data-bs-toggle":"tooltip",title:"Download language packs"}).append(s))))):i.append(o.addClass("t3-languagePacks-inactive t3js-languagePacks-inactive").css({display:"none"}).append($("<td>").text(" "+t.name).prepend($("<div />",{class:"btn-group"}).append($("<a>",{class:"btn btn-default t3js-languagePacks-activateLanguage","data-iso":t.iso,"data-bs-toggle":"tooltip",title:"Activate"}).append(a))))),o.append($("<td>").text(t.iso),$("<td>").text(t.dependencies.join(", ")),$("<td>").text(null===t.lastUpdate?"":t.lastUpdate)),i.append(o)}),n.append($("<h3>").text("Active languages"),$("<table>",{class:"table table-striped table-bordered"}).append($("<thead>").append($("<tr>").append($("<th>").append($("<div />",{class:"btn-group"}).append($("<button>",{class:"btn btn-default t3js-languagePacks-addLanguage-toggle",type:"button"}).append($("<span>").append(a)," Add language"),$("<button>",{class:"btn btn-default disabled update-all t3js-languagePacks-update",type:"button",disabled:"disabled"}).append($("<span>").append(s)," Update all"))),$("<th>").text("Locale"),$("<th>").text("Dependencies"),$("<th>").text("Last update"))),i)),Array.isArray(this.activeLanguages)&&this.activeLanguages.length&&n.find(".update-all").removeClass("disabled").removeAttr("disabled"),n.html()}extensionMatrixHtml(t){const a=new SecurityUtility,e=this.findInModal(this.selectorLanguageUpdateIcon).html();let s,n="",i=0;const o=$("<div>"),l=$("<tr>");l.append($("<th>").text("Extension"),$("<th>").text("Key")),t.activeLanguages.forEach(t=>{l.append($("<th>").append($("<a>",{class:"btn btn-default t3js-languagePacks-update","data-iso":t,"data-bs-toggle":"tooltip",title:"Download and update all language packs"}).append($("<span>").append(e)," "+t)))});const d=$("<tbody>");return t.extensions.forEach(t=>{i++,s=void 0!==t.icon?$("<span>").append($("<img>",{style:"max-height: 16px; max-width: 16px;",src:t.icon,alt:t.title}),$("<span>").text(" "+t.title)):$("<span>").text(t.title);const o=$("<tr>");o.append($("<td>").html(s.html()),$("<td>").text(t.key)),t.packs.forEach(s=>{const i=$("<td>");o.append(i),n=!0!==s.exists?null!==s.lastUpdate?"No language pack available for "+s.iso+" when tried at "+s.lastUpdate+". Click to re-try.":"Language pack not downloaded. Click to download":null===s.lastUpdate?"Downloaded. Click to renew":"Language pack downloaded at "+s.lastUpdate+". Click to renew",i.append($("<a>",{class:"btn btn-default t3js-languagePacks-update","data-extension":t.key,"data-iso":s.iso,"data-bs-toggle":"tooltip",title:a.encodeHtml(n)}).append(e))}),d.append(o)}),o.append($("<h3>").text("Translation status"),$("<table>",{class:"table table-striped table-bordered"}).append($("<thead>").append(l),d)),0===i?InfoBox.render(Severity.ok,"Language packs have been found for every installed extension.","To download the latest changes, use the refresh button in the list above."):o.html()}getNotificationBox(){return this.findInModal(this.selectorNotifications)}addNotification(t){this.notifications.push(t)}renderNotifications(){const t=this.getNotificationBox();for(let a of this.notifications)t.append(a);this.notifications=[]}}export default new LanguagePacks; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/reset-backend-user-uc.js b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/reset-backend-user-uc.js new file mode 100644 index 0000000000000000000000000000000000000000..30fb22e96360a1f89879350644a52f7432ed6c43 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/maintenance/reset-backend-user-uc.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{AbstractInlineModule}from"@typo3/install/module/abstract-inline-module.js";import Notification from"@typo3/backend/notification.js";import Router from"@typo3/install/router.js";class ResetBackendUserUc extends AbstractInlineModule{initialize(e){this.setButtonState(e,!1),new AjaxRequest(Router.getUrl("resetBackendUserUc")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?t.status.length>0&&t.status.forEach(e=>{Notification.success(e.title,e.message)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},()=>{Notification.error("Reset preferences of all backend users failed","Resetting preferences of all backend users failed for an unknown reason. Please check your server's logs for further investigation.")}).finally(()=>{this.setButtonState(e,!0)})}}export default new ResetBackendUserUc; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Module/PasswordStrength.js b/typo3/sysext/install/Resources/Public/JavaScript/module/password-strength.js similarity index 100% rename from typo3/sysext/install/Resources/Public/JavaScript/Module/PasswordStrength.js rename to typo3/sysext/install/Resources/Public/JavaScript/module/password-strength.js diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/settings/change-install-tool-password.js b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/change-install-tool-password.js new file mode 100644 index 0000000000000000000000000000000000000000..efe62d49c51ce37dcdb1a01006b68e0869bda298 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/change-install-tool-password.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";import PasswordStrength from"@typo3/install/module/password-strength.js";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";class ChangeInstallToolPassword extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorChangeButton=".t3js-changeInstallToolPassword-change"}initialize(t){this.currentModal=t,this.getData(),t.on("click",this.selectorChangeButton,t=>{t.preventDefault(),this.change()}),t.on("click",".t3-install-form-password-strength",()=>{PasswordStrength.initialize(".t3-install-form-password-strength")})}getData(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("changeInstallToolPasswordGetData")).get({cache:"no-cache"}).then(async s=>{const o=await s.resolve();!0===o.success?(t.empty().append(o.html),Modal.setButtons(o.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},s=>{Router.handleAjaxError(s,t)})}change(){this.setModalButtonsState(!1);const t=this.getModalBody(),s=this.getModuleContent().data("install-tool-token");new AjaxRequest(Router.getUrl()).post({install:{action:"changeInstallToolPassword",token:s,password:this.findInModal(".t3js-changeInstallToolPassword-password").val(),passwordCheck:this.findInModal(".t3js-changeInstallToolPassword-password-check").val()}}).then(async t=>{const s=await t.resolve();!0===s.success&&Array.isArray(s.status)?s.status.forEach(t=>{Notification.showMessage(t.title,t.message,t.severity)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},s=>{Router.handleAjaxError(s,t)}).finally(()=>{this.findInModal(".t3js-changeInstallToolPassword-password,.t3js-changeInstallToolPassword-password-check").val(""),this.setModalButtonsState(!0)})}}export default new ChangeInstallToolPassword; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/settings/extension-configuration.js b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/extension-configuration.js new file mode 100644 index 0000000000000000000000000000000000000000..9008836a5bed2babdb62b470bc9fc819635e17c3 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/extension-configuration.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import"@typo3/install/renderable/clearable.js";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import ModuleMenu from"@typo3/backend/module-menu.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";import{topLevelModuleImport}from"@typo3/backend/utility/top-level-module-import.js";class ExtensionConfiguration extends 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.trigger("focus")):27===e.keyCode&&(e.preventDefault(),a.val("").trigger("focus"))}),t.on("keyup",this.selectorSearchInput,e=>{const a=$(e.target).val(),o=t.find(this.selectorSearchInput);t.find(".search-item").each((t,e)=>{const o=$(e);$(":contains("+a+")",o).length>0||$('input[value*="'+a+'"]',o).length>0?o.removeClass("hidden").addClass("searchhit"):o.removeClass("searchhit").addClass("hidden")}),t.find(".searchhit").collapse("show");const r=o.get(0);r.clearable(),r.focus()}),t.on("submit",this.selectorFormListener,t=>{t.preventDefault(),this.write($(t.currentTarget))})}getContent(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("extensionConfigurationGetContent")).get({cache:"no-cache"}).then(async e=>{const a=await e.resolve();!0===a.success&&(t.html(a.html),this.initializeWrap(),this.initializeColorPicker())},e=>{Router.handleAjaxError(e,t)})}initializeColorPicker(){window.location!==window.parent.location?topLevelModuleImport("@typo3/backend/color-picker.js").then(({default:t})=>{t.initialize()}):import("@typo3/backend/color-picker.js").then(({default:t})=>{t.initialize()})}write(t){const e=this.getModalBody(),a=this.getModuleContent().data("extension-configuration-write-token"),o={};$.each(t.serializeArray(),(t,e)=>{o[e.name]=e.value}),new AjaxRequest(Router.getUrl()).post({install:{token:a,action:"extensionConfigurationWrite",extensionKey:t.attr("data-extensionKey"),extensionConfiguration:o}}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?(e.status.forEach(t=>{Notification.showMessage(t.title,t.message,t.severity)}),"backend"===$("body").data("context")&&ModuleMenu.App.refreshMenu()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}initializeWrap(){this.findInModal(".t3js-emconf-offset").each((t,e)=>{const a=$(e),o=a.parent(),r=a.attr("id"),i=a.attr("value").split(",");a.attr("data-offsetfield-x","#"+r+"_offset_x").attr("data-offsetfield-y","#"+r+"_offset_y").wrap('<div class="hidden"></div>');const n=$("<div>",{class:"form-multigroup-item"}).append($("<div>",{class:"input-group"}).append($("<div>",{class:"input-group-addon"}).text("x"),$("<input>",{id:r+"_offset_x",class:"form-control t3js-emconf-offsetfield","data-target":"#"+r,value:i[0]?.trim()}))),s=$("<div>",{class:"form-multigroup-item"}).append($("<div>",{class:"input-group"}).append($("<div>",{class:"input-group-addon"}).text("y"),$("<input>",{id:r+"_offset_y",class:"form-control t3js-emconf-offsetfield","data-target":"#"+r,value:i[1]?.trim()}))),l=$("<div>",{class:"form-multigroup-wrap"}).append(n,s);o.append(l),o.find(".t3js-emconf-offsetfield").on("keyup",t=>{const e=o.find($(t.currentTarget).data("target"));e.val(o.find(e.data("offsetfield-x")).val()+","+o.find(e.data("offsetfield-y")).val())})}),this.findInModal(".t3js-emconf-wrap").each((t,e)=>{const a=$(e),o=a.parent(),r=a.attr("id"),i=a.attr("value").split("|");a.attr("data-wrapfield-start","#"+r+"_wrap_start").attr("data-wrapfield-end","#"+r+"_wrap_end").wrap('<div class="hidden"></div>');const n=$("<div>",{class:"form-multigroup-wrap"}).append($("<div>",{class:"form-multigroup-item"}).append($("<input>",{id:r+"_wrap_start",class:"form-control t3js-emconf-wrapfield","data-target":"#"+r,value:i[0]?.trim()})),$("<div>",{class:"form-multigroup-item"}).append($("<input>",{id:r+"_wrap_end",class:"form-control t3js-emconf-wrapfield","data-target":"#"+r,value:i[1]?.trim()})));o.append(n),o.find(".t3js-emconf-wrapfield").on("keyup",t=>{const e=o.find($(t.currentTarget).data("target"));e.val(o.find(e.data("wrapfield-start")).val()+"|"+o.find(e.data("wrapfield-end")).val())})})}}export default new ExtensionConfiguration; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/settings/features.js b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/features.js new file mode 100644 index 0000000000000000000000000000000000000000..c76042a2840e8d7afbb2ca9ebfd90729c492797f --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/features.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";class Features extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorSaveTrigger=".t3js-features-save"}initialize(e){this.currentModal=e,this.getContent(),e.on("click",this.selectorSaveTrigger,e=>{e.preventDefault(),this.save()})}getContent(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("featuresGetContent")).get({cache:"no-cache"}).then(async t=>{const o=await t.resolve();!0===o.success&&"undefined"!==o.html&&o.html.length>0?(e.empty().append(o.html),Modal.setButtons(o.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}save(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModuleContent().data("features-save-token"),o={};$(this.findInModal("form").serializeArray()).each((e,t)=>{o[t.name]=t.value}),o["install[action]"]="featuresSave",o["install[token]"]=t,new AjaxRequest(Router.getUrl()).post(o).then(async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?(t.status.forEach(e=>{Notification.showMessage(e.title,e.message,e.severity)}),this.getContent()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}}export default new Features; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/settings/local-configuration.js b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/local-configuration.js new file mode 100644 index 0000000000000000000000000000000000000000..6c161f6ea26060e6290d8f99771bf340f4299ac5 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/local-configuration.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import"@typo3/install/renderable/clearable.js";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";class LocalConfiguration extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorToggleAllTrigger=".t3js-localConfiguration-toggleAll",this.selectorWriteTrigger=".t3js-localConfiguration-write",this.selectorSearchTrigger=".t3js-localConfiguration-search"}initialize(t){this.currentModal=t,this.getContent(),t.on("click",this.selectorWriteTrigger,()=>{this.write()}),t.on("click",this.selectorToggleAllTrigger,()=>{const t=this.getModalBody().find(".panel-collapse"),e=t.eq(0).hasClass("in")?"hide":"show";t.collapse(e)}),$.expr[":"].contains=$.expr.createPseudo(t=>e=>$(e).text().toUpperCase().includes(t.toUpperCase())),t.on("keydown",e=>{const o=t.find(this.selectorSearchTrigger);e.ctrlKey||e.metaKey?"f"===String.fromCharCode(e.which).toLowerCase()&&(e.preventDefault(),o.trigger("focus")):27===e.keyCode&&(e.preventDefault(),o.val("").trigger("focus"))}),t.on("keyup",this.selectorSearchTrigger,e=>{const o=$(e.target).val(),a=t.find(this.selectorSearchTrigger);t.find("div.item").each((t,e)=>{const a=$(e);$(":contains("+o+")",a).length>0||$('input[value*="'+o+'"]',a).length>0?a.removeClass("hidden").addClass("searchhit"):a.removeClass("searchhit").addClass("hidden")}),t.find(".searchhit").parent().collapse("show");const r=a.get(0);r.clearable(),r.focus()})}getContent(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("localConfigurationGetContent")).get({cache:"no-cache"}).then(async e=>{const o=await e.resolve();!0===o.success&&(t.html(o.html),Modal.setButtons(o.buttons))},e=>{Router.handleAjaxError(e,t)})}write(){this.setModalButtonsState(!1);const t=this.getModalBody(),e=this.getModuleContent().data("local-configuration-write-token"),o={};this.findInModal(".t3js-localConfiguration-pathValue").each((t,e)=>{const a=$(e);"checkbox"===a.attr("type")?e.checked?o[a.data("path")]="1":o[a.data("path")]="0":o[a.data("path")]=a.val()}),new AjaxRequest(Router.getUrl()).post({install:{action:"localConfigurationWrite",token:e,configurationValues:o}}).then(async t=>{const e=await t.resolve();!0===e.success&&Array.isArray(e.status)?e.status.forEach(t=>{Notification.showMessage(t.title,t.message,t.severity)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)}).finally(()=>{this.setModalButtonsState(!0)})}}export default new LocalConfiguration; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/settings/presets.js b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/presets.js new file mode 100644 index 0000000000000000000000000000000000000000..74c48dbfe695a49141865896837aaf7c1ba9d839 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/presets.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";class Presets extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorActivateTrigger=".t3js-presets-activate",this.selectorImageExecutable=".t3js-presets-image-executable",this.selectorImageExecutableTrigger=".t3js-presets-image-executable-trigger"}initialize(e){this.currentModal=e,this.getContent(),e.on("click",this.selectorImageExecutableTrigger,e=>{e.preventDefault(),this.getCustomImagePathContent()}),e.on("click",this.selectorActivateTrigger,e=>{e.preventDefault(),this.activate()}),e.find(".t3js-custom-preset").on("input",".t3js-custom-preset",e=>{$("#"+$(e.currentTarget).data("radio")).prop("checked",!0)})}getContent(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("presetsGetContent")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success&&"undefined"!==s.html&&s.html.length>0?(e.empty().append(s.html),Modal.setButtons(s.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}getCustomImagePathContent(){const e=this.getModalBody(),t=this.getModuleContent().data("presets-content-token");new AjaxRequest(Router.getUrl()).post({install:{token:t,action:"presetsGetContent",values:{Image:{additionalSearchPath:this.findInModal(this.selectorImageExecutable).val()}}}}).then(async t=>{const s=await t.resolve();!0===s.success&&"undefined"!==s.html&&s.html.length>0?e.empty().append(s.html):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}activate(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=this.getModuleContent().data("presets-activate-token"),s={};$(this.findInModal("form").serializeArray()).each((e,t)=>{s[t.name]=t.value}),s["install[action]"]="presetsActivate",s["install[token]"]=t,new AjaxRequest(Router.getUrl()).post(s).then(async e=>{const t=await e.resolve();!0===t.success&&Array.isArray(t.status)?t.status.forEach(e=>{Notification.showMessage(e.title,e.message,e.severity)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)}).finally(()=>{this.setModalButtonsState(!0)})}}export default new Presets; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/settings/system-maintainer.js b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/system-maintainer.js new file mode 100644 index 0000000000000000000000000000000000000000..1e2e0b3c7b148002e9eaecb7ac560b84dc69538c --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/settings/system-maintainer.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import{topLevelModuleImport}from"@typo3/backend/utility/top-level-module-import.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Router from"@typo3/install/router.js";class SystemMaintainer extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorWriteTrigger=".t3js-systemMaintainer-write",this.selectorChosenContainer=".t3js-systemMaintainer-chosen",this.selectorChosenField=".t3js-systemMaintainer-chosen-select"}initialize(t){this.currentModal=t;window.location!==window.parent.location?topLevelModuleImport("@typo3/install/chosen.jquery.min.js").then(()=>{this.getList()}):import("@typo3/install/chosen.jquery.min.js").then(()=>{this.getList()}),t.on("click",this.selectorWriteTrigger,t=>{t.preventDefault(),this.write()})}getList(){const t=this.getModalBody();new AjaxRequest(Router.getUrl("systemMaintainerGetList")).get({cache:"no-cache"}).then(async e=>{const s=await e.resolve();if(!0===s.success){t.html(s.html),Modal.setButtons(s.buttons),Array.isArray(s.users)&&s.users.forEach(e=>{let s=e.username;e.disable&&(s="[DISABLED] "+s);const o=$("<option>",{value:e.uid}).text(s);e.isSystemMaintainer&&o.attr("selected","selected"),t.find(this.selectorChosenField).append(o)});const e={".t3js-systemMaintainer-chosen-select":{width:"100%",placeholder_text_multiple:"users"}};for(const s in e)e.hasOwnProperty(s)&&t.find(s).chosen(e[s]);t.find(this.selectorChosenContainer).show(),t.find(this.selectorChosenField).trigger("chosen:updated")}},e=>{Router.handleAjaxError(e,t)})}write(){this.setModalButtonsState(!1);const t=this.getModalBody(),e=this.getModuleContent().data("system-maintainer-write-token"),s=this.findInModal(this.selectorChosenField).val();new AjaxRequest(Router.getUrl()).post({install:{users:s,token:e,action:"systemMaintainerWrite"}}).then(async t=>{const e=await t.resolve();!0===e.success?Array.isArray(e.status)&&e.status.forEach(t=>{Notification.success(t.title,t.message)}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)}).finally(()=>{this.setModalButtonsState(!0)})}}export default new SystemMaintainer; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/core-update.js b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/core-update.js new file mode 100644 index 0000000000000000000000000000000000000000..b4897c3bc8f1f9d5f954df881aecae1a359725a1 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/core-update.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import FlashMessage from"@typo3/install/renderable/flash-message.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class CoreUpdate extends AbstractInteractableModule{constructor(){super(...arguments),this.actionQueue={coreUpdateIsUpdateAvailable:{loadingMessage:"Checking for possible regular or security update",finishMessage:void 0,nextActionName:void 0},coreUpdateCheckPreConditions:{loadingMessage:"Checking if update is possible",finishMessage:"System can be updated",nextActionName:"coreUpdateDownload"},coreUpdateDownload:{loadingMessage:"Downloading new core",finishMessage:void 0,nextActionName:"coreUpdateVerifyChecksum"},coreUpdateVerifyChecksum:{loadingMessage:"Verifying checksum of downloaded core",finishMessage:void 0,nextActionName:"coreUpdateUnpack"},coreUpdateUnpack:{loadingMessage:"Unpacking core",finishMessage:void 0,nextActionName:"coreUpdateMove"},coreUpdateMove:{loadingMessage:"Moving core",finishMessage:void 0,nextActionName:"coreUpdateActivate"},coreUpdateActivate:{loadingMessage:"Activating core",finishMessage:"Core updated - please reload your browser",nextActionName:void 0}},this.selectorOutput=".t3js-coreUpdate-output",this.updateButton=".t3js-coreUpdate-button",this.buttonTemplate=null}initialize(e){this.currentModal=e,this.getData().then(()=>{this.buttonTemplate=this.findInModal(this.updateButton).clone()}),e.on("click",".t3js-coreUpdate-init",e=>{e.preventDefault();const t=$(e.currentTarget).attr("data-action");switch(this.findInModal(this.selectorOutput).empty(),t){case"checkForUpdate":this.callAction("coreUpdateIsUpdateAvailable");break;case"updateDevelopment":this.update("development");break;case"updateRegular":this.update("regular");break;default:throw'Unknown update action "'+t+'"'}})}getData(){const e=this.getModalBody();return new AjaxRequest(Router.getUrl("coreUpdateGetData")).get({cache:"no-cache"}).then(async t=>{const a=await t.resolve();!0===a.success?(e.empty().append(a.html),Modal.setButtons(a.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}update(e){"development"!==e&&(e="regular"),this.callAction("coreUpdateCheckPreConditions",e)}callAction(e,t){const a={install:{action:e}};void 0!==t&&(a.install.type=t),this.addLoadingMessage(this.actionQueue[e].loadingMessage),new AjaxRequest(Router.getUrl()).withQueryArguments(a).get({cache:"no-cache"}).then(async a=>{const o=await a.resolve();!0===this.handleResult(o,this.actionQueue[e].finishMessage)&&void 0!==this.actionQueue[e].nextActionName&&this.callAction(this.actionQueue[e].nextActionName,t)},e=>{Router.handleAjaxError(e,this.getModalBody())})}handleResult(e,t){const a=e.success;return this.removeLoadingMessage(),e.status&&"object"==typeof e.status&&this.showStatusMessages(e.status),e.action&&"object"==typeof e.action&&this.showActionButton(e.action),a&&t&&this.addMessage(Severity.ok,t),a}addLoadingMessage(e){const t=FlashMessage.render(Severity.loading,e);this.findInModal(this.selectorOutput).append(t)}removeLoadingMessage(){this.findInModal(this.selectorOutput).find(".alert-loading").remove()}showStatusMessages(e){$.each(e,(e,t)=>{let a="",o="";const s=t.severity;t.title&&(a=t.title),t.message&&(o=t.message),this.addMessage(s,a,o)})}showActionButton(e){let t=!1,a=!1;e.title&&(t=e.title),e.action&&(a=e.action);const o=this.buttonTemplate;a&&o.attr("data-action",a),t&&o.text(t),this.findInModal(this.updateButton).replaceWith(o)}addMessage(e,t,a){const o=FlashMessage.render(e,t,a);this.findInModal(this.selectorOutput).append(o)}}export default new CoreUpdate; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/extension-compat-tester.js b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/extension-compat-tester.js new file mode 100644 index 0000000000000000000000000000000000000000..fbb0b6ec979b3e2d3a52108005311b90d296c342 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/extension-compat-tester.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class ExtensionCompatTester extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorCheckTrigger=".t3js-extensionCompatTester-check",this.selectorUninstallTrigger=".t3js-extensionCompatTester-uninstall",this.selectorOutputContainer=".t3js-extensionCompatTester-output"}initialize(e){this.currentModal=e,this.getLoadedExtensionList(),e.on("click",this.selectorCheckTrigger,()=>{this.findInModal(this.selectorUninstallTrigger).addClass("hidden"),this.findInModal(this.selectorOutputContainer).empty(),this.getLoadedExtensionList()}),e.on("click",this.selectorUninstallTrigger,e=>{this.uninstallExtension($(e.target).data("extension"))})}getLoadedExtensionList(){this.setModalButtonsState(!1),this.findInModal(".modal-loading").hide();const e=this.getModalBody(),t=this.findInModal(this.selectorOutputContainer),o=ProgressBar.render(Severity.loading,"Loading...","");t.append(o),new AjaxRequest(Router.getUrl("extensionCompatTesterLoadedExtensionList")).get({cache:"no-cache"}).then(async t=>{const o=await t.resolve();e.empty().append(o.html),Modal.setButtons(o.buttons);const n=this.findInModal(this.selectorOutputContainer),s=ProgressBar.render(Severity.loading,"Loading...","");n.append(s),!0===o.success?this.loadExtLocalconf().then(()=>{n.append(InfoBox.render(Severity.ok,"ext_localconf.php of all loaded extensions successfully loaded","")),this.loadExtTables().then(()=>{n.append(InfoBox.render(Severity.ok,"ext_tables.php of all loaded extensions successfully loaded",""))},async e=>{this.renderFailureMessages("ext_tables.php",(await e.response.json()).brokenExtensions,n)}).finally(()=>{this.unlockModal()})},async e=>{this.renderFailureMessages("ext_localconf.php",(await e.response.json()).brokenExtensions,n),n.append(InfoBox.render(Severity.notice,"Skipped scanning ext_tables.php files due to previous errors","")),this.unlockModal()}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},t=>{Router.handleAjaxError(t,e)})}unlockModal(){this.findInModal(this.selectorOutputContainer).find(".alert-loading").remove(),this.findInModal(this.selectorCheckTrigger).removeClass("disabled").prop("disabled",!1)}renderFailureMessages(e,t,o){for(let n of t){let t;n.isProtected||(t=$("<button />",{class:"btn btn-danger t3js-extensionCompatTester-uninstall"}).attr("data-extension",n.name).text('Uninstall extension "'+n.name+'"')),o.append(InfoBox.render(Severity.error,"Loading "+e+' of extension "'+n.name+'" failed',n.isProtected?"Extension is mandatory and cannot be uninstalled.":""),t)}this.unlockModal()}loadExtLocalconf(){const e=this.getModuleContent().data("extension-compat-tester-load-ext_localconf-token");return new AjaxRequest(Router.getUrl()).post({install:{action:"extensionCompatTesterLoadExtLocalconf",token:e}})}loadExtTables(){const e=this.getModuleContent().data("extension-compat-tester-load-ext_tables-token");return new AjaxRequest(Router.getUrl()).post({install:{action:"extensionCompatTesterLoadExtTables",token:e}})}uninstallExtension(e){const t=this.getModuleContent().data("extension-compat-tester-uninstall-extension-token"),o=this.getModalBody(),n=$(this.selectorOutputContainer),s=ProgressBar.render(Severity.loading,"Loading...","");n.append(s),new AjaxRequest(Router.getUrl()).post({install:{action:"extensionCompatTesterUninstallExtension",token:t,extension:e}}).then(async e=>{const t=await e.resolve();t.success?(Array.isArray(t.status)&&t.status.forEach(e=>{const t=InfoBox.render(e.severity,e.title,e.message);o.find(this.selectorOutputContainer).empty().append(t)}),this.findInModal(this.selectorUninstallTrigger).addClass("hidden"),this.getLoadedExtensionList()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,o)})}}export default new ExtensionCompatTester; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/extension-scanner.js b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/extension-scanner.js new file mode 100644 index 0000000000000000000000000000000000000000..2eb57499ed3f4d0c17752e386d52764f3e7beb5e --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/extension-scanner.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxQueue from"@typo3/install/ajax/ajax-queue.js";import Router from"@typo3/install/router.js";class ExtensionScanner extends AbstractInteractableModule{constructor(){super(...arguments),this.listOfAffectedRestFileHashes=[],this.selectorExtensionContainer=".t3js-extensionScanner-extension",this.selectorNumberOfFiles=".t3js-extensionScanner-number-of-files",this.selectorScanSingleTrigger=".t3js-extensionScanner-scan-single",this.selectorExtensionScanButton=".t3js-extensionScanner-scan-all"}initialize(e){this.currentModal=e,this.getData(),e.on("show.bs.collapse",this.selectorExtensionContainer,e=>{const n=$(e.currentTarget);if(void 0===n.data("scanned")){const e=n.data("extension");this.scanSingleExtension(e),n.data("scanned",!0)}}).on("hide.bs.modal",()=>{AjaxQueue.flush()}).on("click",this.selectorScanSingleTrigger,e=>{e.preventDefault();const n=$(e.currentTarget).closest(this.selectorExtensionContainer).data("extension");this.scanSingleExtension(n)}).on("click",this.selectorExtensionScanButton,n=>{n.preventDefault(),this.setModalButtonsState(!1);const t=e.find(this.selectorExtensionContainer);this.scanAll(t)})}getData(){const e=this.getModalBody();new AjaxRequest(Router.getUrl("extensionScannerGetData")).get().then(async n=>{const t=await n.resolve();!0===t.success?(e.empty().append(t.html),Modal.setButtons(t.buttons)):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},n=>{Router.handleAjaxError(n,e)})}getExtensionSelector(e){return this.selectorExtensionContainer+"-"+e}scanAll(e){this.findInModal(this.selectorExtensionContainer).removeClass("panel-danger panel-warning panel-success").find(".panel-progress-bar").css("width",0).attr("aria-valuenow",0).find("span").text("0%"),this.setProgressForAll(),e.each((e,n)=>{const t=$(n),s=t.data("extension");this.scanSingleExtension(s),t.data("scanned",!0)})}setStatusMessageForScan(e,n,t){this.findInModal(this.getExtensionSelector(e)).find(this.selectorNumberOfFiles).text("Checked "+n+" of "+t+" files")}setProgressForScan(e,n,t){const s=n/t*100;this.findInModal(this.getExtensionSelector(e)).find(".panel-progress-bar").css("width",s+"%").attr("aria-valuenow",s).find("span").text(s+"%")}setProgressForAll(){const e=this.findInModal(this.selectorExtensionContainer).length,n=this.findInModal(this.selectorExtensionContainer+".t3js-extensionscan-finished.panel-success").length+this.findInModal(this.selectorExtensionContainer+".t3js-extensionscan-finished.panel-warning").length+this.findInModal(this.selectorExtensionContainer+".t3js-extensionscan-finished.panel-danger").length,t=n/e*100,s=this.getModalBody();this.findInModal(".t3js-extensionScanner-progress-all-extension .progress-bar").css("width",t+"%").attr("aria-valuenow",t).find("span").text(n+" of "+e+" scanned"),n===e&&(this.findInModal(this.selectorExtensionScanButton).removeClass("disabled").prop("disabled",!1),Notification.success("Scan finished","All extensions have been scanned."),new AjaxRequest(Router.getUrl()).post({install:{action:"extensionScannerMarkFullyScannedRestFiles",token:this.getModuleContent().data("extension-scanner-mark-fully-scanned-rest-files-token"),hashes:this.uniqueArray(this.listOfAffectedRestFileHashes)}}).then(async e=>{const n=await e.resolve();!0===n.success&&Notification.success("Marked not affected files","Marked "+n.markedAsNotAffected+" ReST files as not affected.")},e=>{Router.handleAjaxError(e,s)}))}uniqueArray(e){return e.filter((e,n,t)=>t.indexOf(e)===n)}scanSingleExtension(e){const n=this.getModuleContent().data("extension-scanner-files-token"),t=this.getModalBody(),s=this.findInModal(this.getExtensionSelector(e));let i=!1;s.removeClass("panel-danger panel-warning panel-success t3js-extensionscan-finished"),s.data("hasRun","true"),s.find(".t3js-extensionScanner-scan-single").text("Scanning...").attr("disabled","disabled"),s.find(".t3js-extensionScanner-extension-body-loc").empty().text("0"),s.find(".t3js-extensionScanner-extension-body-ignored-files").empty().text("0"),s.find(".t3js-extensionScanner-extension-body-ignored-lines").empty().text("0"),this.setProgressForAll(),new AjaxRequest(Router.getUrl()).post({install:{action:"extensionScannerFiles",token:n,extension:e}}).then(async n=>{const a=await n.resolve();if(!0===a.success&&Array.isArray(a.files)){const n=a.files.length;if(n<=0)return void Notification.warning("No files found","The extension "+e+" contains no scannable files");this.setStatusMessageForScan(e,0,n),s.find(".t3js-extensionScanner-extension-body").text("");let o=0;a.files.forEach(a=>{AjaxQueue.add({method:"POST",data:{install:{action:"extensionScannerScanFile",token:this.getModuleContent().data("extension-scanner-scan-file-token"),extension:e,file:a}},url:Router.getUrl(),onfulfilled:async r=>{const l=await r.resolve();if(o++,this.setStatusMessageForScan(e,o,n),this.setProgressForScan(e,o,n),l.success&&$.isArray(l.matches)&&l.matches.forEach(e=>{i=!0;const n=t.find("#t3js-extensionScanner-file-hit-template").clone();n.find(".t3js-extensionScanner-hit-file-panel-head").attr("href","#collapse"+e.uniqueId),n.find(".t3js-extensionScanner-hit-file-panel-body").attr("id","collapse"+e.uniqueId),n.find(".t3js-extensionScanner-hit-filename").text(a),n.find(".t3js-extensionScanner-hit-message").text(e.message),"strong"===e.indicator?n.find(".t3js-extensionScanner-hit-file-panel-head .badges").append('<span class="badge" title="Reliable match, false positive unlikely">strong</span>'):n.find(".t3js-extensionScanner-hit-file-panel-head .badges").append('<span class="badge" title="Probable match, but can be a false positive">weak</span>'),!0===e.silenced&&n.find(".t3js-extensionScanner-hit-file-panel-head .badges").append('<span class="badge" title="Match has been annotated by extension author as false positive match">silenced</span>'),n.find(".t3js-extensionScanner-hit-file-lineContent").empty().text(e.lineContent),n.find(".t3js-extensionScanner-hit-file-line").empty().text(e.line+": "),$.isArray(e.restFiles)&&e.restFiles.forEach(e=>{const s=t.find("#t3js-extensionScanner-file-hit-rest-template").clone();s.find(".t3js-extensionScanner-hit-rest-panel-head").attr("href","#collapse"+e.uniqueId),s.find(".t3js-extensionScanner-hit-rest-panel-head .badge").empty().text(e.version),s.find(".t3js-extensionScanner-hit-rest-panel-body").attr("id","collapse"+e.uniqueId),s.find(".t3js-extensionScanner-hit-rest-headline").text(e.headline),s.find(".t3js-extensionScanner-hit-rest-body").text(e.content),s.addClass("panel-"+e.class),n.find(".t3js-extensionScanner-hit-file-rest-container").append(s),this.listOfAffectedRestFileHashes.push(e.file_hash)});const o=n.find(".panel-breaking",".t3js-extensionScanner-hit-file-rest-container").length>0?"panel-danger":"panel-warning";n.addClass(o),s.find(".t3js-extensionScanner-extension-body").removeClass("hide").append(n),"panel-danger"===o&&s.removeClass("panel-warning").addClass(o),"panel-warning"!==o||s.hasClass("panel-danger")||s.addClass(o)}),l.success){const e=parseInt(s.find(".t3js-extensionScanner-extension-body-loc").text(),10);if(s.find(".t3js-extensionScanner-extension-body-loc").empty().text(e+l.effectiveCodeLines),l.isFileIgnored){const e=parseInt(s.find(".t3js-extensionScanner-extension-body-ignored-files").text(),10);s.find(".t3js-extensionScanner-extension-body-ignored-files").empty().text(e+1)}const n=parseInt(s.find(".t3js-extensionScanner-extension-body-ignored-lines").text(),10);s.find(".t3js-extensionScanner-extension-body-ignored-lines").empty().text(n+l.ignoredLines)}o===n&&(i||s.addClass("panel-success"),s.addClass("t3js-extensionscan-finished"),this.setProgressForAll(),s.find(".t3js-extensionScanner-scan-single").text("Rescan").attr("disabled",null))},onrejected:t=>{o+=1,this.setStatusMessageForScan(e,o,n),this.setProgressForScan(e,o,n),this.setProgressForAll(),console.error(t)}})})}else Notification.error("Oops, an error occurred","Please look at the browser console output for details"),console.error(a)},e=>{Router.handleAjaxError(e,t)})}}export default new ExtensionScanner; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/tca-ext-tables-check.js b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/tca-ext-tables-check.js new file mode 100644 index 0000000000000000000000000000000000000000..901e250f8fef03f950ad39ac35301b5778730f2f --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/tca-ext-tables-check.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class TcaExtTablesCheck extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorCheckTrigger=".t3js-tcaExtTablesCheck-check",this.selectorOutputContainer=".t3js-tcaExtTablesCheck-output"}initialize(e){this.currentModal=e,this.check(),e.on("click",this.selectorCheckTrigger,e=>{e.preventDefault(),this.check()})}check(){this.setModalButtonsState(!1);const e=this.getModalBody(),t=$(this.selectorOutputContainer),o=ProgressBar.render(Severity.loading,"Loading...","");t.empty().html(o),new AjaxRequest(Router.getUrl("tcaExtTablesCheck")).get({cache:"no-cache"}).then(async o=>{const r=await o.resolve();if(e.empty().append(r.html),Modal.setButtons(r.buttons),!0===r.success&&Array.isArray(r.status))if(r.status.length>0){const o=InfoBox.render(Severity.warning,"Following extensions change TCA in ext_tables.php","Check ext_tables.php files, look for ExtensionManagementUtility calls and $GLOBALS['TCA'] modifications");e.find(this.selectorOutputContainer).append(o),r.status.forEach(o=>{const r=InfoBox.render(o.severity,o.title,o.message);t.append(r),e.append(r)})}else{const t=InfoBox.render(Severity.ok,"No TCA changes in ext_tables.php files. Good job!","");e.find(this.selectorOutputContainer).append(t)}else Notification.error("Something went wrong",'Please use the module "Check for broken extensions" to find a possible extension causing this issue.')},t=>{Router.handleAjaxError(t,e)})}}export default new TcaExtTablesCheck; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/tca-migrations-check.js b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/tca-migrations-check.js new file mode 100644 index 0000000000000000000000000000000000000000..40ec1ce5693edc499dbd9687c603753e01b01f8e --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/tca-migrations-check.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Modal from"@typo3/backend/modal.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import FlashMessage from"@typo3/install/renderable/flash-message.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class TcaMigrationsCheck extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorCheckTrigger=".t3js-tcaMigrationsCheck-check",this.selectorOutputContainer=".t3js-tcaMigrationsCheck-output"}initialize(e){this.currentModal=e,this.check(),e.on("click",this.selectorCheckTrigger,e=>{e.preventDefault(),this.check()})}check(){this.setModalButtonsState(!1);const e=$(this.selectorOutputContainer),t=this.getModalBody(),r=ProgressBar.render(Severity.loading,"Loading...","");e.empty().html(r),new AjaxRequest(Router.getUrl("tcaMigrationsCheck")).get({cache:"no-cache"}).then(async e=>{const r=await e.resolve();if(t.empty().append(r.html),Modal.setButtons(r.buttons),!0===r.success&&Array.isArray(r.status))if(r.status.length>0){const e=InfoBox.render(Severity.warning,"TCA migrations need to be applied","Check the following list and apply needed changes.");t.find(this.selectorOutputContainer).empty(),t.find(this.selectorOutputContainer).append(e),r.status.forEach(e=>{const r=InfoBox.render(e.severity,e.title,e.message);t.find(this.selectorOutputContainer).append(r)})}else{const e=InfoBox.render(Severity.ok,"No TCA migrations need to be applied","Your TCA looks good.");t.find(this.selectorOutputContainer).append(e)}else{const e=FlashMessage.render(Severity.error,"Something went wrong",'Use "Check for broken extensions"');t.find(this.selectorOutputContainer).append(e)}},e=>{Router.handleAjaxError(e,t)})}}export default new TcaMigrationsCheck; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/upgrade-docs.js b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/upgrade-docs.js new file mode 100644 index 0000000000000000000000000000000000000000..fc8d59c065d72a009c603dc4f4b8e5cf954792d6 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/upgrade-docs.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import"@typo3/install/renderable/clearable.js";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{topLevelModuleImport}from"@typo3/backend/utility/top-level-module-import.js";import Router from"@typo3/install/router.js";import DebounceEvent from"@typo3/core/event/debounce-event.js";class UpgradeDocs extends AbstractInteractableModule{constructor(){super(...arguments),this.selectorFulltextSearch=".t3js-upgradeDocs-fulltext-search",this.selectorChosenField=".t3js-upgradeDocs-chosen-select",this.selectorChangeLogsForVersionContainer=".t3js-version-changes",this.selectorChangeLogsForVersion=".t3js-changelog-list",this.selectorUpgradeDoc=".t3js-upgrade-doc"}static trimExplodeAndUnique(e,t){const s=[],o=t.split(e);for(let e=0;e<o.length;e++){const t=o[e].trim();t.length>0&&-1===$.inArray(t,s)&&s.push(t)}return s}initialize(e){this.currentModal=e;window.location!==window.parent.location?topLevelModuleImport("@typo3/install/chosen.jquery.min.js").then(()=>{this.getContent()}):import("@typo3/install/chosen.jquery.min.js").then(()=>{this.getContent()}),e.on("click",".t3js-upgradeDocs-markRead",e=>{this.markRead(e.target)}),e.on("click",".t3js-upgradeDocs-unmarkRead",e=>{this.unmarkRead(e.target)}),$.expr[":"].contains=$.expr.createPseudo(e=>t=>$(t).text().toUpperCase().includes(e.toUpperCase()))}getContent(){const e=this.getModalBody();e.on("show.bs.collapse",this.selectorUpgradeDoc,e=>{this.renderTags($(e.currentTarget))}),new AjaxRequest(Router.getUrl("upgradeDocsGetContent")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success&&"undefined"!==s.html&&s.html.length>0&&(e.empty().append(s.html),this.initializeFullTextSearch(),this.initializeChosenSelector(),this.loadChangelogs())},t=>{Router.handleAjaxError(t,e)})}loadChangelogs(){const e=[],t=this.getModalBody();this.findInModal(this.selectorChangeLogsForVersionContainer).each((s,o)=>{const a=new AjaxRequest(Router.getUrl("upgradeDocsGetChangelogForVersion")).withQueryArguments({install:{version:o.dataset.version}}).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();if(!0===t.success){const e=$(o),s=e.find(this.selectorChangeLogsForVersion);s.html(t.html),this.moveNotRelevantDocuments(s),e.find(".t3js-panel-loading").remove()}else Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)});e.push(a)}),Promise.all(e).then(()=>{this.fulltextSearchField.prop("disabled",!1),this.appendItemsToChosenSelector()})}initializeFullTextSearch(){this.fulltextSearchField=this.findInModal(this.selectorFulltextSearch);const e=this.fulltextSearchField.get(0);e.clearable({onClear:()=>{this.combinedFilterSearch()}}),e.focus(),this.initializeChosenSelector(),new DebounceEvent("keyup",()=>{this.combinedFilterSearch()}).bindTo(e)}initializeChosenSelector(){this.chosenField=this.getModalBody().find(this.selectorChosenField);const e={".chosen-select":{width:"100%",placeholder_text_multiple:"tags"},".chosen-select-deselect":{allow_single_deselect:!0},".chosen-select-no-single":{disable_search_threshold:10},".chosen-select-no-results":{no_results_text:"Oops, nothing found!"},".chosen-select-width":{width:"100%"}};for(const t in e)e.hasOwnProperty(t)&&this.findInModal(t).chosen(e[t]);this.chosenField.on("change",()=>{this.combinedFilterSearch()})}appendItemsToChosenSelector(){let e="";$(this.findInModal(this.selectorUpgradeDoc)).each((t,s)=>{e+=$(s).data("item-tags")+","});const t=UpgradeDocs.trimExplodeAndUnique(",",e).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()));this.chosenField.prop("disabled",!1),$.each(t,(e,t)=>{this.chosenField.append($("<option>").text(t))}),this.chosenField.trigger("chosen:updated")}combinedFilterSearch(){const e=this.getModalBody(),t=e.find("div.item");if(this.chosenField.val().length<1&&this.fulltextSearchField.val().length<1)return this.currentModal.find(".panel-version .panel-collapse.show").collapse("hide"),t.removeClass("hidden searchhit filterhit"),!1;if(t.addClass("hidden").removeClass("searchhit filterhit"),this.chosenField.val().length>0){t.addClass("hidden").removeClass("filterhit");const s=[],o=[];$.each(this.chosenField.val(),(e,t)=>{const a='[data-item-tags*="'+t+'"]';t.includes(":",1)?s.push(a):o.push(a)});const a=o.join(""),n=[];if(s.length)for(let e of s)n.push(a+e);else n.push(a);const i=n.join(",");e.find(i).removeClass("hidden").addClass("searchhit filterhit")}else t.addClass("filterhit").removeClass("hidden");const s=this.fulltextSearchField.val();return e.find("div.item.filterhit").each((e,t)=>{const o=$(t);$(":contains("+s+")",o).length>0||$('input[value*="'+s+'"]',o).length>0?o.removeClass("hidden").addClass("searchhit"):o.removeClass("searchhit").addClass("hidden")}),e.find(".searchhit").closest(".panel-collapse").collapse("show"),e.find(".panel-version").each((e,t)=>{const s=$(t);s.find(".searchhit",".filterhit").length<1&&s.find(" > .panel-collapse").collapse("hide")}),!0}renderTags(e){const t=e.find(".t3js-tags");if(0===t.children().length){e.data("item-tags").split(",").forEach(e=>{t.append($("<span />",{class:"label"}).text(e))})}}moveNotRelevantDocuments(e){e.find('[data-item-state="read"]').appendTo(this.findInModal(".panel-body-read")),e.find('[data-item-state="notAffected"]').appendTo(this.findInModal(".panel-body-not-affected"))}markRead(e){const t=this.getModalBody(),s=this.getModuleContent().data("upgrade-docs-mark-read-token"),o=$(e).closest("button");o.toggleClass("t3js-upgradeDocs-unmarkRead t3js-upgradeDocs-markRead"),o.find("i").toggleClass("fa-check fa-ban"),o.closest(".panel").appendTo(this.findInModal(".panel-body-read")),new AjaxRequest(Router.getUrl()).post({install:{ignoreFile:o.data("filepath"),token:s,action:"upgradeDocsMarkRead"}}).catch(e=>{Router.handleAjaxError(e,t)})}unmarkRead(e){const t=this.getModalBody(),s=this.getModuleContent().data("upgrade-docs-unmark-read-token"),o=$(e).closest("button"),a=o.closest(".panel").data("item-version");o.toggleClass("t3js-upgradeDocs-markRead t3js-upgradeDocs-unmarkRead"),o.find("i").toggleClass("fa-check fa-ban"),o.closest(".panel").appendTo(this.findInModal('*[data-group-version="'+a+'"] .panel-body')),new AjaxRequest(Router.getUrl()).post({install:{ignoreFile:o.data("filepath"),token:s,action:"upgradeDocsUnmarkRead"}}).catch(e=>{Router.handleAjaxError(e,t)})}}export default new UpgradeDocs; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/upgrade-wizards.js b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/upgrade-wizards.js new file mode 100644 index 0000000000000000000000000000000000000000..7bf17df345cbb1932e25a02a65ea21f9641771d5 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/module/upgrade/upgrade-wizards.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"bootstrap";import $ from"jquery";import{AbstractInteractableModule}from"@typo3/install/module/abstract-interactable-module.js";import Notification from"@typo3/backend/notification.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import SecurityUtility from"@typo3/core/security-utility.js";import FlashMessage from"@typo3/install/renderable/flash-message.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";import Router from"@typo3/install/router.js";class UpgradeWizards extends AbstractInteractableModule{constructor(){super(),this.selectorOutputWizardsContainer=".t3js-upgradeWizards-wizards-output",this.selectorOutputDoneContainer=".t3js-upgradeWizards-done-output",this.selectorWizardsBlockingAddsTemplate=".t3js-upgradeWizards-blocking-adds-template",this.selectorWizardsBlockingAddsRows=".t3js-upgradeWizards-blocking-adds-rows",this.selectorWizardsBlockingAddsExecute=".t3js-upgradeWizards-blocking-adds-execute",this.selectorWizardsBlockingCharsetTemplate=".t3js-upgradeWizards-blocking-charset-template",this.selectorWizardsBlockingCharsetFix=".t3js-upgradeWizards-blocking-charset-fix",this.selectorWizardsDoneBodyTemplate=".t3js-upgradeWizards-done-body-template",this.selectorWizardsDoneRows=".t3js-upgradeWizards-done-rows",this.selectorWizardsDoneRowTemplate=".t3js-upgradeWizards-done-row-template table tr",this.selectorWizardsDoneRowMarkUndone=".t3js-upgradeWizards-done-markUndone",this.selectorWizardsDoneRowTitle=".t3js-upgradeWizards-done-title",this.selectorWizardsListTemplate=".t3js-upgradeWizards-list-template",this.selectorWizardsListRows=".t3js-upgradeWizards-list-rows",this.selectorWizardsListRowTemplate=".t3js-upgradeWizards-list-row-template",this.selectorWizardsListRowTitle=".t3js-upgradeWizards-list-row-title",this.selectorWizardsListRowExplanation=".t3js-upgradeWizards-list-row-explanation",this.selectorWizardsListRowExecute=".t3js-upgradeWizards-list-row-execute",this.selectorWizardsInputTemplate=".t3js-upgradeWizards-input",this.selectorWizardsInputTitle=".t3js-upgradeWizards-input-title",this.selectorWizardsInputDescription=".t3js-upgradeWizards-input-description",this.selectorWizardsInputHtml=".t3js-upgradeWizards-input-html",this.selectorWizardsInputPerform=".t3js-upgradeWizards-input-perform",this.selectorWizardsInputAbort=".t3js-upgradeWizards-input-abort",this.securityUtility=new SecurityUtility}static removeLoadingMessage(e){e.find(".alert-loading").remove()}static renderProgressBar(e){return ProgressBar.render(Severity.loading,e,"")}initialize(e){this.currentModal=e,this.getData().then(()=>{this.doneUpgrades()}),e.on("click",this.selectorWizardsDoneRowMarkUndone,e=>{this.markUndone(e.target.dataset.identifier)}),e.on("click",this.selectorWizardsBlockingCharsetFix,()=>{this.blockingUpgradesDatabaseCharsetFix()}),e.on("click",this.selectorWizardsBlockingAddsExecute,()=>{this.blockingUpgradesDatabaseAddsExecute()}),e.on("click",this.selectorWizardsListRowExecute,e=>{this.wizardInput(e.target.dataset.identifier,e.target.dataset.title)}),e.on("click",this.selectorWizardsInputPerform,e=>{this.wizardExecute(e.target.dataset.identifier,e.target.dataset.title)}),e.on("click",this.selectorWizardsInputAbort,e=>{this.findInModal(this.selectorOutputWizardsContainer).empty(),this.wizardsList()})}getData(){const e=this.getModalBody();return new AjaxRequest(Router.getUrl("upgradeWizardsGetData")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();!0===s.success?(e.empty().append(s.html),this.blockingUpgradesDatabaseCharsetTest()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e)})}blockingUpgradesDatabaseCharsetTest(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.empty().html(UpgradeWizards.renderProgressBar("Checking database charset...")),new AjaxRequest(Router.getUrl("upgradeWizardsBlockingDatabaseCharsetTest")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();UpgradeWizards.removeLoadingMessage(t),!0===r.success&&(!0===r.needsUpdate?e.find(this.selectorOutputWizardsContainer).append(e.find(this.selectorWizardsBlockingCharsetTemplate)).clone():this.blockingUpgradesDatabaseAdds())},e=>{Router.handleAjaxError(e,t)})}blockingUpgradesDatabaseCharsetFix(){const e=$(this.selectorOutputWizardsContainer);e.empty().html(UpgradeWizards.renderProgressBar("Setting database charset to UTF-8...")),new AjaxRequest(Router.getUrl("upgradeWizardsBlockingDatabaseCharsetFix")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();if(UpgradeWizards.removeLoadingMessage(e),!0===s.success)Array.isArray(s.status)&&s.status.length>0&&s.status.forEach(t=>{const s=InfoBox.render(t.severity,t.title,t.message);e.append(s)});else{const t=FlashMessage.render(Severity.error,"Something went wrong","");UpgradeWizards.removeLoadingMessage(e),e.append(t)}},t=>{Router.handleAjaxError(t,e)})}blockingUpgradesDatabaseAdds(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.empty().html(UpgradeWizards.renderProgressBar("Check for missing mandatory database tables and fields...")),new AjaxRequest(Router.getUrl("upgradeWizardsBlockingDatabaseAdds")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();if(UpgradeWizards.removeLoadingMessage(t),!0===r.success)if(!0===r.needsUpdate){const t=e.find(this.selectorWizardsBlockingAddsTemplate).clone();"object"==typeof r.adds.tables&&r.adds.tables.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),"object"==typeof r.adds.columns&&r.adds.columns.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table)+", Field: "+this.securityUtility.encodeHtml(e.field);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),"object"==typeof r.adds.indexes&&r.adds.indexes.forEach(e=>{const s="Table: "+this.securityUtility.encodeHtml(e.table)+", Index: "+this.securityUtility.encodeHtml(e.index);t.find(this.selectorWizardsBlockingAddsRows).append(s,"<br>")}),e.find(this.selectorOutputWizardsContainer).append(t)}else this.wizardsList();else Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e)})}blockingUpgradesDatabaseAddsExecute(){const e=this.findInModal(this.selectorOutputWizardsContainer);e.empty().html(UpgradeWizards.renderProgressBar("Adding database tables and fields...")),new AjaxRequest(Router.getUrl("upgradeWizardsBlockingDatabaseExecute")).get({cache:"no-cache"}).then(async t=>{const s=await t.resolve();if(UpgradeWizards.removeLoadingMessage(e),Array.isArray(s.status)&&s.status.length>0&&s.status.forEach(t=>{const s=InfoBox.render(t.severity,t.title,t.message);e.append(s)}),!0===s.success)this.wizardsList();else if(Array.isArray(s.status)&&0!==s.status.length){const t=$('<div class="btn-toolbar mt-3 mb-4"></div>'),s=$('<button class="btn btn-default">Retry database migration</button>'),r=$('<button class="btn btn-danger">Proceed despite of errors</button>');s.click(()=>{this.blockingUpgradesDatabaseAddsExecute()}),r.click(()=>{t.remove(),this.wizardsList()}),t.append(s),t.append(r),e.append(t)}else{const t=FlashMessage.render(Severity.error,"Something went wrong","");e.append(t)}},t=>{Router.handleAjaxError(t,e)})}wizardsList(){const e=this.getModalBody(),t=this.findInModal(this.selectorOutputWizardsContainer);t.append(UpgradeWizards.renderProgressBar("Loading upgrade wizards...")),new AjaxRequest(Router.getUrl("upgradeWizardsList")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();UpgradeWizards.removeLoadingMessage(t);const a=e.find(this.selectorWizardsListTemplate).clone();if(a.removeClass("t3js-upgradeWizards-list-template"),!0===r.success){let t=0,s=0;Array.isArray(r.wizards)&&r.wizards.length>0&&(s=r.wizards.length,r.wizards.forEach(s=>{if(!0===s.shouldRenderWizard){const r=e.find(this.selectorWizardsListRowTemplate).clone();t+=1,r.removeClass("t3js-upgradeWizards-list-row-template"),r.find(this.selectorWizardsListRowTitle).empty().text(s.title),r.find(this.selectorWizardsListRowExplanation).empty().text(s.explanation),r.find(this.selectorWizardsListRowExecute).attr("data-identifier",s.identifier).attr("data-title",s.title),a.find(this.selectorWizardsListRows).append(r)}}),a.find(this.selectorWizardsListRows+" hr:last").remove());let i=100;const o=a.find(".progress-bar");t>0?i=Math.round((s-t)/r.wizards.length*100):o.removeClass("progress-bar-info").addClass("progress-bar-success"),o.removeClass("progress-bar-striped").css("width",i+"%").attr("aria-valuenow",i).find("span").text(i+"%"),e.find(this.selectorOutputWizardsContainer).append(a),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!1)}else Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e)})}wizardInput(e,t){const s=this.getModuleContent().data("upgrade-wizards-input-token"),r=this.getModalBody(),a=this.findInModal(this.selectorOutputWizardsContainer);a.empty().html(UpgradeWizards.renderProgressBar('Loading "'+t+'"...')),r.animate({scrollTop:r.scrollTop()-Math.abs(r.find(".t3js-upgrade-status-section").position().top)},250),new AjaxRequest(Router.getUrl("upgradeWizardsInput")).post({install:{action:"upgradeWizardsInput",token:s,identifier:e}}).then(async e=>{const t=await e.resolve();a.empty();const s=r.find(this.selectorWizardsInputTemplate).clone();s.removeClass("t3js-upgradeWizards-input"),!0===t.success&&(Array.isArray(t.status)&&t.status.forEach(e=>{const t=FlashMessage.render(e.severity,e.title,e.message);a.append(t)}),t.userInput.wizardHtml.length>0&&s.find(this.selectorWizardsInputHtml).html(t.userInput.wizardHtml),s.find(this.selectorWizardsInputTitle).text(t.userInput.title),s.find(this.selectorWizardsInputDescription).html(this.securityUtility.stripHtml(t.userInput.description).replace(/\n/g,"<br>")),s.find(this.selectorWizardsInputPerform).attr("data-identifier",t.userInput.identifier).attr("data-title",t.userInput.title)),r.find(this.selectorOutputWizardsContainer).append(s)},e=>{Router.handleAjaxError(e,a)})}wizardExecute(e,t){const s=this.getModuleContent().data("upgrade-wizards-execute-token"),r=this.getModalBody(),a={"install[action]":"upgradeWizardsExecute","install[token]":s,"install[identifier]":e};$(this.findInModal(this.selectorOutputWizardsContainer+" form").serializeArray()).each((e,t)=>{a[t.name]=t.value});const i=this.findInModal(this.selectorOutputWizardsContainer);i.empty().html(UpgradeWizards.renderProgressBar('Executing "'+t+'"...')),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!0),new AjaxRequest(Router.getUrl()).post(a).then(async e=>{const t=await e.resolve();i.empty(),!0===t.success?(Array.isArray(t.status)&&t.status.forEach(e=>{const t=InfoBox.render(e.severity,e.title,e.message);i.append(t)}),this.wizardsList(),r.find(this.selectorOutputDoneContainer).empty(),this.doneUpgrades()):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,i)})}doneUpgrades(){const e=this.getModalBody(),t=e.find(this.selectorOutputDoneContainer);t.empty().html(UpgradeWizards.renderProgressBar("Loading executed upgrade wizards...")),new AjaxRequest(Router.getUrl("upgradeWizardsDoneUpgrades")).get({cache:"no-cache"}).then(async s=>{const r=await s.resolve();if(UpgradeWizards.removeLoadingMessage(t),!0===r.success){Array.isArray(r.status)&&r.status.length>0&&r.status.forEach(e=>{const s=InfoBox.render(e.severity,e.title,e.message);t.append(s)});const s=e.find(this.selectorWizardsDoneBodyTemplate).clone(),a=s.find(this.selectorWizardsDoneRows);let i=!1;Array.isArray(r.wizardsDone)&&r.wizardsDone.length>0&&r.wizardsDone.forEach(t=>{i=!0;const s=e.find(this.selectorWizardsDoneRowTemplate).clone();s.find(this.selectorWizardsDoneRowMarkUndone).attr("data-identifier",t.identifier),s.find(this.selectorWizardsDoneRowTitle).text(t.title),a.append(s)}),Array.isArray(r.rowUpdatersDone)&&r.rowUpdatersDone.length>0&&r.rowUpdatersDone.forEach(t=>{i=!0;const s=e.find(this.selectorWizardsDoneRowTemplate).clone();s.find(this.selectorWizardsDoneRowMarkUndone).attr("data-identifier",t.identifier),s.find(this.selectorWizardsDoneRowTitle).text(t.title),a.append(s)}),i&&(e.find(this.selectorOutputDoneContainer).append(s),this.findInModal(this.selectorWizardsDoneRowMarkUndone).prop("disabled",!0))}else Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,t)})}markUndone(e){const t=this.getModuleContent().data("upgrade-wizards-mark-undone-token"),s=this.getModalBody(),r=this.findInModal(this.selectorOutputDoneContainer);r.empty().html(UpgradeWizards.renderProgressBar("Marking upgrade wizard as undone...")),new AjaxRequest(Router.getUrl()).post({install:{action:"upgradeWizardsMarkUndone",token:t,identifier:e}}).then(async e=>{const t=await e.resolve();r.empty(),s.find(this.selectorOutputDoneContainer).empty(),!0===t.success&&Array.isArray(t.status)?t.status.forEach(e=>{Notification.success(e.title,e.message),this.doneUpgrades(),this.blockingUpgradesDatabaseCharsetTest()}):Notification.error("Something went wrong","The request was not processed successfully. Please check the browser's console and TYPO3's log.")},e=>{Router.handleAjaxError(e,r)})}}export default new UpgradeWizards; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Renderable/Clearable.js b/typo3/sysext/install/Resources/Public/JavaScript/renderable/clearable.js similarity index 100% rename from typo3/sysext/install/Resources/Public/JavaScript/Renderable/Clearable.js rename to typo3/sysext/install/Resources/Public/JavaScript/renderable/clearable.js diff --git a/typo3/sysext/install/Resources/Public/JavaScript/renderable/flash-message.js b/typo3/sysext/install/Resources/Public/JavaScript/renderable/flash-message.js new file mode 100644 index 0000000000000000000000000000000000000000..f472d90a42dc7b2ba313bbf48079cc1fcb2b9c4a --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/renderable/flash-message.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Severity from"@typo3/install/renderable/severity.js";class FlashMessage{constructor(){this.template=$('<div class="t3js-message typo3-message alert"><h4></h4><p class="messageText"></p></div>')}render(e,s,t){let a=this.template.clone();return a.addClass("alert-"+Severity.getCssClass(e)),s&&a.find("h4").text(s),t?a.find(".messageText").text(t):a.find(".messageText").remove(),a}}export default new FlashMessage; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/renderable/info-box.js b/typo3/sysext/install/Resources/Public/JavaScript/renderable/info-box.js new file mode 100644 index 0000000000000000000000000000000000000000..a70bfaefb79689fd741edab059a9b1861225fb4a --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/renderable/info-box.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Severity from"@typo3/install/renderable/severity.js";class InfoBox{constructor(){this.template=$('<div class="t3js-infobox callout callout-sm"><h4 class="callout-title"></h4><div class="callout-body"></div></div>')}render(t,l,e){let o=this.template.clone();return o.addClass("callout-"+Severity.getCssClass(t)),l&&o.find("h4").text(l),e?o.find(".callout-body").text(e):o.find(".callout-body").remove(),o}}export default new InfoBox; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/renderable/progress-bar.js b/typo3/sysext/install/Resources/Public/JavaScript/renderable/progress-bar.js new file mode 100644 index 0000000000000000000000000000000000000000..a6039c584309a87107f8940c87ee11a814e56451 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/renderable/progress-bar.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Severity from"@typo3/install/renderable/severity.js";class ProgressBar{constructor(){this.template=$('<div class="progress"><div class="t3js-progressbar progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"> <span></span></div></div>')}render(r,s,e){let a=this.template.clone();return a.addClass("progress-bar-"+Severity.getCssClass(r)),e&&(a.css("width",e+"%"),a.attr("aria-valuenow",e)),s&&a.find("span").text(s),a}}export default new ProgressBar; \ No newline at end of file diff --git a/typo3/sysext/install/Resources/Public/JavaScript/Renderable/Severity.js b/typo3/sysext/install/Resources/Public/JavaScript/renderable/severity.js similarity index 100% rename from typo3/sysext/install/Resources/Public/JavaScript/Renderable/Severity.js rename to typo3/sysext/install/Resources/Public/JavaScript/renderable/severity.js diff --git a/typo3/sysext/install/Resources/Public/JavaScript/router.js b/typo3/sysext/install/Resources/Public/JavaScript/router.js new file mode 100644 index 0000000000000000000000000000000000000000..561c5e467ea04f0b16ee191313eec082dd0f4577 --- /dev/null +++ b/typo3/sysext/install/Resources/Public/JavaScript/router.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Icons from"@typo3/backend/icons.js";import Modal from"@typo3/backend/modal.js";import InfoBox from"@typo3/install/renderable/info-box.js";import ProgressBar from"@typo3/install/renderable/progress-bar.js";import Severity from"@typo3/install/renderable/severity.js";class Router{constructor(){this.selectorBody=".t3js-body",this.selectorMainContent=".t3js-module-body"}initialize(){this.registerInstallToolRoutes(),$(document).on("click",".t3js-login-lockInstallTool",e=>{e.preventDefault(),this.logout()}),$(document).on("click",".t3js-login-login",e=>{e.preventDefault(),this.login()}),$(document).on("keydown","#t3-install-form-password",e=>{"Enter"===e.key&&(e.preventDefault(),$(".t3js-login-login").trigger("click"))}),$(document).on("click",".card .btn",e=>{e.preventDefault();const t=$(e.currentTarget),o=t.data("import"),a=t.data("inline");if(void 0!==a&&1===parseInt(a,10))import(o).then(({default:e})=>{e.initialize(t)});else{const e=t.closest(".card").find(".card-title").html(),a=t.data("modalSize")||Modal.sizes.large,n=Modal.advanced({type:Modal.types.default,title:e,size:a,content:$('<div class="modal-loading">'),additionalCssClasses:["install-tool-modal"],callback:e=>{import(o).then(({default:t})=>{t.initialize(e)})}});Icons.getIcon("spinner-circle",Icons.sizes.default,null,null,Icons.markupIdentifiers.inline).then(e=>{n.find(".modal-loading").append(e)})}});"backend"===$(this.selectorBody).data("context")?this.executeSilentConfigurationUpdate():this.preAccessCheck()}registerInstallToolRoutes(){void 0===TYPO3.settings&&(TYPO3.settings={ajaxUrls:{icons:window.location.origin+window.location.pathname+"?install[controller]=icon&install[action]=getIcon",icons_cache:window.location.origin+window.location.pathname+"?install[controller]=icon&install[action]=getCacheIdentifier"}})}getUrl(e,t,o){const a=$(this.selectorBody).data("context");let n=location.href;return n=n.replace(location.search,""),void 0===t&&(t=$(this.selectorBody).data("controller")),n=n+"?install[controller]="+t,void 0!==a&&""!==a&&(n=n+"&install[context]="+a),void 0!==e&&(n=n+"&install[action]="+e),void 0!==o&&(n=n+"&"+o),n}executeSilentConfigurationUpdate(){this.updateLoadingInfo("Checking session and executing silent configuration update"),new AjaxRequest(this.getUrl("executeSilentConfigurationUpdate","layout")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.executeSilentTemplateFileUpdate():this.executeSilentConfigurationUpdate()},e=>{this.handleAjaxError(e)})}executeSilentTemplateFileUpdate(){this.updateLoadingInfo("Checking session and executing silent template file update"),new AjaxRequest(this.getUrl("executeSilentTemplateFileUpdate","layout")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.executeSilentExtensionConfigurationSynchronization():this.executeSilentTemplateFileUpdate()},e=>{this.handleAjaxError(e)})}executeSilentExtensionConfigurationSynchronization(){const e=$(this.selectorBody);this.updateLoadingInfo("Executing silent extension configuration synchronization"),new AjaxRequest(this.getUrl("executeSilentExtensionConfigurationSynchronization","layout")).get({cache:"no-cache"}).then(async t=>{if(!0===(await t.resolve()).success)this.loadMainLayout();else{const t=InfoBox.render(Severity.error,"Something went wrong","");e.empty().append(t)}},e=>{this.handleAjaxError(e)})}loadMainLayout(){const e=$(this.selectorBody),t=e.data("controller");this.updateLoadingInfo("Loading main layout"),new AjaxRequest(this.getUrl("mainLayout","layout","install[module]="+t)).get({cache:"no-cache"}).then(async o=>{const a=await o.resolve();if(!0===a.success&&"undefined"!==a.html&&a.html.length>0)e.empty().append(a.html),"backend"!==$(this.selectorBody).data("context")&&e.find('.t3js-modulemenu-action[data-controller="'+t+'"]').addClass("modulemenu-action-active"),this.loadCards();else{const t=InfoBox.render(Severity.error,"Something went wrong","");e.empty().append(t)}},e=>{this.handleAjaxError(e)})}async handleAjaxError(e,t){let o;if(403===e.response.status){"backend"===$(this.selectorBody).data("context")?(o=InfoBox.render(Severity.error,"The install tool session expired. Please reload the backend and try again."),$(this.selectorBody).empty().append(o)):this.checkEnableInstallToolFile()}else{const a=this.getUrl(void 0,"upgrade");o=$('<div class="t3js-infobox callout callout-sm callout-danger"><div class="callout-body"><p>Something went wrong. Please use <b><a href="'+a+'">Check for broken extensions</a></b> to see if a loaded extension breaks this part of the install tool and unload it.</p><p>The box below may additionally reveal further details on what went wrong depending on your debug settings. It may help to temporarily switch to debug mode using <b>Settings > Configuration Presets > Debug settings.</b></p><p>If this error happens at an early state and no full exception back trace is shown, it may also help to manually increase debugging output in <code>typo3conf/LocalConfiguration.php</code>:<code>[\'BE\'][\'debug\'] => true</code>, <code>[\'SYS\'][\'devIPmask\'] => \'*\'</code>, <code>[\'SYS\'][\'displayErrors\'] => 1</code>,<code>[\'SYS\'][\'exceptionalErrors\'] => 12290</code></p></div></div><div class="panel-group" role="tablist" aria-multiselectable="true"><div class="panel panel-default panel-flat searchhit"><div class="panel-heading" role="tab" id="heading-error"><h3 class="panel-title"><a role="button" data-bs-toggle="collapse" data-bs-parent="#accordion" href="#collapse-error" aria-expanded="true" aria-controls="collapse-error" class="collapsed"><span class="caret"></span><strong>Ajax error</strong></a></h3></div><div id="collapse-error" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-error"><div class="panel-body">'+await e.response.text()+"</div></div></div></div>"),void 0!==t?$(t).empty().html(o):$(this.selectorBody).empty().html(o)}}checkEnableInstallToolFile(){new AjaxRequest(this.getUrl("checkEnableInstallToolFile")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.checkLogin():this.showEnableInstallTool()},e=>{this.handleAjaxError(e)})}showEnableInstallTool(){new AjaxRequest(this.getUrl("showEnableInstallToolFile")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();!0===t.success&&$(this.selectorBody).empty().append(t.html)},e=>{this.handleAjaxError(e)})}checkLogin(){new AjaxRequest(this.getUrl("checkLogin")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success?this.loadMainLayout():this.showLogin()},e=>{this.handleAjaxError(e)})}showLogin(){new AjaxRequest(this.getUrl("showLogin")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();!0===t.success&&$(this.selectorBody).empty().append(t.html)},e=>{this.handleAjaxError(e)})}login(){const e=$(".t3js-login-output"),t=ProgressBar.render(Severity.loading,"Loading...","");e.empty().html(t),new AjaxRequest(this.getUrl()).post({install:{action:"login",token:$("[data-login-token]").data("login-token"),password:$(".t3-install-form-input-text").val()}}).then(async t=>{const o=await t.resolve();!0===o.success?this.executeSilentConfigurationUpdate():o.status.forEach(t=>{const o=InfoBox.render(t.severity,t.title,t.message);e.empty().html(o)})},e=>{this.handleAjaxError(e)})}logout(){new AjaxRequest(this.getUrl("logout")).get({cache:"no-cache"}).then(async e=>{!0===(await e.resolve()).success&&this.showEnableInstallTool()},e=>{this.handleAjaxError(e)})}loadCards(){const e=$(this.selectorMainContent);new AjaxRequest(this.getUrl("cards")).get({cache:"no-cache"}).then(async t=>{const o=await t.resolve();if(!0===o.success&&"undefined"!==o.html&&o.html.length>0)e.empty().append(o.html);else{const t=InfoBox.render(Severity.error,"Something went wrong","");e.empty().append(t)}},e=>{this.handleAjaxError(e)})}updateLoadingInfo(e){$(this.selectorBody).find("#t3js-ui-block-detail").text(e)}preAccessCheck(){this.updateLoadingInfo("Execute pre access check"),new AjaxRequest(this.getUrl("preAccessCheck","layout")).get({cache:"no-cache"}).then(async e=>{const t=await e.resolve();t.installToolLocked?this.checkEnableInstallToolFile():t.isAuthorized?this.executeSilentConfigurationUpdate():this.showLogin()},e=>{this.handleAjaxError(e)})}}export default new Router; \ No newline at end of file diff --git a/typo3/sysext/linkvalidator/Configuration/JavaScriptModules.php b/typo3/sysext/linkvalidator/Configuration/JavaScriptModules.php index c089c26e0e7c468562418807a7daeff2b828473b..5a4ed0531dce6301f4dfc44cd4dbae9533bf8941 100644 --- a/typo3/sysext/linkvalidator/Configuration/JavaScriptModules.php +++ b/typo3/sysext/linkvalidator/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Linkvalidator/' => 'EXT:linkvalidator/Resources/Public/JavaScript/', + '@typo3/linkvalidator/' => 'EXT:linkvalidator/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/linkvalidator/Resources/Private/Templates/Backend/CheckLinks.html b/typo3/sysext/linkvalidator/Resources/Private/Templates/Backend/CheckLinks.html index 7a3d364908d5fa7934e3720f1f18e25e9b16376e..4674a77e1de74fed268ec3b3dec5fd673ca2ec0b 100644 --- a/typo3/sysext/linkvalidator/Resources/Private/Templates/Backend/CheckLinks.html +++ b/typo3/sysext/linkvalidator/Resources/Private/Templates/Backend/CheckLinks.html @@ -7,7 +7,7 @@ <f:section name="Content"> - <f:be.pageRenderer includeJavaScriptModules="{0: 'TYPO3/CMS/Linkvalidator/Linkvalidator.js'}"/> + <f:be.pageRenderer includeJavaScriptModules="{0: '@typo3/linkvalidator/linkvalidator.js'}"/> <form method="post" id="linkValidatorReportController"> <div id="linkvalidator-modfuncreport"> diff --git a/typo3/sysext/linkvalidator/Resources/Private/Templates/Backend/Report.html b/typo3/sysext/linkvalidator/Resources/Private/Templates/Backend/Report.html index a1eaded67234e00c3f2773c11fb699d1bdbcae39..48e31893a10488dd5d3436e598c99ed46411c645 100644 --- a/typo3/sysext/linkvalidator/Resources/Private/Templates/Backend/Report.html +++ b/typo3/sysext/linkvalidator/Resources/Private/Templates/Backend/Report.html @@ -7,7 +7,7 @@ <f:section name="Content"> - <f:be.pageRenderer includeJavaScriptModules="{0: 'TYPO3/CMS/Linkvalidator/Linkvalidator.js'}"/> + <f:be.pageRenderer includeJavaScriptModules="{0: '@typo3/linkvalidator/linkvalidator.js'}"/> <form method="post" id="linkValidatorReportController"> <div id="linkvalidator-modfuncreport"> diff --git a/typo3/sysext/linkvalidator/Resources/Public/JavaScript/Linkvalidator.js b/typo3/sysext/linkvalidator/Resources/Public/JavaScript/Linkvalidator.js deleted file mode 100644 index 7409126b2e540820e67955b86b27ec6e5c7adf76..0000000000000000000000000000000000000000 --- a/typo3/sysext/linkvalidator/Resources/Public/JavaScript/Linkvalidator.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Notification from"TYPO3/CMS/Backend/Notification.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var Selectors;!function(t){t.settingsContainerSelector=".t3js-linkvalidator-settings",t.actionButtonSelector=".t3js-linkvalidator-action-button"}(Selectors||(Selectors={}));class Linkvalidator{static toggleActionButtons(t){t.querySelector(Selectors.actionButtonSelector)?.toggleAttribute("disabled",!t.querySelectorAll('input[type="checkbox"]:checked').length)}constructor(){this.initializeEvents(),document.querySelectorAll(Selectors.settingsContainerSelector).forEach(t=>{Linkvalidator.toggleActionButtons(t)})}initializeEvents(){new RegularEvent("change",(t,e)=>{Linkvalidator.toggleActionButtons(e.closest(Selectors.settingsContainerSelector))}).delegateTo(document,[Selectors.settingsContainerSelector,'input[type="checkbox"]'].join(" ")),new RegularEvent("click",(t,e)=>{Notification.success(e.dataset.notificationMessage||"Event triggered","",2)}).delegateTo(document,Selectors.actionButtonSelector)}}export default new Linkvalidator; \ No newline at end of file diff --git a/typo3/sysext/linkvalidator/Resources/Public/JavaScript/linkvalidator.js b/typo3/sysext/linkvalidator/Resources/Public/JavaScript/linkvalidator.js new file mode 100644 index 0000000000000000000000000000000000000000..4a67c4b4f3bb05199cfa7eac8f6fb524ced6217c --- /dev/null +++ b/typo3/sysext/linkvalidator/Resources/Public/JavaScript/linkvalidator.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Notification from"@typo3/backend/notification.js";import RegularEvent from"@typo3/core/event/regular-event.js";var Selectors;!function(t){t.settingsContainerSelector=".t3js-linkvalidator-settings",t.actionButtonSelector=".t3js-linkvalidator-action-button"}(Selectors||(Selectors={}));class Linkvalidator{static toggleActionButtons(t){t.querySelector(Selectors.actionButtonSelector)?.toggleAttribute("disabled",!t.querySelectorAll('input[type="checkbox"]:checked').length)}constructor(){this.initializeEvents(),document.querySelectorAll(Selectors.settingsContainerSelector).forEach(t=>{Linkvalidator.toggleActionButtons(t)})}initializeEvents(){new RegularEvent("change",(t,e)=>{Linkvalidator.toggleActionButtons(e.closest(Selectors.settingsContainerSelector))}).delegateTo(document,[Selectors.settingsContainerSelector,'input[type="checkbox"]'].join(" ")),new RegularEvent("click",(t,e)=>{Notification.success(e.dataset.notificationMessage||"Event triggered","",2)}).delegateTo(document,Selectors.actionButtonSelector)}}export default new Linkvalidator; \ No newline at end of file diff --git a/typo3/sysext/lowlevel/Configuration/JavaScriptModules.php b/typo3/sysext/lowlevel/Configuration/JavaScriptModules.php index f273fe1c3f86412e70e3383cb3b9ed2f0543c8ab..f2a66e345a275213bc6376a976a0aef39b3b4361 100644 --- a/typo3/sysext/lowlevel/Configuration/JavaScriptModules.php +++ b/typo3/sysext/lowlevel/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Lowlevel/' => 'EXT:lowlevel/Resources/Public/JavaScript/', + '@typo3/lowlevel/' => 'EXT:lowlevel/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/lowlevel/Resources/Private/Templates/Configuration.html b/typo3/sysext/lowlevel/Resources/Private/Templates/Configuration.html index 33c33ff191d214bc8d19e3eafd57622980359fe1..96ed08858fc69ca4e7768af3f8503811762fafd5 100644 --- a/typo3/sysext/lowlevel/Resources/Private/Templates/Configuration.html +++ b/typo3/sysext/lowlevel/Resources/Private/Templates/Configuration.html @@ -10,7 +10,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Lowlevel/ConfigurationView.js' + 0: '@typo3/lowlevel/configuration-view.js' }" /> diff --git a/typo3/sysext/lowlevel/Resources/Private/Templates/CustomSearch.html b/typo3/sysext/lowlevel/Resources/Private/Templates/CustomSearch.html index b95f263d1d0f6e020375f247e19bb60b162c5f7c..c19b0ae09c000b2cbac95a385edd0ba01edeba24 100644 --- a/typo3/sysext/lowlevel/Resources/Private/Templates/CustomSearch.html +++ b/typo3/sysext/lowlevel/Resources/Private/Templates/CustomSearch.html @@ -10,7 +10,7 @@ <f:if condition="{searchMode} == 'query'"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Lowlevel/QueryGenerator.js' + 0: '@typo3/lowlevel/query-generator.js' }" /> </f:if> diff --git a/typo3/sysext/lowlevel/Resources/Private/Templates/ReferenceIndex.html b/typo3/sysext/lowlevel/Resources/Private/Templates/ReferenceIndex.html index 65ce5f2ea8d388649c53bfbd605567e359a2a9b3..90284322c2e139243add1ba5df3688a5b96ff5ec 100644 --- a/typo3/sysext/lowlevel/Resources/Private/Templates/ReferenceIndex.html +++ b/typo3/sysext/lowlevel/Resources/Private/Templates/ReferenceIndex.html @@ -9,7 +9,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Lowlevel/ReferenceIndex.js' + 0: '@typo3/lowlevel/reference-index.js' }" /> <h1>{f:translate(key:'LLL:EXT:lowlevel/Resources/Private/Language/locallang.xlf:manageRefIndex')}</h1> diff --git a/typo3/sysext/lowlevel/Resources/Public/JavaScript/ConfigurationView.js b/typo3/sysext/lowlevel/Resources/Public/JavaScript/ConfigurationView.js deleted file mode 100644 index 2164d7875e22b6c6ef796b1bdddb6461ec86bb3a..0000000000000000000000000000000000000000 --- a/typo3/sysext/lowlevel/Resources/Public/JavaScript/ConfigurationView.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class ConfigurationView{constructor(){if(this.searchForm=document.querySelector("#ConfigurationView"),this.searchField=this.searchForm.querySelector('input[name="searchString"]'),this.searchResultShown=""!==this.searchField.value,DocumentService.ready().then(()=>{new RegularEvent("search",()=>{""===this.searchField.value&&this.searchResultShown&&this.searchForm.submit()}).bindTo(this.searchField)}),self.location.hash){let e=document.querySelector(self.location.hash);document.querySelector(".list-tree .active ")?e=document.querySelector(".list-tree .active "):e&&e.parentElement.parentElement.classList.add("active"),e&&e.scrollIntoView({block:"center"})}}}export default new ConfigurationView; \ No newline at end of file diff --git a/typo3/sysext/lowlevel/Resources/Public/JavaScript/QueryGenerator.js b/typo3/sysext/lowlevel/Resources/Public/JavaScript/QueryGenerator.js deleted file mode 100644 index 8bda1e5f62f034a0219add8dbbb33ff92faae4b6..0000000000000000000000000000000000000000 --- a/typo3/sysext/lowlevel/Resources/Public/JavaScript/QueryGenerator.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import"TYPO3/CMS/Backend/Input/Clearable.js";import DateTimePicker from"TYPO3/CMS/Backend/DateTimePicker.js";class QueryGenerator{constructor(){this.form=null,this.limitField=null,this.initialize()}initialize(){this.form=$('form[name="queryform"]'),this.limitField=$("#queryLimit"),this.form.on("click",".t3js-submit-click",t=>{t.preventDefault(),this.doSubmit()}),this.form.on("change",".t3js-submit-change",t=>{t.preventDefault(),this.doSubmit()}),this.form.on("click",'.t3js-limit-submit input[type="button"]',t=>{t.preventDefault(),this.setLimit($(t.currentTarget).data("value")),this.doSubmit()}),this.form.on("click",".t3js-addfield",t=>{t.preventDefault();const e=$(t.currentTarget);this.addValueToField(e.data("field"),e.val())}),this.form.on("change","[data-assign-store-control-title]",t=>{const e=$(t.currentTarget),i=this.form.find('[name="storeControl[title]"]');"0"!==e.val()?i.val(e.find("option:selected").text()):i.val("")}),document.querySelectorAll('form[name="queryform"] .t3js-clearable').forEach(t=>t.clearable({onClear:()=>{this.doSubmit()}})),document.querySelectorAll('form[name="queryform"] .t3js-datetimepicker').forEach(t=>DateTimePicker.initialize(t))}doSubmit(){this.form.trigger("submit")}setLimit(t){this.limitField.val(t)}addValueToField(t,e){const i=this.form.find('[name="'+t+'"]'),r=i.val();i.val(r+","+e)}}export default new QueryGenerator; \ No newline at end of file diff --git a/typo3/sysext/lowlevel/Resources/Public/JavaScript/ReferenceIndex.js b/typo3/sysext/lowlevel/Resources/Public/JavaScript/ReferenceIndex.js deleted file mode 100644 index 9c06bef225273add89e56ff7c796c3f8fa4f2e98..0000000000000000000000000000000000000000 --- a/typo3/sysext/lowlevel/Resources/Public/JavaScript/ReferenceIndex.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import NProgress from"nprogress";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var Selectors;!function(e){e.actionsContainerSelector=".t3js-reference-index-actions"}(Selectors||(Selectors={}));class ReferenceIndex{constructor(){this.registerActionButtonEvents()}registerActionButtonEvents(){new RegularEvent("click",(e,r)=>{NProgress.configure({showSpinner:!1}),NProgress.start(),Array.from(r.parentNode.querySelectorAll("button")).forEach(e=>{e.classList.add("disabled")})}).delegateTo(document.querySelector(Selectors.actionsContainerSelector),"button")}}export default new ReferenceIndex; \ No newline at end of file diff --git a/typo3/sysext/lowlevel/Resources/Public/JavaScript/configuration-view.js b/typo3/sysext/lowlevel/Resources/Public/JavaScript/configuration-view.js new file mode 100644 index 0000000000000000000000000000000000000000..5b50af3fdb11ddb84f29d215004fdbc9654f680b --- /dev/null +++ b/typo3/sysext/lowlevel/Resources/Public/JavaScript/configuration-view.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import RegularEvent from"@typo3/core/event/regular-event.js";class ConfigurationView{constructor(){if(this.searchForm=document.querySelector("#ConfigurationView"),this.searchField=this.searchForm.querySelector('input[name="searchString"]'),this.searchResultShown=""!==this.searchField.value,DocumentService.ready().then(()=>{new RegularEvent("search",()=>{""===this.searchField.value&&this.searchResultShown&&this.searchForm.submit()}).bindTo(this.searchField)}),self.location.hash){let e=document.querySelector(self.location.hash);document.querySelector(".list-tree .active ")?e=document.querySelector(".list-tree .active "):e&&e.parentElement.parentElement.classList.add("active"),e&&e.scrollIntoView({block:"center"})}}}export default new ConfigurationView; \ No newline at end of file diff --git a/typo3/sysext/lowlevel/Resources/Public/JavaScript/query-generator.js b/typo3/sysext/lowlevel/Resources/Public/JavaScript/query-generator.js new file mode 100644 index 0000000000000000000000000000000000000000..a4547b76083766c669a8dffaf67cf0d263fccb20 --- /dev/null +++ b/typo3/sysext/lowlevel/Resources/Public/JavaScript/query-generator.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import"@typo3/backend/input/clearable.js";import DateTimePicker from"@typo3/backend/date-time-picker.js";class QueryGenerator{constructor(){this.form=null,this.limitField=null,this.initialize()}initialize(){this.form=$('form[name="queryform"]'),this.limitField=$("#queryLimit"),this.form.on("click",".t3js-submit-click",t=>{t.preventDefault(),this.doSubmit()}),this.form.on("change",".t3js-submit-change",t=>{t.preventDefault(),this.doSubmit()}),this.form.on("click",'.t3js-limit-submit input[type="button"]',t=>{t.preventDefault(),this.setLimit($(t.currentTarget).data("value")),this.doSubmit()}),this.form.on("click",".t3js-addfield",t=>{t.preventDefault();const e=$(t.currentTarget);this.addValueToField(e.data("field"),e.val())}),this.form.on("change","[data-assign-store-control-title]",t=>{const e=$(t.currentTarget),i=this.form.find('[name="storeControl[title]"]');"0"!==e.val()?i.val(e.find("option:selected").text()):i.val("")}),document.querySelectorAll('form[name="queryform"] .t3js-clearable').forEach(t=>t.clearable({onClear:()=>{this.doSubmit()}})),document.querySelectorAll('form[name="queryform"] .t3js-datetimepicker').forEach(t=>DateTimePicker.initialize(t))}doSubmit(){this.form.trigger("submit")}setLimit(t){this.limitField.val(t)}addValueToField(t,e){const i=this.form.find('[name="'+t+'"]'),r=i.val();i.val(r+","+e)}}export default new QueryGenerator; \ No newline at end of file diff --git a/typo3/sysext/lowlevel/Resources/Public/JavaScript/reference-index.js b/typo3/sysext/lowlevel/Resources/Public/JavaScript/reference-index.js new file mode 100644 index 0000000000000000000000000000000000000000..0430af25fa8f5295be2fc3966b554f47c6cbc557 --- /dev/null +++ b/typo3/sysext/lowlevel/Resources/Public/JavaScript/reference-index.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import NProgress from"nprogress";import RegularEvent from"@typo3/core/event/regular-event.js";var Selectors;!function(e){e.actionsContainerSelector=".t3js-reference-index-actions"}(Selectors||(Selectors={}));class ReferenceIndex{constructor(){this.registerActionButtonEvents()}registerActionButtonEvents(){new RegularEvent("click",(e,r)=>{NProgress.configure({showSpinner:!1}),NProgress.start(),Array.from(r.parentNode.querySelectorAll("button")).forEach(e=>{e.classList.add("disabled")})}).delegateTo(document.querySelector(Selectors.actionsContainerSelector),"button")}}export default new ReferenceIndex; \ No newline at end of file diff --git a/typo3/sysext/opendocs/Configuration/JavaScriptModules.php b/typo3/sysext/opendocs/Configuration/JavaScriptModules.php index 831a012e428cd1b841dcb3facdea3a91be5bd04f..05d9824b4491e327ab084db979c1f7553c4a4cb2 100644 --- a/typo3/sysext/opendocs/Configuration/JavaScriptModules.php +++ b/typo3/sysext/opendocs/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Opendocs/' => 'EXT:opendocs/Resources/Public/JavaScript/', + '@typo3/opendocs/' => 'EXT:opendocs/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/opendocs/Resources/Private/Templates/ToolbarItems/DropDown.html b/typo3/sysext/opendocs/Resources/Private/Templates/ToolbarItems/DropDown.html index f68dfe0d5987c69264a8c5be3e29ee8edbd26785..18ed751f07efbf78368f39efdf60d8509f93c5ce 100644 --- a/typo3/sysext/opendocs/Resources/Private/Templates/ToolbarItems/DropDown.html +++ b/typo3/sysext/opendocs/Resources/Private/Templates/ToolbarItems/DropDown.html @@ -1,7 +1,7 @@ <html xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Opendocs/Toolbar/OpendocsMenu.js' + 0: '@typo3/opendocs/toolbar/opendocs-menu.js' }" /> <h3 class="dropdown-headline"> diff --git a/typo3/sysext/opendocs/Resources/Public/JavaScript/Toolbar/OpendocsMenu.js b/typo3/sysext/opendocs/Resources/Public/JavaScript/Toolbar/OpendocsMenu.js deleted file mode 100644 index 6815774960736a14816a38b2afa7b6b4d7a02273..0000000000000000000000000000000000000000 --- a/typo3/sysext/opendocs/Resources/Public/JavaScript/Toolbar/OpendocsMenu.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import Viewport from"TYPO3/CMS/Backend/Viewport.js";import{ModuleStateStorage}from"TYPO3/CMS/Backend/Storage/ModuleStateStorage.js";var Selectors;!function(e){e.containerSelector="#typo3-cms-opendocs-backend-toolbaritems-opendocstoolbaritem",e.closeSelector=".t3js-topbar-opendocs-close",e.menuContainerSelector=".dropdown-menu",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon",e.openDocumentsItemsSelector=".t3js-topbar-opendocs-item",e.counterSelector="#tx-opendocs-counter",e.entrySelector=".t3js-open-doc"}(Selectors||(Selectors={}));class OpendocsMenu{constructor(){this.hashDataAttributeName="opendocsidentifier",this.toggleMenu=()=>{$(".scaffold").removeClass("scaffold-toolbar-expanded"),$(Selectors.containerSelector).toggleClass("open")},document.addEventListener("typo3:opendocs:updateRequested",e=>this.updateMenu()),Viewport.Topbar.Toolbar.registerEvent(()=>{this.initializeEvents(),this.updateMenu()})}static updateNumberOfDocs(){const e=$(Selectors.containerSelector).find(Selectors.openDocumentsItemsSelector).length;$(Selectors.counterSelector).text(e).toggle(e>0)}updateMenu(){let e=$(Selectors.toolbarIconSelector,Selectors.containerSelector),t=e.clone();Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(t=>{e.replaceWith(t)}),new AjaxRequest(TYPO3.settings.ajaxUrls.opendocs_menu).get().then(async e=>{$(Selectors.containerSelector).find(Selectors.menuContainerSelector).html(await e.resolve()),OpendocsMenu.updateNumberOfDocs()}).finally(()=>{$(Selectors.toolbarIconSelector,Selectors.containerSelector).replaceWith(t)})}initializeEvents(){$(Selectors.containerSelector).on("click",Selectors.closeSelector,e=>{e.preventDefault();const t=$(e.currentTarget).data(this.hashDataAttributeName);this.closeDocument(t)}).on("click",Selectors.entrySelector,e=>{e.preventDefault();const t=$(e.currentTarget);this.toggleMenu(),ModuleStateStorage.updateWithCurrentMount("web",t.data("pid"),!0);document.querySelector("typo3-backend-module-router").setAttribute("endpoint",t.attr("href"))})}closeDocument(e){const t={};e&&(t.md5sum=e),new AjaxRequest(TYPO3.settings.ajaxUrls.opendocs_closedoc).post(t).then(async e=>{$(Selectors.menuContainerSelector,Selectors.containerSelector).html(await e.resolve()),OpendocsMenu.updateNumberOfDocs(),$(Selectors.containerSelector).toggleClass("open")})}}let opendocsMenuObject;opendocsMenuObject=new OpendocsMenu,"undefined"!=typeof TYPO3&&(TYPO3.OpendocsMenu=opendocsMenuObject);export default opendocsMenuObject; \ No newline at end of file diff --git a/typo3/sysext/opendocs/Resources/Public/JavaScript/toolbar/opendocs-menu.js b/typo3/sysext/opendocs/Resources/Public/JavaScript/toolbar/opendocs-menu.js new file mode 100644 index 0000000000000000000000000000000000000000..7b99b1dec16326eec154aa217d26e5cf5b4b4578 --- /dev/null +++ b/typo3/sysext/opendocs/Resources/Public/JavaScript/toolbar/opendocs-menu.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import Icons from"@typo3/backend/icons.js";import Viewport from"@typo3/backend/viewport.js";import{ModuleStateStorage}from"@typo3/backend/storage/module-state-storage.js";var Selectors;!function(e){e.containerSelector="#typo3-cms-opendocs-backend-toolbaritems-opendocstoolbaritem",e.closeSelector=".t3js-topbar-opendocs-close",e.menuContainerSelector=".dropdown-menu",e.toolbarIconSelector=".toolbar-item-icon .t3js-icon",e.openDocumentsItemsSelector=".t3js-topbar-opendocs-item",e.counterSelector="#tx-opendocs-counter",e.entrySelector=".t3js-open-doc"}(Selectors||(Selectors={}));class OpendocsMenu{constructor(){this.hashDataAttributeName="opendocsidentifier",this.toggleMenu=()=>{$(".scaffold").removeClass("scaffold-toolbar-expanded"),$(Selectors.containerSelector).toggleClass("open")},document.addEventListener("typo3:opendocs:updateRequested",e=>this.updateMenu()),Viewport.Topbar.Toolbar.registerEvent(()=>{this.initializeEvents(),this.updateMenu()})}static updateNumberOfDocs(){const e=$(Selectors.containerSelector).find(Selectors.openDocumentsItemsSelector).length;$(Selectors.counterSelector).text(e).toggle(e>0)}updateMenu(){let e=$(Selectors.toolbarIconSelector,Selectors.containerSelector),t=e.clone();Icons.getIcon("spinner-circle-light",Icons.sizes.small).then(t=>{e.replaceWith(t)}),new AjaxRequest(TYPO3.settings.ajaxUrls.opendocs_menu).get().then(async e=>{$(Selectors.containerSelector).find(Selectors.menuContainerSelector).html(await e.resolve()),OpendocsMenu.updateNumberOfDocs()}).finally(()=>{$(Selectors.toolbarIconSelector,Selectors.containerSelector).replaceWith(t)})}initializeEvents(){$(Selectors.containerSelector).on("click",Selectors.closeSelector,e=>{e.preventDefault();const t=$(e.currentTarget).data(this.hashDataAttributeName);this.closeDocument(t)}).on("click",Selectors.entrySelector,e=>{e.preventDefault();const t=$(e.currentTarget);this.toggleMenu(),ModuleStateStorage.updateWithCurrentMount("web",t.data("pid"),!0);document.querySelector("typo3-backend-module-router").setAttribute("endpoint",t.attr("href"))})}closeDocument(e){const t={};e&&(t.md5sum=e),new AjaxRequest(TYPO3.settings.ajaxUrls.opendocs_closedoc).post(t).then(async e=>{$(Selectors.menuContainerSelector,Selectors.containerSelector).html(await e.resolve()),OpendocsMenu.updateNumberOfDocs(),$(Selectors.containerSelector).toggleClass("open")})}}let opendocsMenuObject;opendocsMenuObject=new OpendocsMenu,"undefined"!=typeof TYPO3&&(TYPO3.OpendocsMenu=opendocsMenuObject);export default opendocsMenuObject; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Classes/Browser/AbstractElementBrowser.php b/typo3/sysext/recordlist/Classes/Browser/AbstractElementBrowser.php index 2fcdb2c696c09e7b1b22fd0e9c81b621710e6be7..bdb7610fd63adb816948f23a6f663ad5b36ba002 100644 --- a/typo3/sysext/recordlist/Classes/Browser/AbstractElementBrowser.php +++ b/typo3/sysext/recordlist/Classes/Browser/AbstractElementBrowser.php @@ -84,8 +84,8 @@ abstract class AbstractElementBrowser $view->setTemplateRootPaths(['EXT:recordlist/Resources/Private/Templates']); $view->setLayoutRootPaths(['EXT:recordlist/Resources/Private/Layouts']); $this->view = $view; - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/ElementBrowser.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Viewport/ResizableNavigation.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/element-browser.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/viewport/resizable-navigation.js'); $this->pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_misc.xlf'); $this->pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_core.xlf'); $this->determineScriptUrl(); diff --git a/typo3/sysext/recordlist/Classes/Browser/DatabaseBrowser.php b/typo3/sysext/recordlist/Classes/Browser/DatabaseBrowser.php index f3f6c6081296af15b28ca5673162dc2a5cfceb64..b6e81ce0137e01a6ee3acdada27945d9530d592e 100644 --- a/typo3/sysext/recordlist/Classes/Browser/DatabaseBrowser.php +++ b/typo3/sysext/recordlist/Classes/Browser/DatabaseBrowser.php @@ -46,11 +46,11 @@ class DatabaseBrowser extends AbstractElementBrowser implements ElementBrowserIn protected function initialize() { parent::initialize(); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/BrowseDatabase.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tree/PageBrowser.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ColumnSelectorButton.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/Recordlist.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/RecordSearch.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/browse-database.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tree/page-browser.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/column-selector-button.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/recordlist.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/record-search.js'); } protected function initVariables() diff --git a/typo3/sysext/recordlist/Classes/Browser/FileBrowser.php b/typo3/sysext/recordlist/Classes/Browser/FileBrowser.php index 9742cd5734907dca80d305de9ad87dea9cb4bd22..fc3f947d13747e9d27ca1752a57d134caef6085d 100644 --- a/typo3/sysext/recordlist/Classes/Browser/FileBrowser.php +++ b/typo3/sysext/recordlist/Classes/Browser/FileBrowser.php @@ -71,9 +71,9 @@ class FileBrowser extends AbstractElementBrowser implements ElementBrowserInterf protected function initialize() { parent::initialize(); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/BrowseFiles.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tree/FileStorageBrowser.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/MultiRecordSelection.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/browse-files.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tree/file-storage-browser.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/multi-record-selection.js'); $thumbnailConfig = $this->getBackendUser()->getTSConfig()['options.']['file_list.']['thumbnail.'] ?? []; if (isset($thumbnailConfig['width']) && MathUtility::canBeInterpretedAsInteger($thumbnailConfig['width'])) { diff --git a/typo3/sysext/recordlist/Classes/Browser/FolderBrowser.php b/typo3/sysext/recordlist/Classes/Browser/FolderBrowser.php index 69e1683c8f7266967b2815cb72091bc197a64620..e09d587cc6f36eae818271afb8c768f323c74b74 100644 --- a/typo3/sysext/recordlist/Classes/Browser/FolderBrowser.php +++ b/typo3/sysext/recordlist/Classes/Browser/FolderBrowser.php @@ -45,8 +45,8 @@ class FolderBrowser extends AbstractElementBrowser implements ElementBrowserInte protected function initialize() { parent::initialize(); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/BrowseFolders.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tree/FileStorageBrowser.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/browse-folders.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tree/file-storage-browser.js'); } /** diff --git a/typo3/sysext/recordlist/Classes/Controller/RecordListController.php b/typo3/sysext/recordlist/Classes/Controller/RecordListController.php index 924454c90576aef3553274a030529913d09e8636..51213842a880ecfc6ea55fa7bf2066615392a054 100644 --- a/typo3/sysext/recordlist/Classes/Controller/RecordListController.php +++ b/typo3/sysext/recordlist/Classes/Controller/RecordListController.php @@ -103,7 +103,7 @@ class RecordListController $this->pageInfo = is_array($pageinfo) ? $pageinfo : []; $this->pagePermissions = new Permission($backendUser->calcPerms($pageinfo)); $userCanEditPage = $this->pagePermissions->editPagePermissionIsGranted() && !empty($this->id) && ($backendUser->isAdmin() || (int)$pageinfo['editlock'] === 0); - $pageActionsInstruction = JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/PageActions.js'); + $pageActionsInstruction = JavaScriptModuleInstruction::create('@typo3/backend/page-actions.js'); if ($userCanEditPage) { $pageActionsInstruction->invoke('setPageId', $this->id); } diff --git a/typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php b/typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php index 41b94171cae222ce998da3a0b5214a7f081ddc47..c19db813103e4e616a52e1bd95b1340e51717d85 100644 --- a/typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php +++ b/typo3/sysext/recordlist/Classes/LinkHandler/FileLinkHandler.php @@ -96,9 +96,9 @@ class FileLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac */ public function render(ServerRequestInterface $request) { - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/FileLinkHandler.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Viewport/ResizableNavigation.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tree/FileStorageBrowser.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/file-link-handler.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/viewport/resizable-navigation.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tree/file-storage-browser.js'); $this->view->assign('initialNavigationWidth', $this->getBackendUser()->uc['selector']['navigation']['width'] ?? 250); $this->view->assign('contentOnly', (bool)($request->getQueryParams()['contentOnly'] ?? false)); diff --git a/typo3/sysext/recordlist/Classes/LinkHandler/MailLinkHandler.php b/typo3/sysext/recordlist/Classes/LinkHandler/MailLinkHandler.php index c98917b31d10958d04f5517dfab0f73c54b3087d..6fd6646172b244238a25f947c07fcf891862f62a 100644 --- a/typo3/sysext/recordlist/Classes/LinkHandler/MailLinkHandler.php +++ b/typo3/sysext/recordlist/Classes/LinkHandler/MailLinkHandler.php @@ -89,7 +89,7 @@ class MailLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac */ public function render(ServerRequestInterface $request) { - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/MailLinkHandler.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/mail-link-handler.js'); $this->view->assign('email', !empty($this->linkParts) ? $this->linkParts['url']['email'] : ''); $this->view->setTemplate('LinkBrowser/Mail'); return ''; diff --git a/typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php b/typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php index c7401fede96b7af1870f4c95be1623523ebda381..c3ef240a565cad2c441df5282ff9c9c74edba527 100644 --- a/typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php +++ b/typo3/sysext/recordlist/Classes/LinkHandler/PageLinkHandler.php @@ -102,9 +102,9 @@ class PageLinkHandler extends AbstractLinkHandler implements LinkHandlerInterfac */ public function render(ServerRequestInterface $request) { - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/PageLinkHandler.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Viewport/ResizableNavigation.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tree/PageBrowser.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/page-link-handler.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/viewport/resizable-navigation.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tree/page-browser.js'); $this->getBackendUser()->initializeWebmountsForElementBrowser(); $this->expandPage = isset($request->getQueryParams()['expandPage']) ? (int)$request->getQueryParams()['expandPage'] : 0; diff --git a/typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php b/typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php index 0456d87d23f2f713018e0c015139267858b86c08..5c3471d63239483864d5e7937ebc7bc51b7e7fd4 100644 --- a/typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php +++ b/typo3/sysext/recordlist/Classes/LinkHandler/RecordLinkHandler.php @@ -126,11 +126,11 @@ class RecordLinkHandler extends AbstractLinkHandler implements LinkHandlerInterf */ public function render(ServerRequestInterface $request): string { - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/RecordLinkHandler.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/RecordSearch.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Viewport/ResizableNavigation.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ColumnSelectorButton.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tree/PageBrowser.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/record-link-handler.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/record-search.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/viewport/resizable-navigation.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/column-selector-button.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tree/page-browser.js'); $this->getBackendUser()->initializeWebmountsForElementBrowser(); // Define the current page diff --git a/typo3/sysext/recordlist/Classes/LinkHandler/TelephoneLinkHandler.php b/typo3/sysext/recordlist/Classes/LinkHandler/TelephoneLinkHandler.php index 9a4dd1e7c3aa32882ebc78c9101e15ec30549c63..739572a76e766e7149bf929c974cac84a8811516 100644 --- a/typo3/sysext/recordlist/Classes/LinkHandler/TelephoneLinkHandler.php +++ b/typo3/sysext/recordlist/Classes/LinkHandler/TelephoneLinkHandler.php @@ -91,7 +91,7 @@ class TelephoneLinkHandler extends AbstractLinkHandler implements LinkHandlerInt */ public function render(ServerRequestInterface $request): string { - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/TelephoneLinkHandler.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/telephone-link-handler.js'); $this->view->assign('telephone', !empty($this->linkParts) ? $this->linkParts['url']['telephone'] : ''); $this->view->setTemplate('LinkBrowser/Telephone'); return ''; diff --git a/typo3/sysext/recordlist/Classes/LinkHandler/UrlLinkHandler.php b/typo3/sysext/recordlist/Classes/LinkHandler/UrlLinkHandler.php index 08b35f670ce7ddea712175ffd7fd31a3d73c773d..28664e14faae3a9276f335078f94d1927d580b07 100644 --- a/typo3/sysext/recordlist/Classes/LinkHandler/UrlLinkHandler.php +++ b/typo3/sysext/recordlist/Classes/LinkHandler/UrlLinkHandler.php @@ -86,7 +86,7 @@ class UrlLinkHandler extends AbstractLinkHandler implements LinkHandlerInterface */ public function render(ServerRequestInterface $request) { - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recordlist/UrlLinkHandler.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recordlist/url-link-handler.js'); $this->view->assign('url', !empty($this->linkParts) ? $this->linkParts['url'] : ''); $this->view->setTemplate('LinkBrowser/Url'); diff --git a/typo3/sysext/recordlist/Configuration/JavaScriptModules.php b/typo3/sysext/recordlist/Configuration/JavaScriptModules.php index fd15659b2bde0a6aa75979e27975850838ad47ad..b1d3ca34f0bbfdb5a78932612dc35fe636f0231e 100644 --- a/typo3/sysext/recordlist/Configuration/JavaScriptModules.php +++ b/typo3/sysext/recordlist/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Recordlist/' => 'EXT:recordlist/Resources/Public/JavaScript/', + '@typo3/recordlist/' => 'EXT:recordlist/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/recordlist/Resources/Private/Templates/RecordList.html b/typo3/sysext/recordlist/Resources/Private/Templates/RecordList.html index 070a044777ff8b3c67713134f66c02adc155432a..cfd9f881c3c10a081b6bdf97690b78a22a49feb6 100644 --- a/typo3/sysext/recordlist/Resources/Private/Templates/RecordList.html +++ b/typo3/sysext/recordlist/Resources/Private/Templates/RecordList.html @@ -9,17 +9,17 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Recordlist/Recordlist.js', - 1: 'TYPO3/CMS/Recordlist/RecordDownloadButton.js', - 2: 'TYPO3/CMS/Recordlist/ClearCache.js', - 3: 'TYPO3/CMS/Recordlist/RecordSearch.js', - 4: 'TYPO3/CMS/Backend/AjaxDataHandler.js', - 5: 'TYPO3/CMS/Backend/ColumnSelectorButton.js', - 6: 'TYPO3/CMS/Backend/MultiRecordSelection.js', - 7: 'TYPO3/CMS/Backend/ClipboardPanel.js', - 8: 'TYPO3/CMS/Backend/NewContentElementWizardButton.js', - 9: 'TYPO3/CMS/Backend/Element/ImmediateActionElement.js', - 10: 'TYPO3/CMS/Backend/ContextMenu.js' + 0: '@typo3/recordlist/recordlist.js', + 1: '@typo3/recordlist/record-download-button.js', + 2: '@typo3/recordlist/clear-cache.js', + 3: '@typo3/recordlist/record-search.js', + 4: '@typo3/backend/ajax-data-handler.js', + 5: '@typo3/backend/column-selector-button.js', + 6: '@typo3/backend/multi-record-selection.js', + 7: '@typo3/backend/clipboard-panel.js', + 8: '@typo3/backend/new-content-element-wizard-button.js', + 9: '@typo3/backend/element/immediate-action-element.js', + 10: '@typo3/backend/context-menu.js' }" /> diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseDatabase.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseDatabase.js deleted file mode 100644 index 0ba6f99499773842f893ec775b211f56effc5a54..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseDatabase.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import ElementBrowser from"TYPO3/CMS/Recordlist/ElementBrowser.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class BrowseDatabase{constructor(){new RegularEvent("click",(e,t)=>{e.preventDefault();const a=t.closest("span").dataset;ElementBrowser.insertElement(a.table,a.uid,a.title,"",1===parseInt(t.dataset.close||"0",10))}).delegateTo(document,"[data-close]")}}export default new BrowseDatabase; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseFiles.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseFiles.js deleted file mode 100644 index 9333931ccfa706098ef72b4e01cab89f6691c4fb..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseFiles.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{MessageUtility}from"TYPO3/CMS/Backend/Utility/MessageUtility.js";import ElementBrowser from"TYPO3/CMS/Recordlist/ElementBrowser.js";import NProgress from"nprogress";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var Icons=TYPO3.Icons;class BrowseFiles{constructor(){this.importSelection=e=>{e.preventDefault();const t=e.target,n=e.detail.checkboxes;if(!n.length)return;const s=[];n.forEach(e=>{e.checked&&e.name&&e.dataset.fileName&&e.dataset.fileUid&&s.unshift({uid:e.dataset.fileUid,fileName:e.dataset.fileName})}),Icons.getIcon("spinner-circle",Icons.sizes.small,null,null,Icons.markupIdentifiers.inline).then(e=>{t.classList.add("disabled"),t.innerHTML=e}),NProgress.configure({parent:".element-browser-main-content",showSpinner:!1}),NProgress.start();const i=1/s.length;BrowseFiles.handleNext(s),new RegularEvent("message",e=>{if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;"typo3:foreignRelation:inserted"===e.data.actionName&&(s.length>0?(NProgress.inc(i),BrowseFiles.handleNext(s)):(NProgress.done(),ElementBrowser.focusOpenerAndClose()))}).bindTo(window)},new RegularEvent("click",(e,t)=>{e.preventDefault(),BrowseFiles.insertElement(t.dataset.fileName,Number(t.dataset.fileUid),1===parseInt(t.dataset.close||"0",10))}).delegateTo(document,"[data-close]"),new RegularEvent("multiRecordSelection:action:import",this.importSelection).bindTo(document)}static insertElement(e,t,n){return ElementBrowser.insertElement("sys_file",String(t),e,String(t),n)}static handleNext(e){if(e.length>0){const t=e.pop();BrowseFiles.insertElement(t.fileName,Number(t.uid))}}}export default new BrowseFiles; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseFolders.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseFolders.js deleted file mode 100644 index cb3d80a76d52a013ba23c2136ce44cfcd2901c0b..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseFolders.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import ElementBrowser from"TYPO3/CMS/Recordlist/ElementBrowser.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class BrowseFolders{constructor(){new RegularEvent("click",(e,r)=>{e.preventDefault();const t=r.dataset.folderId;ElementBrowser.insertElement("",t,t,t,1===parseInt(r.dataset.close||"0",10))}).delegateTo(document,"[data-folder-id]"),new RegularEvent("click",(e,r)=>{e.preventDefault(),Modal.confirm("",r.dataset.message,Severity.error,[],[])}).delegateTo(document,".t3js-folderIdError")}}export default new BrowseFolders; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/ClearCache.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/ClearCache.js deleted file mode 100644 index 678805d816e268d73fc808992d4fac465a7effd2..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/ClearCache.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import Notification from"TYPO3/CMS/Backend/Notification.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";var Identifiers;!function(e){e.clearCache=".t3js-clear-page-cache",e.icon=".t3js-icon"}(Identifiers||(Identifiers={}));class ClearCache{static setDisabled(e,t){e.disabled=t,e.classList.toggle("disabled",t)}static sendClearCacheRequest(e){const t=new AjaxRequest(TYPO3.settings.ajaxUrls.web_list_clearpagecache).withQueryArguments({id:e}).get({cache:"no-cache"});return t.then(async e=>{const t=await e.resolve();!0===t.success?Notification.success(t.title,t.message,1):Notification.error(t.title,t.message,1)},()=>{Notification.error("Clearing page caches went wrong on the server side.")}),t}constructor(){this.registerClickHandler()}registerClickHandler(){const e=document.querySelector(Identifiers.clearCache+":not([disabled])");null!==e&&new RegularEvent("click",e=>{e.preventDefault();const t=e.currentTarget,s=parseInt(t.dataset.id,10);ClearCache.setDisabled(t,!0),Icons.getIcon("spinner-circle-dark",Icons.sizes.small,null,"disabled").then(e=>{t.querySelector(Identifiers.icon).outerHTML=e}),ClearCache.sendClearCacheRequest(s).finally(()=>{Icons.getIcon("actions-system-cache-clear",Icons.sizes.small).then(e=>{t.querySelector(Identifiers.icon).outerHTML=e}),ClearCache.setDisabled(t,!1)})}).bindTo(e)}}export default new ClearCache; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/ElementBrowser.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/ElementBrowser.js deleted file mode 100644 index 1731f6285f1971e4e0d20942ba43dff2a2e4066d..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/ElementBrowser.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{MessageUtility}from"TYPO3/CMS/Backend/Utility/MessageUtility.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import Modal from"TYPO3/CMS/Backend/Modal.js";class ElementBrowser{constructor(){this.opener=null,this.formFieldName="",this.fieldReference="",this.rte={parameters:"",configuration:""},this.irre={objectId:""},this.focusOpenerAndClose=()=>{this.getParent()&&this.getParent().focus(),Modal.dismiss(),close()},DocumentService.ready().then(()=>{const e=document.body.dataset;this.formFieldName=e.formFieldName,this.fieldReference=e.fieldReference,this.rte.parameters=e.rteParameters,this.rte.configuration=e.rteConfiguration,this.irre.objectId=e.irreObjectId})}setReferences(){return!!(this.getParent()&&this.getParent().content&&this.getParent().content.document.editform&&this.getParent().content.document.editform[this.formFieldName])&&(this.targetDoc=this.getParent().content.document,this.elRef=this.targetDoc.editform[this.formFieldName],!0)}getParent(){return null===this.opener&&(void 0!==window.parent&&void 0!==window.parent.document.list_frame&&null!==window.parent.document.list_frame.parent.document.querySelector(".t3js-modal-iframe")?this.opener=window.parent.document.list_frame:void 0!==window.parent&&void 0!==window.parent.frames.list_frame&&null!==window.parent.frames.list_frame.parent.document.querySelector(".t3js-modal-iframe")?this.opener=window.parent.frames.list_frame:void 0!==window.frames&&void 0!==window.frames.frameElement&&null!==window.frames.frameElement&&window.frames.frameElement.classList.contains("t3js-modal-iframe")?this.opener=window.frames.frameElement.contentWindow.parent:window.opener&&(this.opener=window.opener)),this.opener}insertElement(e,t,r,n,i){if(this.irre.objectId){if(this.getParent()){const r={actionName:"typo3:foreignRelation:insert",objectGroup:this.irre.objectId,table:e,uid:t};MessageUtility.send(r,this.getParent())}else alert("Error - reference to main window is not set properly!"),this.focusOpenerAndClose();return i&&this.focusOpenerAndClose(),!0}return!this.fieldReference||this.rte.parameters||this.rte.configuration||this.addElement(r,n||e+"_"+t,i),!1}addElement(e,t,r){if(this.getParent()){const n={actionName:"typo3:elementBrowser:elementAdded",fieldName:this.fieldReference,value:t,label:e};MessageUtility.send(n,this.getParent()),r&&this.focusOpenerAndClose()}else alert("Error - reference to main window is not set properly!"),this.focusOpenerAndClose()}}export default new ElementBrowser; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/FileLinkHandler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/FileLinkHandler.js deleted file mode 100644 index 79af38f5dd7dd51ae92dab5174bbcee74edbda90..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/FileLinkHandler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class FileLinkHandler{constructor(){new RegularEvent("click",(e,n)=>{e.preventDefault(),LinkBrowser.finalizeFunction(n.getAttribute("href"))}).delegateTo(document,"a.t3js-fileLink"),new RegularEvent("click",(e,n)=>{e.preventDefault(),LinkBrowser.finalizeFunction(document.body.dataset.currentLink)}).delegateTo(document,"input.t3js-linkCurrent")}}export default new FileLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/MailLinkHandler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/MailLinkHandler.js deleted file mode 100644 index 37d6734208ff0ca40266f6c87fcec4e78b686643..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/MailLinkHandler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class MailLinkHandler{constructor(){new RegularEvent("submit",(e,r)=>{e.preventDefault();let t=r.querySelector('[name="lemail"]').value;if("mailto:"!==t){for(;"mailto:"===t.substr(0,7);)t=t.substr(7);LinkBrowser.finalizeFunction("mailto:"+t)}}).delegateTo(document,"#lmailform")}}export default new MailLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/PageLinkHandler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/PageLinkHandler.js deleted file mode 100644 index 1beae666d1a8723f910b9401f6f7ef2482816ab8..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/PageLinkHandler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class PageLinkHandler{constructor(){this.linkPageByTextfield=()=>{let e=document.getElementById("luid").value;if(!e)return;const t=parseInt(e,10);isNaN(t)||(e="t3://page?uid="+t),LinkBrowser.finalizeFunction(e)},new RegularEvent("click",(e,t)=>{e.preventDefault(),LinkBrowser.finalizeFunction(t.getAttribute("href"))}).delegateTo(document,"a.t3js-pageLink"),new RegularEvent("click",(e,t)=>{e.preventDefault(),LinkBrowser.finalizeFunction(document.body.dataset.currentLink)}).delegateTo(document,"input.t3js-linkCurrent"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.linkPageByTextfield()}).delegateTo(document,"input.t3js-pageLink")}}export default new PageLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/RecordDownloadButton.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/RecordDownloadButton.js deleted file mode 100644 index 68f6837836f8e5f17b7d96c1fe1d301b6065456c..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/RecordDownloadButton.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -var Selectors,__decorate=function(t,e,o,r){var l,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var d=t.length-1;d>=0;d--)(l=t[d])&&(a=(n<3?l(a):n>3?l(e,o,a):l(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import{lll}from"TYPO3/CMS/Core/lit-helper.js";!function(t){t.formatSelector=".t3js-record-download-format-selector",t.formatOptions=".t3js-record-download-format-option"}(Selectors||(Selectors={}));let RecordDownloadButton=class extends LitElement{constructor(){super(),this.addEventListener("click",t=>{t.preventDefault(),this.showDownloadConfigurationModal()})}render(){return html`<slot></slot>`}showDownloadConfigurationModal(){this.url&&Modal.advanced({content:this.url,title:this.title||"Download records",severity:SeverityEnum.notice,size:Modal.sizes.small,type:Modal.types.ajax,buttons:[{text:this.close||lll("button.close")||"Close",active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>Modal.dismiss()},{text:this.ok||lll("button.ok")||"Download",btnClass:"btn-"+Severity.getCssClass(SeverityEnum.info),name:"download",trigger:()=>{const t=Modal.currentModal[0].querySelector("form");t&&t.submit(),Modal.dismiss()}}],ajaxCallback:()=>{const t=Modal.currentModal[0].querySelector(Selectors.formatSelector),e=Modal.currentModal[0].querySelectorAll(Selectors.formatOptions);null!==t&&e.length&&t.addEventListener("change",t=>{const o=t.target.value;e.forEach(t=>{t.dataset.formatname!==o?t.classList.add("hide"):t.classList.remove("hide")})})}})}};__decorate([property({type:String})],RecordDownloadButton.prototype,"url",void 0),__decorate([property({type:String})],RecordDownloadButton.prototype,"title",void 0),__decorate([property({type:String})],RecordDownloadButton.prototype,"ok",void 0),__decorate([property({type:String})],RecordDownloadButton.prototype,"close",void 0),RecordDownloadButton=__decorate([customElement("typo3-recordlist-record-download-button")],RecordDownloadButton); \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/RecordLinkHandler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/RecordLinkHandler.js deleted file mode 100644 index 3b48f76ec2c38d40cfd6c67d0cedd8a6bc9b2da5..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/RecordLinkHandler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class RecordLinkHandler{constructor(){new RegularEvent("click",(e,n)=>{e.preventDefault();const t=n.closest("span").dataset;LinkBrowser.finalizeFunction(document.body.dataset.identifier+t.uid)}).delegateTo(document,"[data-close]"),new RegularEvent("click",(e,n)=>{e.preventDefault(),LinkBrowser.finalizeFunction(document.body.dataset.currentLink)}).delegateTo(document,"input.t3js-linkCurrent")}}export default new RecordLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/RecordSearch.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/RecordSearch.js deleted file mode 100644 index 31c7abc17be003fcc8b8768e6617284992123b50..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/RecordSearch.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var Selectors;!function(e){e.searchFieldSelector="#search_field"}(Selectors||(Selectors={}));class RecordSearch{constructor(){this.searchField=document.querySelector(Selectors.searchFieldSelector),this.activeSearch=!!this.searchField&&""!==this.searchField.value,DocumentService.ready().then(()=>{this.searchField&&new RegularEvent("search",()=>{""===this.searchField.value&&this.activeSearch&&this.searchField.closest("form").submit()}).bindTo(this.searchField)})}}export default new RecordSearch; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/Recordlist.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/Recordlist.js deleted file mode 100644 index d43b02c198c2aca0c5f823cf8d28cd9f5040296e..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/Recordlist.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Icons from"TYPO3/CMS/Backend/Icons.js";import PersistentStorage from"TYPO3/CMS/Backend/Storage/Persistent.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import Tooltip from"TYPO3/CMS/Backend/Tooltip.js";import DocumentService from"TYPO3/CMS/Core/DocumentService.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import Severity from"TYPO3/CMS/Backend/Severity.js";class Recordlist{constructor(){this.identifier={entity:".t3js-entity",toggle:".t3js-toggle-recordlist",localize:".t3js-action-localize",searchboxToolbar:"#db_list-searchbox-toolbar",searchboxToggle:".t3js-toggle-search-toolbox",searchField:"#search_field",icons:{collapse:"actions-view-list-collapse",expand:"actions-view-list-expand",editMultiple:".t3js-record-edit-multiple"}},this.toggleClick=e=>{e.preventDefault();const t=$(e.currentTarget),i=t.data("table"),o=$(t.data("bs-target")),a="expanded"===o.data("state"),n=t.find(".collapseIcon"),l=a?this.identifier.icons.expand:this.identifier.icons.collapse;Icons.getIcon(l,Icons.sizes.small).then(e=>{n.html(e)});let r={};PersistentStorage.isset("moduleData.web_list.collapsedTables")&&(r=PersistentStorage.get("moduleData.web_list.collapsedTables"));const s={};s[i]=a?1:0,$.extend(r,s),PersistentStorage.set("moduleData.web_list.collapsedTables",r).done(()=>{o.data("state",a?"collapsed":"expanded")})},this.onEditMultiple=e=>{e.preventDefault();let t="",i="",o="",a=[];if("multiRecordSelection:action:edit"===e.type){const o=e.detail,n=o.configuration;if(i=n.returnUrl||"",t=n.tableName||"",""===t)return;o.checkboxes.forEach(e=>{const t=e.closest("tr");null!==t&&t.dataset[n.idField]&&a.push(t.dataset[n.idField])})}else{const n=e.currentTarget,l=n.closest("[data-table]");if(null===l)return;if(t=l.dataset.table||"",""===t)return;i=n.dataset.returnUrl||"",o=n.dataset.columnsOnly||"";const r=l.querySelectorAll(this.identifier.entity+'[data-uid][data-table="'+t+'"] td.col-selector input[type="checkbox"]:checked');if(r.length)r.forEach(e=>{a.push(e.closest(this.identifier.entity+'[data-uid][data-table="'+t+'"]').dataset.uid)});else{const e=l.querySelectorAll(this.identifier.entity+'[data-uid][data-table="'+t+'"]');if(!e.length)return;e.forEach(e=>{a.push(e.dataset.uid)})}}if(!a.length)return;let n=top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"]["+a.join(",")+"]=edit&returnUrl="+Recordlist.getReturnUrl(i);""!==o&&(n+="&columnsOnly="+o),window.location.href=n},this.disableButton=e=>{$(e.currentTarget).prop("disable",!0).addClass("disabled")},this.toggleSearchbox=()=>{const e=$(this.identifier.searchboxToolbar);e.toggle(),e.is(":visible")&&$(this.identifier.searchField).focus()},this.deleteRow=e=>{const t=$(`table[data-table="${e.table}"]`),i=t.find(`tr[data-uid="${e.uid}"]`),o=t.closest(".panel"),a=o.find(".panel-heading"),n=t.find(`[data-l10nparent="${e.uid}"]`),l=$().add(i).add(n);if(l.fadeTo("slow",.4,()=>{l.slideUp("slow",()=>{l.remove(),0===t.find("tbody tr").length&&o.slideUp("slow")})}),"0"===i.data("l10nparent")||""===i.data("l10nparent")){const e=Number(a.find(".t3js-table-total-items").html());a.find(".t3js-table-total-items").text(e-1)}"pages"===e.table&&top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))},this.registerPaginationEvents=()=>{document.querySelectorAll(".t3js-recordlist-paging").forEach(e=>{e.addEventListener("keyup",t=>{t.preventDefault();let i=parseInt(e.value,10);i<parseInt(e.min,10)&&(i=parseInt(e.min,10)),i>parseInt(e.max,10)&&(i=parseInt(e.max,10)),"Enter"===t.key&&i!==parseInt(e.dataset.currentpage,10)&&(window.location.href=e.dataset.currenturl+i.toString())})})},$(document).on("click",this.identifier.toggle,this.toggleClick),$(document).on("click",this.identifier.icons.editMultiple,this.onEditMultiple),$(document).on("click",this.identifier.localize,this.disableButton),$(document).on("click",this.identifier.searchboxToggle,this.toggleSearchbox),DocumentService.ready().then(()=>{Tooltip.initialize(".table-fit a[title]"),this.registerPaginationEvents()}),new RegularEvent("typo3:datahandler:process",this.handleDataHandlerResult.bind(this)).bindTo(document),new RegularEvent("multiRecordSelection:action:edit",this.onEditMultiple).bindTo(document),new RegularEvent("multiRecordSelection:action:delete",this.deleteMultiple).bindTo(document),new RegularEvent("multiRecordSelection:action:copyMarked",e=>{Recordlist.submitClipboardFormWithCommand("copyMarked",e.target)}).bindTo(document),new RegularEvent("multiRecordSelection:action:removeMarked",e=>{Recordlist.submitClipboardFormWithCommand("removeMarked",e.target)}).bindTo(document)}static submitClipboardFormWithCommand(e,t){const i=t.closest("form");if(!i)return;const o=i.querySelector('input[name="cmd"]');o&&(o.value=e,i.submit())}static getReturnUrl(e){return""===e&&(e=top.list_frame.document.location.pathname+top.list_frame.document.location.search),encodeURIComponent(e)}handleDataHandlerResult(e){const t=e.detail.payload;t.hasErrors||"datahandler"!==t.component&&"delete"===t.action&&this.deleteRow(t)}deleteMultiple(e){e.preventDefault();const t=e.detail.configuration;Modal.advanced({title:t.title||"Delete",content:t.content||"Are you sure you want to delete those records?",severity:SeverityEnum.warning,buttons:[{text:TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:()=>Modal.currentModal.trigger("modal-dismiss")},{text:t.ok||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(SeverityEnum.warning),trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),Recordlist.submitClipboardFormWithCommand("delete",e.target)}}]})}}export default new Recordlist; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/TelephoneLinkHandler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/TelephoneLinkHandler.js deleted file mode 100644 index 4d35d1443ee9ff5246d76227e9747bb668fb095a..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/TelephoneLinkHandler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class TelephoneLinkHandler{constructor(){new RegularEvent("submit",(e,t)=>{e.preventDefault();let r=t.querySelector('[name="ltelephone"]').value;"tel:"!==r&&(r.startsWith("tel:")&&(r=r.substr(4)),LinkBrowser.finalizeFunction("tel:"+r))}).delegateTo(document,"#ltelephoneform")}}export default new TelephoneLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/UrlLinkHandler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/UrlLinkHandler.js deleted file mode 100644 index c2226aaacd6320f76e694aed04babeb5626eccd9..0000000000000000000000000000000000000000 --- a/typo3/sysext/recordlist/Resources/Public/JavaScript/UrlLinkHandler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class UrlLinkHandler{constructor(){new RegularEvent("submit",(e,r)=>{e.preventDefault();let n=r.querySelector('[name="lurl"]').value;""!==n&&LinkBrowser.finalizeFunction(n)}).delegateTo(document,"#lurlform")}}export default new UrlLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/browse-database.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/browse-database.js new file mode 100644 index 0000000000000000000000000000000000000000..986953fa36d74ed550b53835002a9d74d8c899cb --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/browse-database.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import ElementBrowser from"@typo3/recordlist/element-browser.js";import RegularEvent from"@typo3/core/event/regular-event.js";class BrowseDatabase{constructor(){new RegularEvent("click",(e,t)=>{e.preventDefault();const r=t.closest("span").dataset;ElementBrowser.insertElement(r.table,r.uid,r.title,"",1===parseInt(t.dataset.close||"0",10))}).delegateTo(document,"[data-close]")}}export default new BrowseDatabase; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/browse-files.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/browse-files.js new file mode 100644 index 0000000000000000000000000000000000000000..01d5dc0f2271152608742d5cfc32198f3626ea69 --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/browse-files.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{MessageUtility}from"@typo3/backend/utility/message-utility.js";import ElementBrowser from"@typo3/recordlist/element-browser.js";import NProgress from"nprogress";import RegularEvent from"@typo3/core/event/regular-event.js";var Icons=TYPO3.Icons;class BrowseFiles{constructor(){this.importSelection=e=>{e.preventDefault();const t=e.target,n=e.detail.checkboxes;if(!n.length)return;const s=[];n.forEach(e=>{e.checked&&e.name&&e.dataset.fileName&&e.dataset.fileUid&&s.unshift({uid:e.dataset.fileUid,fileName:e.dataset.fileName})}),Icons.getIcon("spinner-circle",Icons.sizes.small,null,null,Icons.markupIdentifiers.inline).then(e=>{t.classList.add("disabled"),t.innerHTML=e}),NProgress.configure({parent:".element-browser-main-content",showSpinner:!1}),NProgress.start();const i=1/s.length;BrowseFiles.handleNext(s),new RegularEvent("message",e=>{if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;"typo3:foreignRelation:inserted"===e.data.actionName&&(s.length>0?(NProgress.inc(i),BrowseFiles.handleNext(s)):(NProgress.done(),ElementBrowser.focusOpenerAndClose()))}).bindTo(window)},new RegularEvent("click",(e,t)=>{e.preventDefault(),BrowseFiles.insertElement(t.dataset.fileName,Number(t.dataset.fileUid),1===parseInt(t.dataset.close||"0",10))}).delegateTo(document,"[data-close]"),new RegularEvent("multiRecordSelection:action:import",this.importSelection).bindTo(document)}static insertElement(e,t,n){return ElementBrowser.insertElement("sys_file",String(t),e,String(t),n)}static handleNext(e){if(e.length>0){const t=e.pop();BrowseFiles.insertElement(t.fileName,Number(t.uid))}}}export default new BrowseFiles; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/browse-folders.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/browse-folders.js new file mode 100644 index 0000000000000000000000000000000000000000..8907ddffc759c461c876741788373281a13a93cf --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/browse-folders.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import ElementBrowser from"@typo3/recordlist/element-browser.js";import Modal from"@typo3/backend/modal.js";import Severity from"@typo3/backend/severity.js";import RegularEvent from"@typo3/core/event/regular-event.js";class BrowseFolders{constructor(){new RegularEvent("click",(e,r)=>{e.preventDefault();const t=r.dataset.folderId;ElementBrowser.insertElement("",t,t,t,1===parseInt(r.dataset.close||"0",10))}).delegateTo(document,"[data-folder-id]"),new RegularEvent("click",(e,r)=>{e.preventDefault(),Modal.confirm("",r.dataset.message,Severity.error,[],[])}).delegateTo(document,".t3js-folderIdError")}}export default new BrowseFolders; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/clear-cache.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/clear-cache.js new file mode 100644 index 0000000000000000000000000000000000000000..3abcaeef0b8966371e1b6eb51a268e01ab9c2647 --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/clear-cache.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import Notification from"@typo3/backend/notification.js";import Icons from"@typo3/backend/icons.js";import RegularEvent from"@typo3/core/event/regular-event.js";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";var Identifiers;!function(e){e.clearCache=".t3js-clear-page-cache",e.icon=".t3js-icon"}(Identifiers||(Identifiers={}));class ClearCache{static setDisabled(e,t){e.disabled=t,e.classList.toggle("disabled",t)}static sendClearCacheRequest(e){const t=new AjaxRequest(TYPO3.settings.ajaxUrls.web_list_clearpagecache).withQueryArguments({id:e}).get({cache:"no-cache"});return t.then(async e=>{const t=await e.resolve();!0===t.success?Notification.success(t.title,t.message,1):Notification.error(t.title,t.message,1)},()=>{Notification.error("Clearing page caches went wrong on the server side.")}),t}constructor(){this.registerClickHandler()}registerClickHandler(){const e=document.querySelector(Identifiers.clearCache+":not([disabled])");null!==e&&new RegularEvent("click",e=>{e.preventDefault();const t=e.currentTarget,a=parseInt(t.dataset.id,10);ClearCache.setDisabled(t,!0),Icons.getIcon("spinner-circle-dark",Icons.sizes.small,null,"disabled").then(e=>{t.querySelector(Identifiers.icon).outerHTML=e}),ClearCache.sendClearCacheRequest(a).finally(()=>{Icons.getIcon("actions-system-cache-clear",Icons.sizes.small).then(e=>{t.querySelector(Identifiers.icon).outerHTML=e}),ClearCache.setDisabled(t,!1)})}).bindTo(e)}}export default new ClearCache; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/element-browser.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/element-browser.js new file mode 100644 index 0000000000000000000000000000000000000000..33e9a42b9c3e96a5bf4101813e59a5cf9377e335 --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/element-browser.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{MessageUtility}from"@typo3/backend/utility/message-utility.js";import DocumentService from"@typo3/core/document-service.js";import Modal from"@typo3/backend/modal.js";class ElementBrowser{constructor(){this.opener=null,this.formFieldName="",this.fieldReference="",this.rte={parameters:"",configuration:""},this.irre={objectId:""},this.focusOpenerAndClose=()=>{this.getParent()&&this.getParent().focus(),Modal.dismiss(),close()},DocumentService.ready().then(()=>{const e=document.body.dataset;this.formFieldName=e.formFieldName,this.fieldReference=e.fieldReference,this.rte.parameters=e.rteParameters,this.rte.configuration=e.rteConfiguration,this.irre.objectId=e.irreObjectId})}setReferences(){return!!(this.getParent()&&this.getParent().content&&this.getParent().content.document.editform&&this.getParent().content.document.editform[this.formFieldName])&&(this.targetDoc=this.getParent().content.document,this.elRef=this.targetDoc.editform[this.formFieldName],!0)}getParent(){return null===this.opener&&(void 0!==window.parent&&void 0!==window.parent.document.list_frame&&null!==window.parent.document.list_frame.parent.document.querySelector(".t3js-modal-iframe")?this.opener=window.parent.document.list_frame:void 0!==window.parent&&void 0!==window.parent.frames.list_frame&&null!==window.parent.frames.list_frame.parent.document.querySelector(".t3js-modal-iframe")?this.opener=window.parent.frames.list_frame:void 0!==window.frames&&void 0!==window.frames.frameElement&&null!==window.frames.frameElement&&window.frames.frameElement.classList.contains("t3js-modal-iframe")?this.opener=window.frames.frameElement.contentWindow.parent:window.opener&&(this.opener=window.opener)),this.opener}insertElement(e,t,r,n,i){if(this.irre.objectId){if(this.getParent()){const r={actionName:"typo3:foreignRelation:insert",objectGroup:this.irre.objectId,table:e,uid:t};MessageUtility.send(r,this.getParent())}else alert("Error - reference to main window is not set properly!"),this.focusOpenerAndClose();return i&&this.focusOpenerAndClose(),!0}return!this.fieldReference||this.rte.parameters||this.rte.configuration||this.addElement(r,n||e+"_"+t,i),!1}addElement(e,t,r){if(this.getParent()){const n={actionName:"typo3:elementBrowser:elementAdded",fieldName:this.fieldReference,value:t,label:e};MessageUtility.send(n,this.getParent()),r&&this.focusOpenerAndClose()}else alert("Error - reference to main window is not set properly!"),this.focusOpenerAndClose()}}export default new ElementBrowser; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/file-link-handler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/file-link-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..6880eb1311ea126d6a38b39db5388672fd57a1d4 --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/file-link-handler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import LinkBrowser from"@typo3/recordlist/link-browser.js";import RegularEvent from"@typo3/core/event/regular-event.js";class FileLinkHandler{constructor(){new RegularEvent("click",(e,n)=>{e.preventDefault(),LinkBrowser.finalizeFunction(n.getAttribute("href"))}).delegateTo(document,"a.t3js-fileLink"),new RegularEvent("click",(e,n)=>{e.preventDefault(),LinkBrowser.finalizeFunction(document.body.dataset.currentLink)}).delegateTo(document,"input.t3js-linkCurrent")}}export default new FileLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/LinkBrowser.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/link-browser.js similarity index 100% rename from typo3/sysext/recordlist/Resources/Public/JavaScript/LinkBrowser.js rename to typo3/sysext/recordlist/Resources/Public/JavaScript/link-browser.js diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/mail-link-handler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/mail-link-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..a78b1d5f7adba24ea208d313e35790fcaa3b0b0e --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/mail-link-handler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import LinkBrowser from"@typo3/recordlist/link-browser.js";import RegularEvent from"@typo3/core/event/regular-event.js";class MailLinkHandler{constructor(){new RegularEvent("submit",(e,r)=>{e.preventDefault();let t=r.querySelector('[name="lemail"]').value;if("mailto:"!==t){for(;"mailto:"===t.substr(0,7);)t=t.substr(7);LinkBrowser.finalizeFunction("mailto:"+t)}}).delegateTo(document,"#lmailform")}}export default new MailLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/page-link-handler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/page-link-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..612bf0ca9f6e5fcd3e7885d497662f871e05d58a --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/page-link-handler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import LinkBrowser from"@typo3/recordlist/link-browser.js";import RegularEvent from"@typo3/core/event/regular-event.js";class PageLinkHandler{constructor(){this.linkPageByTextfield=()=>{let e=document.getElementById("luid").value;if(!e)return;const t=parseInt(e,10);isNaN(t)||(e="t3://page?uid="+t),LinkBrowser.finalizeFunction(e)},new RegularEvent("click",(e,t)=>{e.preventDefault(),LinkBrowser.finalizeFunction(t.getAttribute("href"))}).delegateTo(document,"a.t3js-pageLink"),new RegularEvent("click",(e,t)=>{e.preventDefault(),LinkBrowser.finalizeFunction(document.body.dataset.currentLink)}).delegateTo(document,"input.t3js-linkCurrent"),new RegularEvent("click",(e,t)=>{e.preventDefault(),this.linkPageByTextfield()}).delegateTo(document,"input.t3js-pageLink")}}export default new PageLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/record-download-button.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/record-download-button.js new file mode 100644 index 0000000000000000000000000000000000000000..e477caef4e5bd3dc12b6132cf3099c75e2e6a4c7 --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/record-download-button.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +var Selectors,__decorate=function(t,e,o,r){var l,n=arguments.length,a=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var d=t.length-1;d>=0;d--)(l=t[d])&&(a=(n<3?l(a):n>3?l(e,o,a):l(e,o))||a);return n>3&&a&&Object.defineProperty(e,o,a),a};import{html,LitElement}from"lit";import{customElement,property}from"lit/decorators.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import Severity from"@typo3/backend/severity.js";import Modal from"@typo3/backend/modal.js";import{lll}from"@typo3/core/lit-helper.js";!function(t){t.formatSelector=".t3js-record-download-format-selector",t.formatOptions=".t3js-record-download-format-option"}(Selectors||(Selectors={}));let RecordDownloadButton=class extends LitElement{constructor(){super(),this.addEventListener("click",t=>{t.preventDefault(),this.showDownloadConfigurationModal()})}render(){return html`<slot></slot>`}showDownloadConfigurationModal(){this.url&&Modal.advanced({content:this.url,title:this.title||"Download records",severity:SeverityEnum.notice,size:Modal.sizes.small,type:Modal.types.ajax,buttons:[{text:this.close||lll("button.close")||"Close",active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>Modal.dismiss()},{text:this.ok||lll("button.ok")||"Download",btnClass:"btn-"+Severity.getCssClass(SeverityEnum.info),name:"download",trigger:()=>{const t=Modal.currentModal[0].querySelector("form");t&&t.submit(),Modal.dismiss()}}],ajaxCallback:()=>{const t=Modal.currentModal[0].querySelector(Selectors.formatSelector),e=Modal.currentModal[0].querySelectorAll(Selectors.formatOptions);null!==t&&e.length&&t.addEventListener("change",t=>{const o=t.target.value;e.forEach(t=>{t.dataset.formatname!==o?t.classList.add("hide"):t.classList.remove("hide")})})}})}};__decorate([property({type:String})],RecordDownloadButton.prototype,"url",void 0),__decorate([property({type:String})],RecordDownloadButton.prototype,"title",void 0),__decorate([property({type:String})],RecordDownloadButton.prototype,"ok",void 0),__decorate([property({type:String})],RecordDownloadButton.prototype,"close",void 0),RecordDownloadButton=__decorate([customElement("typo3-recordlist-record-download-button")],RecordDownloadButton); \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/record-link-handler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/record-link-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..69cc93f8e8e2b13b6d1332fdc85bbcee1bd4b956 --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/record-link-handler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import LinkBrowser from"@typo3/recordlist/link-browser.js";import RegularEvent from"@typo3/core/event/regular-event.js";class RecordLinkHandler{constructor(){new RegularEvent("click",(e,t)=>{e.preventDefault();const n=t.closest("span").dataset;LinkBrowser.finalizeFunction(document.body.dataset.identifier+n.uid)}).delegateTo(document,"[data-close]"),new RegularEvent("click",(e,t)=>{e.preventDefault(),LinkBrowser.finalizeFunction(document.body.dataset.currentLink)}).delegateTo(document,"input.t3js-linkCurrent")}}export default new RecordLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/record-search.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/record-search.js new file mode 100644 index 0000000000000000000000000000000000000000..490987d306b2ff3dba90bdfa81502bccffd8a429 --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/record-search.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import DocumentService from"@typo3/core/document-service.js";import RegularEvent from"@typo3/core/event/regular-event.js";var Selectors;!function(e){e.searchFieldSelector="#search_field"}(Selectors||(Selectors={}));class RecordSearch{constructor(){this.searchField=document.querySelector(Selectors.searchFieldSelector),this.activeSearch=!!this.searchField&&""!==this.searchField.value,DocumentService.ready().then(()=>{this.searchField&&new RegularEvent("search",()=>{""===this.searchField.value&&this.activeSearch&&this.searchField.closest("form").submit()}).bindTo(this.searchField)})}}export default new RecordSearch; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/recordlist.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/recordlist.js new file mode 100644 index 0000000000000000000000000000000000000000..314ac63d8af8f68f048b37304cf43f73dae2489b --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/recordlist.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Icons from"@typo3/backend/icons.js";import PersistentStorage from"@typo3/backend/storage/persistent.js";import RegularEvent from"@typo3/core/event/regular-event.js";import Tooltip from"@typo3/backend/tooltip.js";import DocumentService from"@typo3/core/document-service.js";import Modal from"@typo3/backend/modal.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import Severity from"@typo3/backend/severity.js";class Recordlist{constructor(){this.identifier={entity:".t3js-entity",toggle:".t3js-toggle-recordlist",localize:".t3js-action-localize",searchboxToolbar:"#db_list-searchbox-toolbar",searchboxToggle:".t3js-toggle-search-toolbox",searchField:"#search_field",icons:{collapse:"actions-view-list-collapse",expand:"actions-view-list-expand",editMultiple:".t3js-record-edit-multiple"}},this.toggleClick=e=>{e.preventDefault();const t=$(e.currentTarget),i=t.data("table"),o=$(t.data("bs-target")),a="expanded"===o.data("state"),n=t.find(".collapseIcon"),l=a?this.identifier.icons.expand:this.identifier.icons.collapse;Icons.getIcon(l,Icons.sizes.small).then(e=>{n.html(e)});let r={};PersistentStorage.isset("moduleData.web_list.collapsedTables")&&(r=PersistentStorage.get("moduleData.web_list.collapsedTables"));const s={};s[i]=a?1:0,$.extend(r,s),PersistentStorage.set("moduleData.web_list.collapsedTables",r).done(()=>{o.data("state",a?"collapsed":"expanded")})},this.onEditMultiple=e=>{e.preventDefault();let t="",i="",o="",a=[];if("multiRecordSelection:action:edit"===e.type){const o=e.detail,n=o.configuration;if(i=n.returnUrl||"",t=n.tableName||"",""===t)return;o.checkboxes.forEach(e=>{const t=e.closest("tr");null!==t&&t.dataset[n.idField]&&a.push(t.dataset[n.idField])})}else{const n=e.currentTarget,l=n.closest("[data-table]");if(null===l)return;if(t=l.dataset.table||"",""===t)return;i=n.dataset.returnUrl||"",o=n.dataset.columnsOnly||"";const r=l.querySelectorAll(this.identifier.entity+'[data-uid][data-table="'+t+'"] td.col-selector input[type="checkbox"]:checked');if(r.length)r.forEach(e=>{a.push(e.closest(this.identifier.entity+'[data-uid][data-table="'+t+'"]').dataset.uid)});else{const e=l.querySelectorAll(this.identifier.entity+'[data-uid][data-table="'+t+'"]');if(!e.length)return;e.forEach(e=>{a.push(e.dataset.uid)})}}if(!a.length)return;let n=top.TYPO3.settings.FormEngine.moduleUrl+"&edit["+t+"]["+a.join(",")+"]=edit&returnUrl="+Recordlist.getReturnUrl(i);""!==o&&(n+="&columnsOnly="+o),window.location.href=n},this.disableButton=e=>{$(e.currentTarget).prop("disable",!0).addClass("disabled")},this.toggleSearchbox=()=>{const e=$(this.identifier.searchboxToolbar);e.toggle(),e.is(":visible")&&$(this.identifier.searchField).focus()},this.deleteRow=e=>{const t=$(`table[data-table="${e.table}"]`),i=t.find(`tr[data-uid="${e.uid}"]`),o=t.closest(".panel"),a=o.find(".panel-heading"),n=t.find(`[data-l10nparent="${e.uid}"]`),l=$().add(i).add(n);if(l.fadeTo("slow",.4,()=>{l.slideUp("slow",()=>{l.remove(),0===t.find("tbody tr").length&&o.slideUp("slow")})}),"0"===i.data("l10nparent")||""===i.data("l10nparent")){const e=Number(a.find(".t3js-table-total-items").html());a.find(".t3js-table-total-items").text(e-1)}"pages"===e.table&&top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))},this.registerPaginationEvents=()=>{document.querySelectorAll(".t3js-recordlist-paging").forEach(e=>{e.addEventListener("keyup",t=>{t.preventDefault();let i=parseInt(e.value,10);i<parseInt(e.min,10)&&(i=parseInt(e.min,10)),i>parseInt(e.max,10)&&(i=parseInt(e.max,10)),"Enter"===t.key&&i!==parseInt(e.dataset.currentpage,10)&&(window.location.href=e.dataset.currenturl+i.toString())})})},$(document).on("click",this.identifier.toggle,this.toggleClick),$(document).on("click",this.identifier.icons.editMultiple,this.onEditMultiple),$(document).on("click",this.identifier.localize,this.disableButton),$(document).on("click",this.identifier.searchboxToggle,this.toggleSearchbox),DocumentService.ready().then(()=>{Tooltip.initialize(".table-fit a[title]"),this.registerPaginationEvents()}),new RegularEvent("typo3:datahandler:process",this.handleDataHandlerResult.bind(this)).bindTo(document),new RegularEvent("multiRecordSelection:action:edit",this.onEditMultiple).bindTo(document),new RegularEvent("multiRecordSelection:action:delete",this.deleteMultiple).bindTo(document),new RegularEvent("multiRecordSelection:action:copyMarked",e=>{Recordlist.submitClipboardFormWithCommand("copyMarked",e.target)}).bindTo(document),new RegularEvent("multiRecordSelection:action:removeMarked",e=>{Recordlist.submitClipboardFormWithCommand("removeMarked",e.target)}).bindTo(document)}static submitClipboardFormWithCommand(e,t){const i=t.closest("form");if(!i)return;const o=i.querySelector('input[name="cmd"]');o&&(o.value=e,i.submit())}static getReturnUrl(e){return""===e&&(e=top.list_frame.document.location.pathname+top.list_frame.document.location.search),encodeURIComponent(e)}handleDataHandlerResult(e){const t=e.detail.payload;t.hasErrors||"datahandler"!==t.component&&"delete"===t.action&&this.deleteRow(t)}deleteMultiple(e){e.preventDefault();const t=e.detail.configuration;Modal.advanced({title:t.title||"Delete",content:t.content||"Are you sure you want to delete those records?",severity:SeverityEnum.warning,buttons:[{text:TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:()=>Modal.currentModal.trigger("modal-dismiss")},{text:t.ok||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+Severity.getCssClass(SeverityEnum.warning),trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),Recordlist.submitClipboardFormWithCommand("delete",e.target)}}]})}}export default new Recordlist; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/telephone-link-handler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/telephone-link-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..8b7344e0eb1637af49385da6ff0a4ee2f88feb33 --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/telephone-link-handler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import LinkBrowser from"@typo3/recordlist/link-browser.js";import RegularEvent from"@typo3/core/event/regular-event.js";class TelephoneLinkHandler{constructor(){new RegularEvent("submit",(e,t)=>{e.preventDefault();let r=t.querySelector('[name="ltelephone"]').value;"tel:"!==r&&(r.startsWith("tel:")&&(r=r.substr(4)),LinkBrowser.finalizeFunction("tel:"+r))}).delegateTo(document,"#ltelephoneform")}}export default new TelephoneLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recordlist/Resources/Public/JavaScript/url-link-handler.js b/typo3/sysext/recordlist/Resources/Public/JavaScript/url-link-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..b56b5d1764ff69ba561097c5842ffbbd28595f2a --- /dev/null +++ b/typo3/sysext/recordlist/Resources/Public/JavaScript/url-link-handler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import LinkBrowser from"@typo3/recordlist/link-browser.js";import RegularEvent from"@typo3/core/event/regular-event.js";class UrlLinkHandler{constructor(){new RegularEvent("submit",(e,r)=>{e.preventDefault();let l=r.querySelector('[name="lurl"]').value;""!==l&&LinkBrowser.finalizeFunction(l)}).delegateTo(document,"#lurlform")}}export default new UrlLinkHandler; \ No newline at end of file diff --git a/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php b/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php index 33f0e852b891af2328f281fdfdadd91e71a7abb4..36388f4d88d9eb288930347250e9be795e3ae486 100644 --- a/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php +++ b/typo3/sysext/recycler/Classes/Controller/RecyclerModuleController.php @@ -72,8 +72,8 @@ class RecyclerModuleController 'tableSelection' => ($sessionData['tableSelection'] ?? false) ?: '', ]); $this->pageRenderer->addInlineLanguageLabelFile('EXT:recycler/Resources/Private/Language/locallang.xlf'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Recycler/Recycler.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/MultiRecordSelection.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/recycler/recycler.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/multi-record-selection.js'); if ($backendUser->workspace !== 0 && (($id && $pageRecord !== []) || (!$id && $backendUser->isAdmin())) diff --git a/typo3/sysext/recycler/Configuration/JavaScriptModules.php b/typo3/sysext/recycler/Configuration/JavaScriptModules.php index 60ddb2f5c99bcf9eb1d86de5d11c2369261c5a31..5fb10a7e8fc44d0d9517440fc4d46cf481df25f0 100644 --- a/typo3/sysext/recycler/Configuration/JavaScriptModules.php +++ b/typo3/sysext/recycler/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Recycler/' => 'EXT:recycler/Resources/Public/JavaScript/', + '@typo3/recycler/' => 'EXT:recycler/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js b/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js deleted file mode 100644 index 9a30b0f5d909ed58b3379d63ac9d637840bf747f..0000000000000000000000000000000000000000 --- a/typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import NProgress from"nprogress";import"TYPO3/CMS/Backend/Input/Clearable.js";import"TYPO3/CMS/Backend/Element/IconElement.js";import DeferredAction from"TYPO3/CMS/Backend/ActionButton/DeferredAction.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Notification from"TYPO3/CMS/Backend/Notification.js";import Severity from"TYPO3/CMS/Backend/Severity.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var RecyclerIdentifiers;!function(e){e.searchForm="#recycler-form",e.searchText="#recycler-form [name=search-text]",e.searchSubmitBtn="#recycler-form button[type=submit]",e.depthSelector="#recycler-form [name=depth]",e.tableSelector="#recycler-form [name=pages]",e.recyclerTable="#itemsInRecycler",e.paginator="#recycler-index nav",e.reloadAction="a[data-action=reload]",e.undo="a[data-action=undo]",e.delete="a[data-action=delete]",e.massUndo="button[data-multi-record-selection-action=massundo]",e.massDelete="button[data-multi-record-selection-action=massdelete]"}(RecyclerIdentifiers||(RecyclerIdentifiers={}));class Recycler{constructor(){this.elements={},this.paging={currentPage:1,totalPages:1,totalItems:0,itemsPerPage:TYPO3.settings.Recycler.pagingSize},this.markedRecordsForMassAction=[],this.handleCheckboxStateChanged=e=>{const t=$(e.target),a=t.parents("tr"),s=a.data("table")+":"+a.data("uid");if(t.prop("checked"))this.markedRecordsForMassAction.push(s);else{const e=this.markedRecordsForMassAction.indexOf(s);e>-1&&this.markedRecordsForMassAction.splice(e,1)}this.markedRecordsForMassAction.length>0?(this.elements.$massUndo.find("span.text").text(this.createMessage(TYPO3.lang["button.undoselected"],[this.markedRecordsForMassAction.length])),this.elements.$massDelete.find("span.text").text(this.createMessage(TYPO3.lang["button.deleteselected"],[this.markedRecordsForMassAction.length]))):this.resetMassActionButtons()},this.deleteRecord=e=>{if(TYPO3.settings.Recycler.deleteDisable)return;const t=$(e.target).parents("tr"),a="TBODY"!==t.parent().prop("tagName");let s,n;if(a)s=this.markedRecordsForMassAction,n=TYPO3.lang["modal.massdelete.text"];else{const e=t.data("uid"),a=t.data("table"),i=t.data("recordtitle");s=[a+":"+e],n="pages"===a?TYPO3.lang["modal.deletepage.text"]:TYPO3.lang["modal.deletecontent.text"],n=this.createMessage(n,[i,"["+s[0]+"]"])}Modal.confirm(TYPO3.lang["modal.delete.header"],n,Severity.error,[{text:TYPO3.lang["button.cancel"],btnClass:"btn-default",trigger:function(){Modal.dismiss()}},{text:TYPO3.lang["button.delete"],btnClass:"btn-danger",action:new DeferredAction(()=>Promise.resolve(this.callAjaxAction("delete",s,a)))}])},this.undoRecord=e=>{const t=$(e.target).parents("tr"),a="TBODY"!==t.parent().prop("tagName");let s,n,i;if(a)s=this.markedRecordsForMassAction,n=TYPO3.lang["modal.massundo.text"],i=!0;else{const e=t.data("uid"),a=t.data("table"),r=t.data("recordtitle");s=[a+":"+e],i="pages"===a,n=i?TYPO3.lang["modal.undopage.text"]:TYPO3.lang["modal.undocontent.text"],n=this.createMessage(n,[r,"["+s[0]+"]"]),i&&t.data("parentDeleted")&&(n+=TYPO3.lang["modal.undo.parentpages"])}let r=null;r=i?$("<div />").append($("<p />").text(n),$("<div />",{class:"checkbox"}).append($("<label />").append(TYPO3.lang["modal.undo.recursive"]).prepend($("<input />",{id:"undo-recursive",type:"checkbox"})))):$("<p />").text(n),Modal.confirm(TYPO3.lang["modal.undo.header"],r,Severity.ok,[{text:TYPO3.lang["button.cancel"],btnClass:"btn-default",trigger:function(){Modal.dismiss()}},{text:TYPO3.lang["button.undo"],btnClass:"btn-success",action:new DeferredAction(()=>Promise.resolve(this.callAjaxAction("undo","object"==typeof s?s:[s],a,r.find("#undo-recursive").prop("checked"))))}])},$(()=>{this.initialize()})}static refreshPageTree(){top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}getElements(){this.elements={$searchForm:$(RecyclerIdentifiers.searchForm),$searchTextField:$(RecyclerIdentifiers.searchText),$searchSubmitBtn:$(RecyclerIdentifiers.searchSubmitBtn),$depthSelector:$(RecyclerIdentifiers.depthSelector),$tableSelector:$(RecyclerIdentifiers.tableSelector),$recyclerTable:$(RecyclerIdentifiers.recyclerTable),$tableBody:$(RecyclerIdentifiers.recyclerTable).find("tbody"),$paginator:$(RecyclerIdentifiers.paginator),$reloadAction:$(RecyclerIdentifiers.reloadAction),$massUndo:$(RecyclerIdentifiers.massUndo),$massDelete:$(RecyclerIdentifiers.massDelete)}}registerEvents(){this.elements.$searchForm.on("submit",e=>{e.preventDefault(),""!==this.elements.$searchTextField.val()&&this.loadDeletedElements()}),this.elements.$searchTextField.on("keyup",e=>{""!==$(e.currentTarget).val()?this.elements.$searchSubmitBtn.removeClass("disabled"):(this.elements.$searchSubmitBtn.addClass("disabled"),this.loadDeletedElements())}),this.elements.$searchTextField.get(0).clearable({onClear:()=>{this.elements.$searchSubmitBtn.addClass("disabled"),this.loadDeletedElements()}}),this.elements.$depthSelector.on("change",()=>{$.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}),this.elements.$tableSelector.on("change",()=>{this.paging.currentPage=1,this.loadDeletedElements()}),new RegularEvent("click",this.undoRecord).delegateTo(document,RecyclerIdentifiers.undo),new RegularEvent("click",this.deleteRecord).delegateTo(document,RecyclerIdentifiers.delete),this.elements.$reloadAction.on("click",e=>{e.preventDefault(),$.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}),this.elements.$paginator.on("click","[data-action]",e=>{e.preventDefault();const t=$(e.currentTarget);let a=!1;switch(t.data("action")){case"previous":this.paging.currentPage>1&&(this.paging.currentPage--,a=!0);break;case"next":this.paging.currentPage<this.paging.totalPages&&(this.paging.currentPage++,a=!0);break;case"page":this.paging.currentPage=parseInt(t.find("span").text(),10),a=!0}a&&this.loadDeletedElements()}),TYPO3.settings.Recycler.deleteDisable?this.elements.$massDelete.remove():this.elements.$massDelete.show(),new RegularEvent("multiRecordSelection:checkbox:state:changed",this.handleCheckboxStateChanged).bindTo(document),new RegularEvent("multiRecordSelection:action:massundo",this.undoRecord).bindTo(document),new RegularEvent("multiRecordSelection:action:massdelete",this.deleteRecord).bindTo(document)}initialize(){NProgress.configure({parent:".module-loading-indicator",showSpinner:!1}),this.getElements(),this.registerEvents(),TYPO3.settings.Recycler.depthSelection>0?this.elements.$depthSelector.val(TYPO3.settings.Recycler.depthSelection).trigger("change"):$.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}resetMassActionButtons(){this.markedRecordsForMassAction=[],this.elements.$massUndo.find("span.text").text(TYPO3.lang["button.undo"]),this.elements.$massDelete.find("span.text").text(TYPO3.lang["button.delete"]),document.dispatchEvent(new CustomEvent("multiRecordSelection:actions:hide"))}loadAvailableTables(){return $.ajax({url:TYPO3.settings.ajaxUrls.recycler,dataType:"json",data:{action:"getTables",startUid:TYPO3.settings.Recycler.startUid,depth:this.elements.$depthSelector.find("option:selected").val()},beforeSend:()=>{NProgress.start(),this.elements.$tableSelector.val(""),this.paging.currentPage=1},success:e=>{const t=[];this.elements.$tableSelector.children().remove(),$.each(e,(e,a)=>{const s=a[0],n=a[1],i=(a[2]?a[2]:TYPO3.lang.label_allrecordtypes)+" ("+n+")";t.push($("<option />").val(s).text(i))}),t.length>0&&(this.elements.$tableSelector.append(t),""!==TYPO3.settings.Recycler.tableSelection&&this.elements.$tableSelector.val(TYPO3.settings.Recycler.tableSelection))},complete:()=>{NProgress.done()}})}loadDeletedElements(){return $.ajax({url:TYPO3.settings.ajaxUrls.recycler,dataType:"json",data:{action:"getDeletedRecords",depth:this.elements.$depthSelector.find("option:selected").val(),startUid:TYPO3.settings.Recycler.startUid,table:this.elements.$tableSelector.find("option:selected").val(),filterTxt:this.elements.$searchTextField.val(),start:(this.paging.currentPage-1)*this.paging.itemsPerPage,limit:this.paging.itemsPerPage},beforeSend:()=>{NProgress.start(),this.resetMassActionButtons()},success:e=>{this.elements.$tableBody.html(e.rows),this.buildPaginator(e.totalItems)},complete:()=>{NProgress.done()}})}callAjaxAction(e,t,a,s=!1){let n={records:t,action:""},i=!1;if("undo"===e)n.action="undoRecords",n.recursive=s?1:0,i=!0;else{if("delete"!==e)return;n.action="deleteRecords"}return $.ajax({url:TYPO3.settings.ajaxUrls.recycler,type:"POST",dataType:"json",data:n,beforeSend:()=>{NProgress.start()},success:e=>{e.success?Notification.success("",e.message):Notification.error("",e.message),this.paging.currentPage=1,$.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements(),a&&this.resetMassActionButtons(),i&&Recycler.refreshPageTree()})},complete:()=>{NProgress.done()}})}createMessage(e,t){return void 0===e?"":e.replace(/\{([0-9]+)\}/g,(function(e,a){return t[a]}))}buildPaginator(e){if(0===e)return void this.elements.$paginator.contents().remove();if(this.paging.totalItems=e,this.paging.totalPages=Math.ceil(e/this.paging.itemsPerPage),1===this.paging.totalPages)return void this.elements.$paginator.contents().remove();const t=$("<ul />",{class:"pagination"}),a=[],s=$("<li />",{class:"page-item"}).append($("<button />",{class:"page-link",type:"button","data-action":"previous"}).append($("<typo3-backend-icon />",{identifier:"actions-arrow-left-alt",size:"small"}))),n=$("<li />",{class:"page-item"}).append($("<button />",{class:"page-link",type:"button","data-action":"next"}).append($("<typo3-backend-icon />",{identifier:"actions-arrow-right-alt",size:"small"})));1===this.paging.currentPage&&s.disablePagingAction(),this.paging.currentPage===this.paging.totalPages&&n.disablePagingAction();for(let e=1;e<=this.paging.totalPages;e++){const t=$("<li />",{class:"page-item"+(this.paging.currentPage===e?" active":"")});t.append($("<button />",{class:"page-link",type:"button","data-action":"page"}).append($("<span />").text(e))),a.push(t)}t.append(s,a,n),this.elements.$paginator.html(t)}}$.fn.disablePagingAction=function(){$(this).addClass("disabled").find("button").prop("disabled",!0)};export default new Recycler; \ No newline at end of file diff --git a/typo3/sysext/recycler/Resources/Public/JavaScript/recycler.js b/typo3/sysext/recycler/Resources/Public/JavaScript/recycler.js new file mode 100644 index 0000000000000000000000000000000000000000..8b0fdf3d39d28652bdb3930ab525bcbe42a7e1ca --- /dev/null +++ b/typo3/sysext/recycler/Resources/Public/JavaScript/recycler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import NProgress from"nprogress";import"@typo3/backend/input/clearable.js";import"@typo3/backend/element/icon-element.js";import DeferredAction from"@typo3/backend/action-button/deferred-action.js";import Modal from"@typo3/backend/modal.js";import Notification from"@typo3/backend/notification.js";import Severity from"@typo3/backend/severity.js";import RegularEvent from"@typo3/core/event/regular-event.js";var RecyclerIdentifiers;!function(e){e.searchForm="#recycler-form",e.searchText="#recycler-form [name=search-text]",e.searchSubmitBtn="#recycler-form button[type=submit]",e.depthSelector="#recycler-form [name=depth]",e.tableSelector="#recycler-form [name=pages]",e.recyclerTable="#itemsInRecycler",e.paginator="#recycler-index nav",e.reloadAction="a[data-action=reload]",e.undo="a[data-action=undo]",e.delete="a[data-action=delete]",e.massUndo="button[data-multi-record-selection-action=massundo]",e.massDelete="button[data-multi-record-selection-action=massdelete]"}(RecyclerIdentifiers||(RecyclerIdentifiers={}));class Recycler{constructor(){this.elements={},this.paging={currentPage:1,totalPages:1,totalItems:0,itemsPerPage:TYPO3.settings.Recycler.pagingSize},this.markedRecordsForMassAction=[],this.handleCheckboxStateChanged=e=>{const t=$(e.target),a=t.parents("tr"),s=a.data("table")+":"+a.data("uid");if(t.prop("checked"))this.markedRecordsForMassAction.push(s);else{const e=this.markedRecordsForMassAction.indexOf(s);e>-1&&this.markedRecordsForMassAction.splice(e,1)}this.markedRecordsForMassAction.length>0?(this.elements.$massUndo.find("span.text").text(this.createMessage(TYPO3.lang["button.undoselected"],[this.markedRecordsForMassAction.length])),this.elements.$massDelete.find("span.text").text(this.createMessage(TYPO3.lang["button.deleteselected"],[this.markedRecordsForMassAction.length]))):this.resetMassActionButtons()},this.deleteRecord=e=>{if(TYPO3.settings.Recycler.deleteDisable)return;const t=$(e.target).parents("tr"),a="TBODY"!==t.parent().prop("tagName");let s,n;if(a)s=this.markedRecordsForMassAction,n=TYPO3.lang["modal.massdelete.text"];else{const e=t.data("uid"),a=t.data("table"),i=t.data("recordtitle");s=[a+":"+e],n="pages"===a?TYPO3.lang["modal.deletepage.text"]:TYPO3.lang["modal.deletecontent.text"],n=this.createMessage(n,[i,"["+s[0]+"]"])}Modal.confirm(TYPO3.lang["modal.delete.header"],n,Severity.error,[{text:TYPO3.lang["button.cancel"],btnClass:"btn-default",trigger:function(){Modal.dismiss()}},{text:TYPO3.lang["button.delete"],btnClass:"btn-danger",action:new DeferredAction(()=>Promise.resolve(this.callAjaxAction("delete",s,a)))}])},this.undoRecord=e=>{const t=$(e.target).parents("tr"),a="TBODY"!==t.parent().prop("tagName");let s,n,i;if(a)s=this.markedRecordsForMassAction,n=TYPO3.lang["modal.massundo.text"],i=!0;else{const e=t.data("uid"),a=t.data("table"),r=t.data("recordtitle");s=[a+":"+e],i="pages"===a,n=i?TYPO3.lang["modal.undopage.text"]:TYPO3.lang["modal.undocontent.text"],n=this.createMessage(n,[r,"["+s[0]+"]"]),i&&t.data("parentDeleted")&&(n+=TYPO3.lang["modal.undo.parentpages"])}let r=null;r=i?$("<div />").append($("<p />").text(n),$("<div />",{class:"checkbox"}).append($("<label />").append(TYPO3.lang["modal.undo.recursive"]).prepend($("<input />",{id:"undo-recursive",type:"checkbox"})))):$("<p />").text(n),Modal.confirm(TYPO3.lang["modal.undo.header"],r,Severity.ok,[{text:TYPO3.lang["button.cancel"],btnClass:"btn-default",trigger:function(){Modal.dismiss()}},{text:TYPO3.lang["button.undo"],btnClass:"btn-success",action:new DeferredAction(()=>Promise.resolve(this.callAjaxAction("undo","object"==typeof s?s:[s],a,r.find("#undo-recursive").prop("checked"))))}])},$(()=>{this.initialize()})}static refreshPageTree(){top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}getElements(){this.elements={$searchForm:$(RecyclerIdentifiers.searchForm),$searchTextField:$(RecyclerIdentifiers.searchText),$searchSubmitBtn:$(RecyclerIdentifiers.searchSubmitBtn),$depthSelector:$(RecyclerIdentifiers.depthSelector),$tableSelector:$(RecyclerIdentifiers.tableSelector),$recyclerTable:$(RecyclerIdentifiers.recyclerTable),$tableBody:$(RecyclerIdentifiers.recyclerTable).find("tbody"),$paginator:$(RecyclerIdentifiers.paginator),$reloadAction:$(RecyclerIdentifiers.reloadAction),$massUndo:$(RecyclerIdentifiers.massUndo),$massDelete:$(RecyclerIdentifiers.massDelete)}}registerEvents(){this.elements.$searchForm.on("submit",e=>{e.preventDefault(),""!==this.elements.$searchTextField.val()&&this.loadDeletedElements()}),this.elements.$searchTextField.on("keyup",e=>{""!==$(e.currentTarget).val()?this.elements.$searchSubmitBtn.removeClass("disabled"):(this.elements.$searchSubmitBtn.addClass("disabled"),this.loadDeletedElements())}),this.elements.$searchTextField.get(0).clearable({onClear:()=>{this.elements.$searchSubmitBtn.addClass("disabled"),this.loadDeletedElements()}}),this.elements.$depthSelector.on("change",()=>{$.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}),this.elements.$tableSelector.on("change",()=>{this.paging.currentPage=1,this.loadDeletedElements()}),new RegularEvent("click",this.undoRecord).delegateTo(document,RecyclerIdentifiers.undo),new RegularEvent("click",this.deleteRecord).delegateTo(document,RecyclerIdentifiers.delete),this.elements.$reloadAction.on("click",e=>{e.preventDefault(),$.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}),this.elements.$paginator.on("click","[data-action]",e=>{e.preventDefault();const t=$(e.currentTarget);let a=!1;switch(t.data("action")){case"previous":this.paging.currentPage>1&&(this.paging.currentPage--,a=!0);break;case"next":this.paging.currentPage<this.paging.totalPages&&(this.paging.currentPage++,a=!0);break;case"page":this.paging.currentPage=parseInt(t.find("span").text(),10),a=!0}a&&this.loadDeletedElements()}),TYPO3.settings.Recycler.deleteDisable?this.elements.$massDelete.remove():this.elements.$massDelete.show(),new RegularEvent("multiRecordSelection:checkbox:state:changed",this.handleCheckboxStateChanged).bindTo(document),new RegularEvent("multiRecordSelection:action:massundo",this.undoRecord).bindTo(document),new RegularEvent("multiRecordSelection:action:massdelete",this.deleteRecord).bindTo(document)}initialize(){NProgress.configure({parent:".module-loading-indicator",showSpinner:!1}),this.getElements(),this.registerEvents(),TYPO3.settings.Recycler.depthSelection>0?this.elements.$depthSelector.val(TYPO3.settings.Recycler.depthSelection).trigger("change"):$.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements()})}resetMassActionButtons(){this.markedRecordsForMassAction=[],this.elements.$massUndo.find("span.text").text(TYPO3.lang["button.undo"]),this.elements.$massDelete.find("span.text").text(TYPO3.lang["button.delete"]),document.dispatchEvent(new CustomEvent("multiRecordSelection:actions:hide"))}loadAvailableTables(){return $.ajax({url:TYPO3.settings.ajaxUrls.recycler,dataType:"json",data:{action:"getTables",startUid:TYPO3.settings.Recycler.startUid,depth:this.elements.$depthSelector.find("option:selected").val()},beforeSend:()=>{NProgress.start(),this.elements.$tableSelector.val(""),this.paging.currentPage=1},success:e=>{const t=[];this.elements.$tableSelector.children().remove(),$.each(e,(e,a)=>{const s=a[0],n=a[1],i=(a[2]?a[2]:TYPO3.lang.label_allrecordtypes)+" ("+n+")";t.push($("<option />").val(s).text(i))}),t.length>0&&(this.elements.$tableSelector.append(t),""!==TYPO3.settings.Recycler.tableSelection&&this.elements.$tableSelector.val(TYPO3.settings.Recycler.tableSelection))},complete:()=>{NProgress.done()}})}loadDeletedElements(){return $.ajax({url:TYPO3.settings.ajaxUrls.recycler,dataType:"json",data:{action:"getDeletedRecords",depth:this.elements.$depthSelector.find("option:selected").val(),startUid:TYPO3.settings.Recycler.startUid,table:this.elements.$tableSelector.find("option:selected").val(),filterTxt:this.elements.$searchTextField.val(),start:(this.paging.currentPage-1)*this.paging.itemsPerPage,limit:this.paging.itemsPerPage},beforeSend:()=>{NProgress.start(),this.resetMassActionButtons()},success:e=>{this.elements.$tableBody.html(e.rows),this.buildPaginator(e.totalItems)},complete:()=>{NProgress.done()}})}callAjaxAction(e,t,a,s=!1){let n={records:t,action:""},i=!1;if("undo"===e)n.action="undoRecords",n.recursive=s?1:0,i=!0;else{if("delete"!==e)return;n.action="deleteRecords"}return $.ajax({url:TYPO3.settings.ajaxUrls.recycler,type:"POST",dataType:"json",data:n,beforeSend:()=>{NProgress.start()},success:e=>{e.success?Notification.success("",e.message):Notification.error("",e.message),this.paging.currentPage=1,$.when(this.loadAvailableTables()).done(()=>{this.loadDeletedElements(),a&&this.resetMassActionButtons(),i&&Recycler.refreshPageTree()})},complete:()=>{NProgress.done()}})}createMessage(e,t){return void 0===e?"":e.replace(/\{([0-9]+)\}/g,(function(e,a){return t[a]}))}buildPaginator(e){if(0===e)return void this.elements.$paginator.contents().remove();if(this.paging.totalItems=e,this.paging.totalPages=Math.ceil(e/this.paging.itemsPerPage),1===this.paging.totalPages)return void this.elements.$paginator.contents().remove();const t=$("<ul />",{class:"pagination"}),a=[],s=$("<li />",{class:"page-item"}).append($("<button />",{class:"page-link",type:"button","data-action":"previous"}).append($("<typo3-backend-icon />",{identifier:"actions-arrow-left-alt",size:"small"}))),n=$("<li />",{class:"page-item"}).append($("<button />",{class:"page-link",type:"button","data-action":"next"}).append($("<typo3-backend-icon />",{identifier:"actions-arrow-right-alt",size:"small"})));1===this.paging.currentPage&&s.disablePagingAction(),this.paging.currentPage===this.paging.totalPages&&n.disablePagingAction();for(let e=1;e<=this.paging.totalPages;e++){const t=$("<li />",{class:"page-item"+(this.paging.currentPage===e?" active":"")});t.append($("<button />",{class:"page-link",type:"button","data-action":"page"}).append($("<span />").text(e))),a.push(t)}t.append(s,a,n),this.elements.$paginator.html(t)}}$.fn.disablePagingAction=function(){$(this).addClass("disabled").find("button").prop("disabled",!0)};export default new Recycler; \ No newline at end of file diff --git a/typo3/sysext/redirects/Classes/Evaluation/SourceHost.php b/typo3/sysext/redirects/Classes/Evaluation/SourceHost.php index 8d26943cb976b522f7028282263a5c4c0fb074ec..c054b2e5b08ba01c5877d22f0dedf94d6e6992a3 100644 --- a/typo3/sysext/redirects/Classes/Evaluation/SourceHost.php +++ b/typo3/sysext/redirects/Classes/Evaluation/SourceHost.php @@ -40,7 +40,7 @@ class SourceHost */ public function returnFieldJS(): JavaScriptModuleInstruction { - return JavaScriptModuleInstruction::create('TYPO3/CMS/Redirects/FormEngineEvaluation.js', 'FormEngineEvaluation'); + return JavaScriptModuleInstruction::create('@typo3/redirects/form-engine-evaluation.js', 'FormEngineEvaluation'); } /** diff --git a/typo3/sysext/redirects/Classes/Hooks/BackendControllerHook.php b/typo3/sysext/redirects/Classes/Hooks/BackendControllerHook.php index 5e02e0b69be488fabb2826d04f602927525cfe8b..cdb2ae15bcb8990348f8bab0da85dfbf9378578b 100644 --- a/typo3/sysext/redirects/Classes/Hooks/BackendControllerHook.php +++ b/typo3/sysext/redirects/Classes/Hooks/BackendControllerHook.php @@ -28,7 +28,7 @@ class BackendControllerHook public function registerClientSideEventHandler(): void { $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class); - $pageRenderer->loadJavaScriptModule('TYPO3/CMS/Redirects/EventHandler.js'); + $pageRenderer->loadJavaScriptModule('@typo3/redirects/event-handler.js'); $pageRenderer->addInlineLanguageLabelFile('EXT:redirects/Resources/Private/Language/locallang_slug_service.xlf'); } } diff --git a/typo3/sysext/redirects/Classes/Hooks/DispatchNotificationHook.php b/typo3/sysext/redirects/Classes/Hooks/DispatchNotificationHook.php index ec48b6cb149205543c31104457d1713e6d337bff..a78cda8f41fc7734bcfa71c0f003509dc9aa711a 100644 --- a/typo3/sysext/redirects/Classes/Hooks/DispatchNotificationHook.php +++ b/typo3/sysext/redirects/Classes/Hooks/DispatchNotificationHook.php @@ -38,7 +38,7 @@ final class DispatchNotificationHook $javaScriptRenderer->addJavaScriptModuleInstruction( // @todo refactor to directly invoke the redirects slugChanged() method // instead of dispatching an event that is only catched by the event dispatcher itself - JavaScriptModuleInstruction::create('TYPO3/CMS/Redirects/EventHandler.js') + JavaScriptModuleInstruction::create('@typo3/redirects/event-handler.js') ->addFlags(JavaScriptModuleInstruction::FLAG_USE_TOP_WINDOW) ->invoke('dispatchCustomEvent', 'typo3:redirects:slugChanged', $params['parameter']) ); diff --git a/typo3/sysext/redirects/Configuration/JavaScriptModules.php b/typo3/sysext/redirects/Configuration/JavaScriptModules.php index 95dbf725e65b782473b53a9439ce72d2c052d76c..d7822d106e72ba11194802aa90aa094abd58cf90 100644 --- a/typo3/sysext/redirects/Configuration/JavaScriptModules.php +++ b/typo3/sysext/redirects/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Redirects/' => 'EXT:redirects/Resources/Public/JavaScript/', + '@typo3/redirects/' => 'EXT:redirects/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/redirects/Resources/Private/Templates/Management/Overview.html b/typo3/sysext/redirects/Resources/Private/Templates/Management/Overview.html index b28825ff4240daa1e623c53171ac17f9b2943208..debf73d8e508a313b150875405af7126243b2f60 100644 --- a/typo3/sysext/redirects/Resources/Private/Templates/Management/Overview.html +++ b/typo3/sysext/redirects/Resources/Private/Templates/Management/Overview.html @@ -10,8 +10,8 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Modal.js', - 1: 'TYPO3/CMS/Redirects/RedirectsModule.js' + 0: '@typo3/backend/modal.js', + 1: '@typo3/redirects/redirects-module.js' }" /> <h1><f:translate key="LLL:EXT:redirects/Resources/Private/Language/locallang_module_redirect.xlf:heading_text"/></h1> diff --git a/typo3/sysext/redirects/Resources/Public/JavaScript/EventHandler.js b/typo3/sysext/redirects/Resources/Public/JavaScript/EventHandler.js deleted file mode 100644 index 24332dc4abd869983adb88ba58ea4f9dad1c13f3..0000000000000000000000000000000000000000 --- a/typo3/sysext/redirects/Resources/Public/JavaScript/EventHandler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import NotificationService from"TYPO3/CMS/Backend/Notification.js";import DeferredAction from"TYPO3/CMS/Backend/ActionButton/DeferredAction.js";class EventHandler{constructor(){document.addEventListener("typo3:redirects:slugChanged",e=>this.onSlugChanged(e.detail))}dispatchCustomEvent(e,t=null){const r=new CustomEvent(e,{detail:t});document.dispatchEvent(r)}onSlugChanged(e){let t=[];const r=e.correlations;e.autoUpdateSlugs&&t.push({label:TYPO3.lang["notification.redirects.button.revert_update"],action:new DeferredAction(()=>this.revert([r.correlationIdSlugUpdate,r.correlationIdRedirectCreation]))}),e.autoCreateRedirects&&t.push({label:TYPO3.lang["notification.redirects.button.revert_redirect"],action:new DeferredAction(()=>this.revert([r.correlationIdRedirectCreation]))});let i=TYPO3.lang["notification.slug_only.title"],n=TYPO3.lang["notification.slug_only.message"];e.autoCreateRedirects&&(i=TYPO3.lang["notification.slug_and_redirects.title"],n=TYPO3.lang["notification.slug_and_redirects.message"]),NotificationService.info(i,n,0,t)}revert(e){const t=new AjaxRequest(TYPO3.settings.ajaxUrls.redirects_revert_correlation).withQueryArguments({correlation_ids:e}).get();return t.then(async e=>{const t=await e.resolve();"ok"===t.status&&NotificationService.success(t.title,t.message),"error"===t.status&&NotificationService.error(t.title,t.message)}).catch(()=>{NotificationService.error(TYPO3.lang.redirects_error_title,TYPO3.lang.redirects_error_message)}),t}}export default new EventHandler; \ No newline at end of file diff --git a/typo3/sysext/redirects/Resources/Public/JavaScript/FormEngineEvaluation.js b/typo3/sysext/redirects/Resources/Public/JavaScript/FormEngineEvaluation.js deleted file mode 100644 index 142ca5a1af538daeb768491e1a3b68b789aeba30..0000000000000000000000000000000000000000 --- a/typo3/sysext/redirects/Resources/Public/JavaScript/FormEngineEvaluation.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import FormEngineValidation from"TYPO3/CMS/Backend/FormEngineValidation.js";export class FormEngineEvaluation{static registerCustomEvaluation(t){FormEngineValidation.registerCustomEvaluation(t,FormEngineEvaluation.evaluateSourceHost)}static evaluateSourceHost(t){return"*"===t?t:(t.includes("://")||(t="http://"+t),new URL(t).host)}} \ No newline at end of file diff --git a/typo3/sysext/redirects/Resources/Public/JavaScript/RedirectsModule.js b/typo3/sysext/redirects/Resources/Public/JavaScript/RedirectsModule.js deleted file mode 100644 index f78c6680e69100059dfbc88c5546ae4d77f5729e..0000000000000000000000000000000000000000 --- a/typo3/sysext/redirects/Resources/Public/JavaScript/RedirectsModule.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class RedirectsModule{constructor(){const e=document.querySelector('form[data-on-submit="processNavigate"]');null!==e&&(new RegularEvent("change",this.executeSubmit.bind(this)).delegateTo(document,'[data-on-change="submit"]'),new RegularEvent("submit",this.processNavigate.bind(this)).bindTo(e))}executeSubmit(e){const t=e.target;(t instanceof HTMLSelectElement||t instanceof HTMLInputElement&&"checkbox"===t.type)&&t.form.submit()}processNavigate(e){const t=e.target;if(!(t instanceof HTMLFormElement))return;e.preventDefault();const n=t.elements.namedItem("paginator-target-page"),a=parseInt(n.dataset.numberOfPages,10);let r=n.dataset.url,o=parseInt(n.value,10);o>a?o=a:o<1&&(o=1),r=r.replace("987654322",o.toString()),self.location.href=r}}export default new RedirectsModule; \ No newline at end of file diff --git a/typo3/sysext/redirects/Resources/Public/JavaScript/event-handler.js b/typo3/sysext/redirects/Resources/Public/JavaScript/event-handler.js new file mode 100644 index 0000000000000000000000000000000000000000..94194759776c04461c3f835f3b554be6df08f1b6 --- /dev/null +++ b/typo3/sysext/redirects/Resources/Public/JavaScript/event-handler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import NotificationService from"@typo3/backend/notification.js";import DeferredAction from"@typo3/backend/action-button/deferred-action.js";class EventHandler{constructor(){document.addEventListener("typo3:redirects:slugChanged",e=>this.onSlugChanged(e.detail))}dispatchCustomEvent(e,t=null){const r=new CustomEvent(e,{detail:t});document.dispatchEvent(r)}onSlugChanged(e){let t=[];const r=e.correlations;e.autoUpdateSlugs&&t.push({label:TYPO3.lang["notification.redirects.button.revert_update"],action:new DeferredAction(()=>this.revert([r.correlationIdSlugUpdate,r.correlationIdRedirectCreation]))}),e.autoCreateRedirects&&t.push({label:TYPO3.lang["notification.redirects.button.revert_redirect"],action:new DeferredAction(()=>this.revert([r.correlationIdRedirectCreation]))});let i=TYPO3.lang["notification.slug_only.title"],o=TYPO3.lang["notification.slug_only.message"];e.autoCreateRedirects&&(i=TYPO3.lang["notification.slug_and_redirects.title"],o=TYPO3.lang["notification.slug_and_redirects.message"]),NotificationService.info(i,o,0,t)}revert(e){const t=new AjaxRequest(TYPO3.settings.ajaxUrls.redirects_revert_correlation).withQueryArguments({correlation_ids:e}).get();return t.then(async e=>{const t=await e.resolve();"ok"===t.status&&NotificationService.success(t.title,t.message),"error"===t.status&&NotificationService.error(t.title,t.message)}).catch(()=>{NotificationService.error(TYPO3.lang.redirects_error_title,TYPO3.lang.redirects_error_message)}),t}}export default new EventHandler; \ No newline at end of file diff --git a/typo3/sysext/redirects/Resources/Public/JavaScript/form-engine-evaluation.js b/typo3/sysext/redirects/Resources/Public/JavaScript/form-engine-evaluation.js new file mode 100644 index 0000000000000000000000000000000000000000..3af6e02ca6f12bcebf7e0255acf21725709b541d --- /dev/null +++ b/typo3/sysext/redirects/Resources/Public/JavaScript/form-engine-evaluation.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import FormEngineValidation from"@typo3/backend/form-engine-validation.js";export class FormEngineEvaluation{static registerCustomEvaluation(t){FormEngineValidation.registerCustomEvaluation(t,FormEngineEvaluation.evaluateSourceHost)}static evaluateSourceHost(t){return"*"===t?t:(t.includes("://")||(t="http://"+t),new URL(t).host)}} \ No newline at end of file diff --git a/typo3/sysext/redirects/Resources/Public/JavaScript/redirects-module.js b/typo3/sysext/redirects/Resources/Public/JavaScript/redirects-module.js new file mode 100644 index 0000000000000000000000000000000000000000..a89347aad1e7cff5f2c0cc2e0df4c24a6e5c0b14 --- /dev/null +++ b/typo3/sysext/redirects/Resources/Public/JavaScript/redirects-module.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import RegularEvent from"@typo3/core/event/regular-event.js";class RedirectsModule{constructor(){const e=document.querySelector('form[data-on-submit="processNavigate"]');null!==e&&(new RegularEvent("change",this.executeSubmit.bind(this)).delegateTo(document,'[data-on-change="submit"]'),new RegularEvent("submit",this.processNavigate.bind(this)).bindTo(e))}executeSubmit(e){const t=e.target;(t instanceof HTMLSelectElement||t instanceof HTMLInputElement&&"checkbox"===t.type)&&t.form.submit()}processNavigate(e){const t=e.target;if(!(t instanceof HTMLFormElement))return;e.preventDefault();const n=t.elements.namedItem("paginator-target-page"),a=parseInt(n.dataset.numberOfPages,10);let r=n.dataset.url,o=parseInt(n.value,10);o>a?o=a:o<1&&(o=1),r=r.replace("987654322",o.toString()),self.location.href=r}}export default new RedirectsModule; \ No newline at end of file diff --git a/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php b/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php index 185e96594bf3eeb04fea6dc1c0769ecea6d04a10..b4ff74533db7a029150d584de330ced4d66f1320 100644 --- a/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php +++ b/typo3/sysext/rte_ckeditor/Classes/Controller/BrowseLinksController.php @@ -82,7 +82,7 @@ class BrowseLinksController extends AbstractLinkBrowserController protected function initDocumentTemplate(): void { $this->pageRenderer->getJavaScriptRenderer()->addJavaScriptModuleInstruction( - JavaScriptModuleInstruction::create('TYPO3/CMS/RteCkeditor/RteLinkBrowser.js') + JavaScriptModuleInstruction::create('@typo3/rte-ckeditor/rte-link-browser.js') ->invoke('initialize', $this->editorId) ); } diff --git a/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php b/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php index b7f2586118fd31f1ad9ebb9678e5b5ef7a09114d..80c5d812b617463f34ce6489234e64773081479c 100644 --- a/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php +++ b/typo3/sysext/rte_ckeditor/Classes/Form/Element/RichTextElement.php @@ -230,7 +230,7 @@ class RichTextElement extends AbstractFormElement // Make a hash of the configuration and append it to CKEDITOR.timestamp // This will mitigate browser caching issue when plugins are updated $configurationHash = md5((string)json_encode($configuration)); - return JavaScriptModuleInstruction::create('TYPO3/CMS/RteCkeditor/FormEngineInitializer.js', 'FormEngineInitializer') + return JavaScriptModuleInstruction::create('@typo3/rte-ckeditor/form-engine-initializer.js', 'FormEngineInitializer') ->invoke('initializeCKEditor', [ 'fieldId' => $fieldId, 'configuration' => $configuration, diff --git a/typo3/sysext/rte_ckeditor/Configuration/JavaScriptModules.php b/typo3/sysext/rte_ckeditor/Configuration/JavaScriptModules.php index 5c1ae4a757ec076f82a3bf77ba21d5a49e26fd14..0ba365b60375ff4bfc28e3e7207d38eb0b1ca16e 100644 --- a/typo3/sysext/rte_ckeditor/Configuration/JavaScriptModules.php +++ b/typo3/sysext/rte_ckeditor/Configuration/JavaScriptModules.php @@ -6,7 +6,7 @@ return [ 'recordlist', ], 'imports' => [ - 'TYPO3/CMS/RteCkeditor/' => [ + '@typo3/rte-ckeditor/' => [ 'path' => 'EXT:rte_ckeditor/Resources/Public/JavaScript/', 'exclude' => [ 'EXT:rte_ckeditor/Resources/Public/JavaScript/Contrib/', diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/FormEngineInitializer.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/FormEngineInitializer.js deleted file mode 100644 index 20426a680194f6439532f57f52ef4f27102dcbb6..0000000000000000000000000000000000000000 --- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/FormEngineInitializer.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{loadCKEditor}from"TYPO3/CMS/RteCkeditor/CKEditorLoader.js";import $ from"jquery";import FormEngine from"TYPO3/CMS/Backend/FormEngine.js";export class FormEngineInitializer{static initializeCKEditor(e){loadCKEditor().then(i=>{i.timestamp+="-"+e.configurationHash,e.externalPlugins.forEach(e=>i.plugins.addExternal(e.name,e.resource,"")),$(()=>{const n=e.fieldId,o="#"+$.escapeSelector(n);i.replace(n,e.configuration);const a=i.instances[n];a.on("change",e=>{let i=e.sender.commands;a.updateElement(),FormEngine.Validation.validateField($(o)),FormEngine.Validation.markFieldAsChanged($(o)),void 0!==i.maximize&&1===i.maximize.state&&a.on("maximize",e=>{$(this).off("maximize"),FormEngine.Validation.markFieldAsChanged($(o))})}),a.on("mode",e=>{if("source"===e.editor.mode){const e=a.editable();e.attachListener(e,"change",()=>{FormEngine.Validation.markFieldAsChanged($(o))})}}),document.addEventListener("inline:sorting-changed",()=>{a.destroy(),i.replace(n,e.configuration)}),document.addEventListener("formengine:flexform:sorting-changed",()=>{a.destroy(),i.replace(n,e.configuration)})})})}} \ No newline at end of file diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/RteLinkBrowser.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/RteLinkBrowser.js deleted file mode 100644 index 417e39a23b0982ace9f86cf668532c3fc13bb4a0..0000000000000000000000000000000000000000 --- a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/RteLinkBrowser.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import LinkBrowser from"TYPO3/CMS/Recordlist/LinkBrowser.js";import Modal from"TYPO3/CMS/Backend/Modal.js";class RteLinkBrowser{constructor(){this.plugin=null,this.CKEditor=null,this.ranges=[],this.siteUrl=""}initialize(t){let e=Modal.currentModal.data("ckeditor");if(void 0!==e)this.CKEditor=e;else{let e;e=void 0!==top.TYPO3.Backend&&void 0!==top.TYPO3.Backend.ContentContainer.get()?top.TYPO3.Backend.ContentContainer.get():window.parent,$.each(e.CKEDITOR.instances,(e,i)=>{i.id===t&&(this.CKEditor=i)})}window.addEventListener("beforeunload",()=>{this.CKEditor.getSelection().selectRanges(this.ranges)}),this.ranges=this.CKEditor.getSelection().getRanges(),$.extend(RteLinkBrowser,$("body").data()),$(".t3js-class-selector").on("change",()=>{$("option:selected",this).data("linkTitle")&&$(".t3js-linkTitle").val($("option:selected",this).data("linkTitle"))}),$(".t3js-removeCurrentLink").on("click",t=>{t.preventDefault(),this.CKEditor.execCommand("unlink"),Modal.dismiss()})}finalizeFunction(t){const e=this.CKEditor.document.createElement("a"),i=LinkBrowser.getLinkAttributeValues();let n=i.params?i.params:"";i.target&&e.setAttribute("target",i.target),i.class&&e.setAttribute("class",i.class),i.title&&e.setAttribute("title",i.title),delete i.title,delete i.class,delete i.target,delete i.params,$.each(i,(t,i)=>{e.setAttribute(t,i)});const s=t.match(/^([a-z0-9]+:\/\/[^:\/?#]+(?:\/?[^?#]*)?)(\??[^#]*)(#?.*)$/);if(s&&s.length>0){t=s[1]+s[2];const e=s[2].length>0?"&":"?";n.length>0&&("&"===n[0]&&(n=n.substr(1)),n.length>0&&(t+=e+n)),t+=s[3]}e.setAttribute("href",t);const r=this.CKEditor.getSelection();r.selectRanges(this.ranges),r&&""===r.getSelectedText()&&r.selectElement(r.getStartElement()),r&&r.getSelectedText()?e.setText(r.getSelectedText()):e.setText(e.getAttribute("href")),this.CKEditor.insertElement(e),Modal.dismiss()}}let rteLinkBrowser=new RteLinkBrowser;export default rteLinkBrowser;LinkBrowser.finalizeFunction=t=>{rteLinkBrowser.finalizeFunction(t)}; \ No newline at end of file diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/CKEditorLoader.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/ckeditor-loader.js similarity index 100% rename from typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/CKEditorLoader.js rename to typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/ckeditor-loader.js diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/form-engine-initializer.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/form-engine-initializer.js new file mode 100644 index 0000000000000000000000000000000000000000..75c8b7480319764fc03f1a3bc6cbc948987ccedb --- /dev/null +++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/form-engine-initializer.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{loadCKEditor}from"@typo3/rte-ckeditor/ckeditor-loader.js";import $ from"jquery";import FormEngine from"@typo3/backend/form-engine.js";export class FormEngineInitializer{static initializeCKEditor(e){loadCKEditor().then(i=>{i.timestamp+="-"+e.configurationHash,e.externalPlugins.forEach(e=>i.plugins.addExternal(e.name,e.resource,"")),$(()=>{const n=e.fieldId,o="#"+$.escapeSelector(n);i.replace(n,e.configuration);const a=i.instances[n];a.on("change",e=>{let i=e.sender.commands;a.updateElement(),FormEngine.Validation.validateField($(o)),FormEngine.Validation.markFieldAsChanged($(o)),void 0!==i.maximize&&1===i.maximize.state&&a.on("maximize",e=>{$(this).off("maximize"),FormEngine.Validation.markFieldAsChanged($(o))})}),a.on("mode",e=>{if("source"===e.editor.mode){const e=a.editable();e.attachListener(e,"change",()=>{FormEngine.Validation.markFieldAsChanged($(o))})}}),document.addEventListener("inline:sorting-changed",()=>{a.destroy(),i.replace(n,e.configuration)}),document.addEventListener("formengine:flexform:sorting-changed",()=>{a.destroy(),i.replace(n,e.configuration)})})})}} \ No newline at end of file diff --git a/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/rte-link-browser.js b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/rte-link-browser.js new file mode 100644 index 0000000000000000000000000000000000000000..c7aafc8e43214c5add75cf1ced4b5ea9842721a8 --- /dev/null +++ b/typo3/sysext/rte_ckeditor/Resources/Public/JavaScript/rte-link-browser.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import LinkBrowser from"@typo3/recordlist/link-browser.js";import Modal from"@typo3/backend/modal.js";class RteLinkBrowser{constructor(){this.plugin=null,this.CKEditor=null,this.ranges=[],this.siteUrl=""}initialize(t){let e=Modal.currentModal.data("ckeditor");if(void 0!==e)this.CKEditor=e;else{let e;e=void 0!==top.TYPO3.Backend&&void 0!==top.TYPO3.Backend.ContentContainer.get()?top.TYPO3.Backend.ContentContainer.get():window.parent,$.each(e.CKEDITOR.instances,(e,i)=>{i.id===t&&(this.CKEditor=i)})}window.addEventListener("beforeunload",()=>{this.CKEditor.getSelection().selectRanges(this.ranges)}),this.ranges=this.CKEditor.getSelection().getRanges(),$.extend(RteLinkBrowser,$("body").data()),$(".t3js-class-selector").on("change",()=>{$("option:selected",this).data("linkTitle")&&$(".t3js-linkTitle").val($("option:selected",this).data("linkTitle"))}),$(".t3js-removeCurrentLink").on("click",t=>{t.preventDefault(),this.CKEditor.execCommand("unlink"),Modal.dismiss()})}finalizeFunction(t){const e=this.CKEditor.document.createElement("a"),i=LinkBrowser.getLinkAttributeValues();let n=i.params?i.params:"";i.target&&e.setAttribute("target",i.target),i.class&&e.setAttribute("class",i.class),i.title&&e.setAttribute("title",i.title),delete i.title,delete i.class,delete i.target,delete i.params,$.each(i,(t,i)=>{e.setAttribute(t,i)});const s=t.match(/^([a-z0-9]+:\/\/[^:\/?#]+(?:\/?[^?#]*)?)(\??[^#]*)(#?.*)$/);if(s&&s.length>0){t=s[1]+s[2];const e=s[2].length>0?"&":"?";n.length>0&&("&"===n[0]&&(n=n.substr(1)),n.length>0&&(t+=e+n)),t+=s[3]}e.setAttribute("href",t);const r=this.CKEditor.getSelection();r.selectRanges(this.ranges),r&&""===r.getSelectedText()&&r.selectElement(r.getStartElement()),r&&r.getSelectedText()?e.setText(r.getSelectedText()):e.setText(e.getAttribute("href")),this.CKEditor.insertElement(e),Modal.dismiss()}}let rteLinkBrowser=new RteLinkBrowser;export default rteLinkBrowser;LinkBrowser.finalizeFunction=t=>{rteLinkBrowser.finalizeFunction(t)}; \ No newline at end of file diff --git a/typo3/sysext/scheduler/Configuration/JavaScriptModules.php b/typo3/sysext/scheduler/Configuration/JavaScriptModules.php index e003f4da21ecec9848f03b4c413a45afbf424af0..c6be8a4df0949c03a6d1f22a71795ca6ba7672b3 100644 --- a/typo3/sysext/scheduler/Configuration/JavaScriptModules.php +++ b/typo3/sysext/scheduler/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Scheduler/' => 'EXT:scheduler/Resources/Public/JavaScript/', + '@typo3/scheduler/' => 'EXT:scheduler/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/scheduler/Resources/Private/Templates/AddTaskForm.html b/typo3/sysext/scheduler/Resources/Private/Templates/AddTaskForm.html index a991a90631b18ea0e8178d45704180fed085a3b3..56158822d464ca72bd994ca8055f1f1ebeca8a31 100644 --- a/typo3/sysext/scheduler/Resources/Private/Templates/AddTaskForm.html +++ b/typo3/sysext/scheduler/Resources/Private/Templates/AddTaskForm.html @@ -10,8 +10,8 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Modal.js', - 1: 'TYPO3/CMS/Scheduler/Scheduler.js' + 0: '@typo3/backend/modal.js', + 1: '@typo3/scheduler/scheduler.js' }" /> <form name="tx_scheduler_form" id="tx_scheduler_form" method="post"> diff --git a/typo3/sysext/scheduler/Resources/Private/Templates/EditTaskForm.html b/typo3/sysext/scheduler/Resources/Private/Templates/EditTaskForm.html index 6a91c3bc22db6f0f1284b1c5ba9b707af5943587..aaec29be0e573d2ea70cad79f996b9e3bcc9ce80 100644 --- a/typo3/sysext/scheduler/Resources/Private/Templates/EditTaskForm.html +++ b/typo3/sysext/scheduler/Resources/Private/Templates/EditTaskForm.html @@ -10,8 +10,8 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Modal.js', - 1: 'TYPO3/CMS/Scheduler/Scheduler.js' + 0: '@typo3/backend/modal.js', + 1: '@typo3/scheduler/scheduler.js' }" /> <form name="tx_scheduler_form" id="tx_scheduler_form" method="post"> diff --git a/typo3/sysext/scheduler/Resources/Private/Templates/ListTasks.html b/typo3/sysext/scheduler/Resources/Private/Templates/ListTasks.html index 25e4cb48e26f8145f9284963d2f57222dce0bc4f..82ab0811d0e86a338f02769dc2b8fabbbd4a1357 100644 --- a/typo3/sysext/scheduler/Resources/Private/Templates/ListTasks.html +++ b/typo3/sysext/scheduler/Resources/Private/Templates/ListTasks.html @@ -9,10 +9,10 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Modal.js', - 1: 'TYPO3/CMS/Backend/Tooltip.js', - 2: 'TYPO3/CMS/Backend/MultiRecordSelection.js', - 3: 'TYPO3/CMS/Scheduler/Scheduler.js' + 0: '@typo3/backend/modal.js', + 1: '@typo3/backend/tooltip.js', + 2: '@typo3/backend/multi-record-selection.js', + 3: '@typo3/scheduler/scheduler.js' }" /> <form name="tx_scheduler_form" id="tx_scheduler_form" method="post"> diff --git a/typo3/sysext/scheduler/Resources/Public/JavaScript/Scheduler.js b/typo3/sysext/scheduler/Resources/Public/JavaScript/Scheduler.js deleted file mode 100644 index 26a27417ba901d5cbc4c207f4d21fbe71f45c9d7..0000000000000000000000000000000000000000 --- a/typo3/sysext/scheduler/Resources/Public/JavaScript/Scheduler.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import Tablesort from"tablesort";import DocumentSaveActions from"TYPO3/CMS/Backend/DocumentSaveActions.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Icons from"TYPO3/CMS/Backend/Icons.js";import{MessageUtility}from"TYPO3/CMS/Backend/Utility/MessageUtility.js";import PersistentStorage from"TYPO3/CMS/Backend/Storage/Persistent.js";import DateTimePicker from"TYPO3/CMS/Backend/DateTimePicker.js";class Scheduler{static updateElementBrowserTriggers(){document.querySelectorAll(".t3js-element-browser").forEach(e=>{const t=document.getElementById(e.dataset.triggerFor);e.dataset.params=t.name+"|||pages"})}static resolveDefaultNumberOfDays(){const e=document.getElementById("task_tableGarbageCollection_numberOfDays");return null===e||void 0===e.dataset.defaultNumberOfDays?null:JSON.parse(e.dataset.defaultNumberOfDays)}static storeCollapseState(e,t){let a={};PersistentStorage.isset("moduleData.scheduler")&&(a=PersistentStorage.get("moduleData.scheduler"));const l={};l[e]=t?1:0,$.extend(a,l),PersistentStorage.set("moduleData.scheduler",a)}constructor(){this.initializeEvents(),this.initializeDefaultStates(),DocumentSaveActions.getInstance().addPreSubmitCallback(()=>{let e=$("#task_class").val();e=e.toLowerCase().replace(/\\/g,"-"),$(".extraFields").appendTo($("#extraFieldsHidden")),$(".extra_fields_"+e).appendTo($("#extraFieldsSection"))})}actOnChangedTaskClass(e){let t=e.val();t=t.toLowerCase().replace(/\\/g,"-"),$(".extraFields").hide(),$(".extra_fields_"+t).show()}actOnChangedTaskType(e){this.toggleFieldsByTaskType($(e.currentTarget).val())}actOnChangeSchedulerTableGarbageCollectionAllTables(e){let t=$("#task_tableGarbageCollection_numberOfDays"),a=$("#task_tableGarbageCollection_table");if(e.prop("checked"))a.prop("disabled",!0),t.prop("disabled",!0);else{let e=parseInt(t.val(),10);if(e<1){let t=a.val();const l=Scheduler.resolveDefaultNumberOfDays();null!==l&&(e=l[t])}a.prop("disabled",!1),e>0&&t.prop("disabled",!1)}}actOnChangeSchedulerTableGarbageCollectionTable(e){let t=$("#task_tableGarbageCollection_numberOfDays");const a=Scheduler.resolveDefaultNumberOfDays();null!==a&&a[e.val()]>0?(t.prop("disabled",!1),t.val(a[e.val()])):(t.prop("disabled",!0),t.val(0))}toggleFieldsByTaskType(e){e=parseInt(e+"",10),$("#task_end_col").toggle(2===e),$("#task_frequency_row").toggle(2===e)}initializeEvents(){$("#task_class").on("change",e=>{this.actOnChangedTaskClass($(e.currentTarget))}),$("#task_type").on("change",this.actOnChangedTaskType.bind(this)),$("#task_tableGarbageCollection_allTables").on("change",e=>{this.actOnChangeSchedulerTableGarbageCollectionAllTables($(e.currentTarget))}),$("#task_tableGarbageCollection_table").on("change",e=>{this.actOnChangeSchedulerTableGarbageCollectionTable($(e.currentTarget))}),$("[data-update-task-frequency]").on("change",e=>{const t=$(e.currentTarget);$("#task_frequency").val(t.val()),t.val(t.attr("value")).trigger("blur")});const e=document.querySelector("table.taskGroup-table");null!==e&&new Tablesort(e),document.querySelectorAll("#tx_scheduler_form .t3js-datetimepicker").forEach(e=>DateTimePicker.initialize(e)),$(document).on("click",".t3js-element-browser",e=>{e.preventDefault();const t=e.currentTarget;Modal.advanced({type:Modal.types.iframe,content:t.href+"&mode="+t.dataset.mode+"&bparams="+t.dataset.params,size:Modal.sizes.large})}),new RegularEvent("show.bs.collapse",this.toggleCollapseIcon.bind(this)).bindTo(document),new RegularEvent("hide.bs.collapse",this.toggleCollapseIcon.bind(this)).bindTo(document),new RegularEvent("multiRecordSelection:action:go",this.executeTasks.bind(this)).bindTo(document),new RegularEvent("multiRecordSelection:action:go_cron",this.executeTasks.bind(this)).bindTo(document),window.addEventListener("message",this.listenOnElementBrowser.bind(this))}initializeDefaultStates(){let e=$("#task_type");e.length&&this.toggleFieldsByTaskType(e.val());let t=$("#task_class");t.length&&(this.actOnChangedTaskClass(t),Scheduler.updateElementBrowserTriggers())}listenOnElementBrowser(e){if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:elementBrowser:elementAdded"===e.data.actionName){if(void 0===e.data.fieldName)throw"fieldName not defined in message";if(void 0===e.data.value)throw"value not defined in message";const t=e.data.value.split("_");document.querySelector('input[name="'+e.data.fieldName+'"]').value=t[1]}}toggleCollapseIcon(e){const t="hide.bs.collapse"===e.type,a=document.querySelector('.t3js-toggle-table[data-bs-target="#'+e.target.id+'"] .collapseIcon');null!==a&&Icons.getIcon(t?"actions-view-list-expand":"actions-view-list-collapse",Icons.sizes.small).then(e=>{a.innerHTML=e}),Scheduler.storeCollapseState($(e.target).data("table"),t)}executeTasks(e){const t=document.querySelector("#tx_scheduler_form");if(null===t)return;const a=[];if(e.detail.checkboxes.forEach(e=>{const t=e.closest("tr");null!==t&&t.dataset.taskId&&a.push(t.dataset.taskId)}),a.length){if("multiRecordSelection:action:go_cron"===e.type){const e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name","scheduleCron"),e.setAttribute("value",a.join(",")),t.append(e)}else{const e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name","execute"),e.setAttribute("value",a.join(",")),t.append(e)}t.submit()}}}export default new Scheduler; \ No newline at end of file diff --git a/typo3/sysext/scheduler/Resources/Public/JavaScript/scheduler.js b/typo3/sysext/scheduler/Resources/Public/JavaScript/scheduler.js new file mode 100644 index 0000000000000000000000000000000000000000..13b6e8c8d5fd6166c7f68c7e41478ff68efef574 --- /dev/null +++ b/typo3/sysext/scheduler/Resources/Public/JavaScript/scheduler.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import Tablesort from"tablesort";import DocumentSaveActions from"@typo3/backend/document-save-actions.js";import RegularEvent from"@typo3/core/event/regular-event.js";import Modal from"@typo3/backend/modal.js";import Icons from"@typo3/backend/icons.js";import{MessageUtility}from"@typo3/backend/utility/message-utility.js";import PersistentStorage from"@typo3/backend/storage/persistent.js";import DateTimePicker from"@typo3/backend/date-time-picker.js";class Scheduler{static updateElementBrowserTriggers(){document.querySelectorAll(".t3js-element-browser").forEach(e=>{const t=document.getElementById(e.dataset.triggerFor);e.dataset.params=t.name+"|||pages"})}static resolveDefaultNumberOfDays(){const e=document.getElementById("task_tableGarbageCollection_numberOfDays");return null===e||void 0===e.dataset.defaultNumberOfDays?null:JSON.parse(e.dataset.defaultNumberOfDays)}static storeCollapseState(e,t){let a={};PersistentStorage.isset("moduleData.scheduler")&&(a=PersistentStorage.get("moduleData.scheduler"));const l={};l[e]=t?1:0,$.extend(a,l),PersistentStorage.set("moduleData.scheduler",a)}constructor(){this.initializeEvents(),this.initializeDefaultStates(),DocumentSaveActions.getInstance().addPreSubmitCallback(()=>{let e=$("#task_class").val();e=e.toLowerCase().replace(/\\/g,"-"),$(".extraFields").appendTo($("#extraFieldsHidden")),$(".extra_fields_"+e).appendTo($("#extraFieldsSection"))})}actOnChangedTaskClass(e){let t=e.val();t=t.toLowerCase().replace(/\\/g,"-"),$(".extraFields").hide(),$(".extra_fields_"+t).show()}actOnChangedTaskType(e){this.toggleFieldsByTaskType($(e.currentTarget).val())}actOnChangeSchedulerTableGarbageCollectionAllTables(e){let t=$("#task_tableGarbageCollection_numberOfDays"),a=$("#task_tableGarbageCollection_table");if(e.prop("checked"))a.prop("disabled",!0),t.prop("disabled",!0);else{let e=parseInt(t.val(),10);if(e<1){let t=a.val();const l=Scheduler.resolveDefaultNumberOfDays();null!==l&&(e=l[t])}a.prop("disabled",!1),e>0&&t.prop("disabled",!1)}}actOnChangeSchedulerTableGarbageCollectionTable(e){let t=$("#task_tableGarbageCollection_numberOfDays");const a=Scheduler.resolveDefaultNumberOfDays();null!==a&&a[e.val()]>0?(t.prop("disabled",!1),t.val(a[e.val()])):(t.prop("disabled",!0),t.val(0))}toggleFieldsByTaskType(e){e=parseInt(e+"",10),$("#task_end_col").toggle(2===e),$("#task_frequency_row").toggle(2===e)}initializeEvents(){$("#task_class").on("change",e=>{this.actOnChangedTaskClass($(e.currentTarget))}),$("#task_type").on("change",this.actOnChangedTaskType.bind(this)),$("#task_tableGarbageCollection_allTables").on("change",e=>{this.actOnChangeSchedulerTableGarbageCollectionAllTables($(e.currentTarget))}),$("#task_tableGarbageCollection_table").on("change",e=>{this.actOnChangeSchedulerTableGarbageCollectionTable($(e.currentTarget))}),$("[data-update-task-frequency]").on("change",e=>{const t=$(e.currentTarget);$("#task_frequency").val(t.val()),t.val(t.attr("value")).trigger("blur")});const e=document.querySelector("table.taskGroup-table");null!==e&&new Tablesort(e),document.querySelectorAll("#tx_scheduler_form .t3js-datetimepicker").forEach(e=>DateTimePicker.initialize(e)),$(document).on("click",".t3js-element-browser",e=>{e.preventDefault();const t=e.currentTarget;Modal.advanced({type:Modal.types.iframe,content:t.href+"&mode="+t.dataset.mode+"&bparams="+t.dataset.params,size:Modal.sizes.large})}),new RegularEvent("show.bs.collapse",this.toggleCollapseIcon.bind(this)).bindTo(document),new RegularEvent("hide.bs.collapse",this.toggleCollapseIcon.bind(this)).bindTo(document),new RegularEvent("multiRecordSelection:action:go",this.executeTasks.bind(this)).bindTo(document),new RegularEvent("multiRecordSelection:action:go_cron",this.executeTasks.bind(this)).bindTo(document),window.addEventListener("message",this.listenOnElementBrowser.bind(this))}initializeDefaultStates(){let e=$("#task_type");e.length&&this.toggleFieldsByTaskType(e.val());let t=$("#task_class");t.length&&(this.actOnChangedTaskClass(t),Scheduler.updateElementBrowserTriggers())}listenOnElementBrowser(e){if(!MessageUtility.verifyOrigin(e.origin))throw"Denied message sent by "+e.origin;if("typo3:elementBrowser:elementAdded"===e.data.actionName){if(void 0===e.data.fieldName)throw"fieldName not defined in message";if(void 0===e.data.value)throw"value not defined in message";const t=e.data.value.split("_");document.querySelector('input[name="'+e.data.fieldName+'"]').value=t[1]}}toggleCollapseIcon(e){const t="hide.bs.collapse"===e.type,a=document.querySelector('.t3js-toggle-table[data-bs-target="#'+e.target.id+'"] .collapseIcon');null!==a&&Icons.getIcon(t?"actions-view-list-expand":"actions-view-list-collapse",Icons.sizes.small).then(e=>{a.innerHTML=e}),Scheduler.storeCollapseState($(e.target).data("table"),t)}executeTasks(e){const t=document.querySelector("#tx_scheduler_form");if(null===t)return;const a=[];if(e.detail.checkboxes.forEach(e=>{const t=e.closest("tr");null!==t&&t.dataset.taskId&&a.push(t.dataset.taskId)}),a.length){if("multiRecordSelection:action:go_cron"===e.type){const e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name","scheduleCron"),e.setAttribute("value",a.join(",")),t.append(e)}else{const e=document.createElement("input");e.setAttribute("type","hidden"),e.setAttribute("name","execute"),e.setAttribute("value",a.join(",")),t.append(e)}t.submit()}}}export default new Scheduler; \ No newline at end of file diff --git a/typo3/sysext/setup/Classes/Controller/SetupModuleController.php b/typo3/sysext/setup/Classes/Controller/SetupModuleController.php index 43afba1f6258bcdd3dbec60880d14b7745c92261..719b5c2e089a891720988b9efeedc55841c4095e 100644 --- a/typo3/sysext/setup/Classes/Controller/SetupModuleController.php +++ b/typo3/sysext/setup/Classes/Controller/SetupModuleController.php @@ -114,9 +114,9 @@ class SetupModuleController $languageService = $this->getLanguageService(); $backendUser = $this->getBackendUser(); $view = $this->moduleTemplateFactory->create($request, 'typo3/cms-setup'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Modal.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/FormEngine.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Setup/SetupModule.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/modal.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/form-engine.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/setup/setup-module.js'); $this->processAdditionalJavaScriptModules(); $this->pageRenderer->addInlineSetting('FormEngine', 'formName', 'editform'); $this->pageRenderer->addInlineLanguageLabelArray([ diff --git a/typo3/sysext/setup/Configuration/JavaScriptModules.php b/typo3/sysext/setup/Configuration/JavaScriptModules.php index b6864916d296635b6a266408dc87938eafea161f..b0699658258fe59e178b99181c0ede2bb4d0fe2a 100644 --- a/typo3/sysext/setup/Configuration/JavaScriptModules.php +++ b/typo3/sysext/setup/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Setup/' => 'EXT:setup/Resources/Public/JavaScript/', + '@typo3/setup/' => 'EXT:setup/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/setup/Resources/Private/Templates/Main.html b/typo3/sysext/setup/Resources/Private/Templates/Main.html index a7ac0e490085a192d4eae2ae23465913c514e2dc..d01da881c15774f60adb1ce31688ff402d9f5e09 100644 --- a/typo3/sysext/setup/Resources/Private/Templates/Main.html +++ b/typo3/sysext/setup/Resources/Private/Templates/Main.html @@ -9,7 +9,7 @@ <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Backend/Tabs.js' + 0: '@typo3/backend/tabs.js' }" /> diff --git a/typo3/sysext/setup/Resources/Public/JavaScript/SetupModule.js b/typo3/sysext/setup/Resources/Public/JavaScript/SetupModule.js deleted file mode 100644 index 750d8aa94b32bcdcd8694222f10f64d77e52ffb0..0000000000000000000000000000000000000000 --- a/typo3/sysext/setup/Resources/Public/JavaScript/SetupModule.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{MessageUtility}from"TYPO3/CMS/Backend/Utility/MessageUtility.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class SetupModule{constructor(){new RegularEvent("setup:confirmation:response",SetupModule.handleConfirmationResponse).delegateTo(document,'[data-event-name="setup:confirmation:response"]'),new RegularEvent("click",(e,t)=>{const a=new CustomEvent(t.dataset.eventName,{bubbles:!0,detail:{payload:t.dataset.eventPayload}});t.dispatchEvent(a)}).delegateTo(document,'[data-event="click"][data-event-name]'),document.querySelectorAll("[data-setup-avatar-field]").forEach(e=>{const t=e.dataset.setupAvatarField,a=document.getElementById("clear_button_"+t),n=document.getElementById("add_button_"+t);n.addEventListener("click",()=>this.avatarOpenFileBrowser(t,n.dataset.setupAvatarUrl)),a&&a.addEventListener("click",()=>this.avatarClearExistingImage(t))}),null!==document.querySelector("[data-setup-avatar-field]")&&this.initializeMessageListener()}static handleConfirmationResponse(e){if(e.detail.result&&"resetConfiguration"===e.detail.payload){const e=document.querySelector("#setValuesToDefault");e.value="1",e.form.submit()}}static hideElement(e){e.style.display="none"}initializeMessageListener(){window.addEventListener("message",e=>{if(!MessageUtility.verifyOrigin(e.origin))throw new Error("Denied message sent by "+e.origin);if("typo3:foreignRelation:insert"===e.data.actionName){if(void 0===e.data.objectGroup)throw new Error("No object group defined for message");const t=e.data.objectGroup.match(/^avatar-(.+)$/);if(null===t)return;this.avatarSetFileUid(t[1],e.data.uid)}})}avatarOpenFileBrowser(e,t){t=t.replace("__IDENTIFIER__","avatar-"+e),this.avatarWindowRef=window.open(t,"Typo3WinBrowser","height=650,width=800,status=0,menubar=0,resizable=1,scrollbars=1"),this.avatarWindowRef.focus()}avatarClearExistingImage(e){const t=document.getElementById("field_"+e),a=document.getElementById("image_"+e),n=document.getElementById("clear_button_"+e);n&&SetupModule.hideElement(n),a&&SetupModule.hideElement(a),t.value="delete"}avatarSetFileUid(e,t){this.avatarClearExistingImage(e);const a=document.getElementById("field_"+e),n=document.getElementById("add_button_"+e);a.value=t,n.classList.remove("btn-default"),n.classList.add("btn-info"),this.avatarWindowRef instanceof Window&&!this.avatarWindowRef.closed&&(this.avatarWindowRef.close(),this.avatarWindowRef=null)}}export default new SetupModule; \ No newline at end of file diff --git a/typo3/sysext/setup/Resources/Public/JavaScript/setup-module.js b/typo3/sysext/setup/Resources/Public/JavaScript/setup-module.js new file mode 100644 index 0000000000000000000000000000000000000000..4c0cf962611e4154a713019dba96cae551b74912 --- /dev/null +++ b/typo3/sysext/setup/Resources/Public/JavaScript/setup-module.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{MessageUtility}from"@typo3/backend/utility/message-utility.js";import RegularEvent from"@typo3/core/event/regular-event.js";class SetupModule{constructor(){new RegularEvent("setup:confirmation:response",SetupModule.handleConfirmationResponse).delegateTo(document,'[data-event-name="setup:confirmation:response"]'),new RegularEvent("click",(e,t)=>{const a=new CustomEvent(t.dataset.eventName,{bubbles:!0,detail:{payload:t.dataset.eventPayload}});t.dispatchEvent(a)}).delegateTo(document,'[data-event="click"][data-event-name]'),document.querySelectorAll("[data-setup-avatar-field]").forEach(e=>{const t=e.dataset.setupAvatarField,a=document.getElementById("clear_button_"+t),n=document.getElementById("add_button_"+t);n.addEventListener("click",()=>this.avatarOpenFileBrowser(t,n.dataset.setupAvatarUrl)),a&&a.addEventListener("click",()=>this.avatarClearExistingImage(t))}),null!==document.querySelector("[data-setup-avatar-field]")&&this.initializeMessageListener()}static handleConfirmationResponse(e){if(e.detail.result&&"resetConfiguration"===e.detail.payload){const e=document.querySelector("#setValuesToDefault");e.value="1",e.form.submit()}}static hideElement(e){e.style.display="none"}initializeMessageListener(){window.addEventListener("message",e=>{if(!MessageUtility.verifyOrigin(e.origin))throw new Error("Denied message sent by "+e.origin);if("typo3:foreignRelation:insert"===e.data.actionName){if(void 0===e.data.objectGroup)throw new Error("No object group defined for message");const t=e.data.objectGroup.match(/^avatar-(.+)$/);if(null===t)return;this.avatarSetFileUid(t[1],e.data.uid)}})}avatarOpenFileBrowser(e,t){t=t.replace("__IDENTIFIER__","avatar-"+e),this.avatarWindowRef=window.open(t,"Typo3WinBrowser","height=650,width=800,status=0,menubar=0,resizable=1,scrollbars=1"),this.avatarWindowRef.focus()}avatarClearExistingImage(e){const t=document.getElementById("field_"+e),a=document.getElementById("image_"+e),n=document.getElementById("clear_button_"+e);n&&SetupModule.hideElement(n),a&&SetupModule.hideElement(a),t.value="delete"}avatarSetFileUid(e,t){this.avatarClearExistingImage(e);const a=document.getElementById("field_"+e),n=document.getElementById("add_button_"+e);a.value=t,n.classList.remove("btn-default"),n.classList.add("btn-info"),this.avatarWindowRef instanceof Window&&!this.avatarWindowRef.closed&&(this.avatarWindowRef.close(),this.avatarWindowRef=null)}}export default new SetupModule; \ No newline at end of file diff --git a/typo3/sysext/t3editor/Configuration/JavaScriptModules.php b/typo3/sysext/t3editor/Configuration/JavaScriptModules.php index 2f5e7caf76fc12d443788b022fc422b9e42e4ba6..64948bcbcf39ceb6209b94e32ebdbd295677acc9 100644 --- a/typo3/sysext/t3editor/Configuration/JavaScriptModules.php +++ b/typo3/sysext/t3editor/Configuration/JavaScriptModules.php @@ -5,13 +5,6 @@ return [ 'backend', ], 'imports' => [ - 'TYPO3/CMS/T3editor/' => [ - 'path' => 'EXT:t3editor/Resources/Public/JavaScript/', - 'exclude' => [ - 'EXT:t3editor/Resources/Public/JavaScript/Addon/', - 'EXT:t3editor/Resources/Public/JavaScript/Contrib/', - 'EXT:t3editor/Resources/Public/JavaScript/Mode/', - ], - ], + '@typo3/t3editor/element/' => 'EXT:t3editor/Resources/Public/JavaScript/element/', ], ]; diff --git a/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/CompletionResult.js b/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/CompletionResult.js index f9b34f88ae386041a3387a4e193bf39d80857b5b..51851a01c4e432cb847a00729d506fa8369747e3 100644 --- a/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/CompletionResult.js +++ b/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/CompletionResult.js @@ -12,14 +12,14 @@ */ /** - * Module: TYPO3/CMS/T3editor/Addon/Hint/CompletionResult + * Module: @typo3/t3editor/addon/hint/completion-result * Contains the CompletionResult class */ define(['jquery'], function($) { /** * * @type {{tsRef: null, tsTreeNode: null}} - * @exports TYPO3/CMS/T3editor/Addon/Hint/CompletionResult + * @exports @typo3/t3editor/addon/hint/completion-result */ var CompletionResult = { tsRef: null, diff --git a/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsCodeCompletion.js b/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsCodeCompletion.js index 2c507172f333674cf3b05f7ec8fd74c36c7008f8..34e83d5e846d9a67b33d3991c53f592b4b07ff26 100644 --- a/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsCodeCompletion.js +++ b/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsCodeCompletion.js @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/T3editor/Addon/Hint/TsCodeCompletion + * Module: @typo3/t3editor/addon/hint/ts-code-completion * Contains the TsCodeCompletion class */ define([ @@ -24,7 +24,7 @@ define([ /** * * @type {{tsRef: *, proposals: null, compResult: null, currentCursorPosition: null, extTsObjTree: {}, codemirror: null, parser: null, plugins: string[]}} - * @exports TYPO3/CMS/T3editor/CodeCompletion/TsCodeCompletion + * @exports @typo3/t3editor/code-completion/ts-code-completion */ var TsCodeCompletion = { tsRef: TsRef, diff --git a/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsParser.js b/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsParser.js index 23774e770234d4f50402c707fb26ab382d09ddd1..a8e2736ad389817c72700e9cb59c6802dfea3849 100644 --- a/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsParser.js +++ b/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsParser.js @@ -12,7 +12,7 @@ */ /** - * Module: TYPO3/CMS/T3editor/Addon/Hint/TsParser + * Module: @typo3/t3editor/addon/hint/ts-parser * Contains the TsCodeCompletion class */ define([ @@ -21,7 +21,7 @@ define([ /** * * @type {{typeId: null, properties: null, typeTree: Array, doc: null, tsRef: null, extTsObjTree: Array, tsTree: null}} - * @exports TYPO3/CMS/T3editor/Addon/Hint/TsParser + * @exports @typo3/t3editor/addon/hint/ts-parser */ var TsParser = { typeId: null, diff --git a/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsRef.js b/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsRef.js index 37c2392161e0a46f501b426d59e348dfd187168e..31b96670b2fee1e23a887fe42a65c5de4e8eef80 100644 --- a/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsRef.js +++ b/typo3/sysext/t3editor/Resources/Public/JavaScript/Addon/Hint/TsRef.js @@ -12,14 +12,14 @@ */ /** - * Module: TYPO3/CMS/T3editor/CodeCompletion/TsRef + * Module: @typo3/t3editor/code-completion/ts-ref * Contains the TsCodeCompletion class */ define(['jquery'], function($) { /** * * @type {{typeId: null, properties: null, typeTree: Array, doc: null}} - * @exports TYPO3/CMS/T3editor/CodeCompletion/TsRef + * @exports @typo3/t3editor/code-completion/ts-ref */ var TsRef = { typeId: null, diff --git a/typo3/sysext/t3editor/Resources/Public/JavaScript/Element/CodeMirrorElement.js b/typo3/sysext/t3editor/Resources/Public/JavaScript/element/code-mirror-element.js similarity index 91% rename from typo3/sysext/t3editor/Resources/Public/JavaScript/Element/CodeMirrorElement.js rename to typo3/sysext/t3editor/Resources/Public/JavaScript/element/code-mirror-element.js index 97b45750500d4ee670ae02ad147dba6808aa4124..2865fc1ca0193e990954a4318be6c2049e8f7f5f 100644 --- a/typo3/sysext/t3editor/Resources/Public/JavaScript/Element/CodeMirrorElement.js +++ b/typo3/sysext/t3editor/Resources/Public/JavaScript/element/code-mirror-element.js @@ -10,7 +10,7 @@ * * The TYPO3 project - inspiring people to share! */ -var __decorate=function(e,t,o,r){var i,n=arguments.length,l=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(n<3?i(l):n>3?i(t,o,l):i(t,o))||l);return n>3&&l&&Object.defineProperty(t,o,l),l};import{LitElement,html,css}from"lit";import{customElement,property,state}from"lit/decorators.js";import"TYPO3/CMS/Backend/Element/SpinnerElement.js";let CodeMirrorElement=class extends LitElement{constructor(){super(...arguments),this.addons=["codemirror/addon/display/panel"],this.options={},this.scrollto=0,this.marktext=[],this.lineDigits=0,this.autoheight=!1,this.nolazyload=!1,this.panel="bottom",this.loaded=!1}render(){return html` +var __decorate=function(e,t,o,r){var i,n=arguments.length,l=n<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(n<3?i(l):n>3?i(t,o,l):i(t,o))||l);return n>3&&l&&Object.defineProperty(t,o,l),l};import{LitElement,html,css}from"lit";import{customElement,property,state}from"lit/decorators.js";import"@typo3/backend/element/spinner-element.js";let CodeMirrorElement=class extends LitElement{constructor(){super(...arguments),this.addons=["codemirror/addon/display/panel"],this.options={},this.scrollto=0,this.marktext=[],this.lineDigits=0,this.autoheight=!1,this.nolazyload=!1,this.panel="bottom",this.loaded=!1}render(){return html` <slot></slot> <slot name="codemirror"></slot> ${this.loaded?"":html`<typo3-backend-spinner size="large" variant="dark"></typo3-backend-spinner>`} diff --git a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptObjectBrowserController.php b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptObjectBrowserController.php index b51cf97fcb429e91c911666afb2dac3011071c8d..6b206473b4e1174f819ad7cb7e1b87d826fce54e 100644 --- a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptObjectBrowserController.php +++ b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptObjectBrowserController.php @@ -370,7 +370,7 @@ class TypoScriptObjectBrowserController extends TypoScriptTemplateModuleControll $assigns['activeConditions'] = $activeConditions; // Ending section displayoptions } - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Tooltip.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/tooltip.js'); $view = GeneralUtility::makeInstance(BackendTemplateView::class); $view->setTemplateRootPaths(['EXT:tstemplate/Resources/Private/Templates']); $view->assignMultiple($assigns); diff --git a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php index 5c31328b199e3e765d8d88cf88d05543d30f25a2..6464e038a0886a3785dd5281dbcdf87bcfd38b28 100644 --- a/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php +++ b/typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php @@ -225,8 +225,8 @@ class TypoScriptTemplateModuleController $isPageZero = false; if ($this->id && $this->access) { // Setting up the context sensitive menu - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/ContextMenu.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Element/ImmediateActionElement.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/context-menu.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/element/immediate-action-element.js'); // Build the module content $this->moduleTemplate->assign('pageId', $this->id); $this->moduleTemplate->assign('typoscriptTemplateModuleContent', $this->getExtObjContent()); diff --git a/typo3/sysext/tstemplate/Classes/Controller/TyposcriptConstantEditorController.php b/typo3/sysext/tstemplate/Classes/Controller/TyposcriptConstantEditorController.php index 37793176a9d79da2ba83544acb4439359c10dc47..c8f91ed51cc1cf50e96f2fc0906a2bbc10f5de1f 100644 --- a/typo3/sysext/tstemplate/Classes/Controller/TyposcriptConstantEditorController.php +++ b/typo3/sysext/tstemplate/Classes/Controller/TyposcriptConstantEditorController.php @@ -265,7 +265,7 @@ class TyposcriptConstantEditorController extends TypoScriptTemplateModuleControl <input class="form-control formengine-colorpickerelement t3js-color-picker" type="text" id="input-' . $idName . '" rel="' . $idName . '" name="' . $fN . '" value="' . $fV . '" data-form-update-fragment="' . $fragmentNameEscaped . '"/>'; - $this->javaScriptInstructions['color'] ??= JavaScriptModuleInstruction::create('TYPO3/CMS/Backend/ColorPicker.js') + $this->javaScriptInstructions['color'] ??= JavaScriptModuleInstruction::create('@typo3/backend/color-picker.js') ->invoke('initialize'); break; case 'wrap': diff --git a/typo3/sysext/tstemplate/Configuration/JavaScriptModules.php b/typo3/sysext/tstemplate/Configuration/JavaScriptModules.php index a3f9a871f09d73e03583ac08bf4e0d61ea2a6010..a0abc353c027a5ee547424862448f7b6e7180d21 100644 --- a/typo3/sysext/tstemplate/Configuration/JavaScriptModules.php +++ b/typo3/sysext/tstemplate/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Tstemplate/' => 'EXT:tstemplate/Resources/Public/JavaScript/', + '@typo3/tstemplate/' => 'EXT:tstemplate/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/tstemplate/Resources/Private/Templates/ConstantEditor.html b/typo3/sysext/tstemplate/Resources/Private/Templates/ConstantEditor.html index 89fb542cd02770089c113f8326cff10720827c99..f030b16c31fb542b825965c41a2c4acbd90efa78 100644 --- a/typo3/sysext/tstemplate/Resources/Private/Templates/ConstantEditor.html +++ b/typo3/sysext/tstemplate/Resources/Private/Templates/ConstantEditor.html @@ -4,7 +4,7 @@ > <f:be.pageRenderer - includeJavaScriptModules="{0: 'TYPO3/CMS/Tstemplate/ConstantEditor.js'}" + includeJavaScriptModules="{0: '@typo3/tstemplate/constant-editor.js'}" /> <h3><f:translate key="LLL:EXT:tstemplate/Resources/Private/Language/locallang_ceditor.xlf:editConstants"/></h3> <div class="row row-cols-auto g-3 align-items-center"> diff --git a/typo3/sysext/tstemplate/Resources/Private/Templates/InformationModule.html b/typo3/sysext/tstemplate/Resources/Private/Templates/InformationModule.html index 9e5d111f7826d48cd8c005db5cf5e3d57602aa1f..4d99b5a64dc4ff3b178885f333f8f0865e5680e5 100644 --- a/typo3/sysext/tstemplate/Resources/Private/Templates/InformationModule.html +++ b/typo3/sysext/tstemplate/Resources/Private/Templates/InformationModule.html @@ -4,7 +4,7 @@ > <f:be.pageRenderer - includeJavaScriptModules="{0: 'TYPO3/CMS/Tstemplate/InformationModule.js'}" + includeJavaScriptModules="{0: '@typo3/tstemplate/information-module.js'}" /> <h3> diff --git a/typo3/sysext/tstemplate/Resources/Private/Templates/TemplateObjectBrowserModuleFunction.html b/typo3/sysext/tstemplate/Resources/Private/Templates/TemplateObjectBrowserModuleFunction.html index 63819864445fc8c436dd0881bbc5bfc74bc4b1e0..e627ceb6894e20e4f111c64686ef2d08de77518c 100644 --- a/typo3/sysext/tstemplate/Resources/Private/Templates/TemplateObjectBrowserModuleFunction.html +++ b/typo3/sysext/tstemplate/Resources/Private/Templates/TemplateObjectBrowserModuleFunction.html @@ -142,7 +142,7 @@ </f:then> <f:else> - <f:be.pageRenderer includeJavaScriptModules="{0: 'TYPO3/CMS/Tstemplate/TypoScriptObjectBrowser.js'}"/> + <f:be.pageRenderer includeJavaScriptModules="{0: '@typo3/tstemplate/typo-script-object-browser.js'}"/> <div class="row row-cols-auto align-items-end"> <f:if condition="{hasTsBrowserTypes}"> <div class="col"> diff --git a/typo3/sysext/tstemplate/Resources/Public/JavaScript/InformationModule.js b/typo3/sysext/tstemplate/Resources/Public/JavaScript/InformationModule.js deleted file mode 100644 index a0890f04da9108cff02fc6de967930f841130b92..0000000000000000000000000000000000000000 --- a/typo3/sysext/tstemplate/Resources/Public/JavaScript/InformationModule.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";class InformationModule{constructor(){this.registerEventListeners()}registerEventListeners(){new RegularEvent("typo3:datahandler:process",e=>{const t=e.detail.payload;"delete"!==t.action||t.hasErrors||document.location.reload()}).bindTo(document)}}export default new InformationModule; \ No newline at end of file diff --git a/typo3/sysext/tstemplate/Resources/Public/JavaScript/TypoScriptObjectBrowser.js b/typo3/sysext/tstemplate/Resources/Public/JavaScript/TypoScriptObjectBrowser.js deleted file mode 100644 index 718eef5099b44bb822918a5bd6b21c8b8057976a..0000000000000000000000000000000000000000 --- a/typo3/sysext/tstemplate/Resources/Public/JavaScript/TypoScriptObjectBrowser.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import"TYPO3/CMS/Backend/Input/Clearable.js";class TypoScriptObjectBrowser{constructor(){this.searchField=document.querySelector('input[name="search_field"]'),this.searchResultShown=""!==this.searchField.value,this.searchField.clearable({onClear:e=>{this.searchResultShown&&e.closest("form").submit()}}),self.location.hash&&window.scrollTo(window.pageXOffset,window.pageYOffset-40)}}export default new TypoScriptObjectBrowser; \ No newline at end of file diff --git a/typo3/sysext/tstemplate/Resources/Public/JavaScript/ConstantEditor.js b/typo3/sysext/tstemplate/Resources/Public/JavaScript/constant-editor.js similarity index 100% rename from typo3/sysext/tstemplate/Resources/Public/JavaScript/ConstantEditor.js rename to typo3/sysext/tstemplate/Resources/Public/JavaScript/constant-editor.js diff --git a/typo3/sysext/tstemplate/Resources/Public/JavaScript/information-module.js b/typo3/sysext/tstemplate/Resources/Public/JavaScript/information-module.js new file mode 100644 index 0000000000000000000000000000000000000000..e46b6f3e29c20bbc89152551f28757ccb79a86ad --- /dev/null +++ b/typo3/sysext/tstemplate/Resources/Public/JavaScript/information-module.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import RegularEvent from"@typo3/core/event/regular-event.js";class InformationModule{constructor(){this.registerEventListeners()}registerEventListeners(){new RegularEvent("typo3:datahandler:process",e=>{const t=e.detail.payload;"delete"!==t.action||t.hasErrors||document.location.reload()}).bindTo(document)}}export default new InformationModule; \ No newline at end of file diff --git a/typo3/sysext/tstemplate/Resources/Public/JavaScript/typo-script-object-browser.js b/typo3/sysext/tstemplate/Resources/Public/JavaScript/typo-script-object-browser.js new file mode 100644 index 0000000000000000000000000000000000000000..a18ab94e0f0f550bb2eef40f8296468512112e05 --- /dev/null +++ b/typo3/sysext/tstemplate/Resources/Public/JavaScript/typo-script-object-browser.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import"@typo3/backend/input/clearable.js";class TypoScriptObjectBrowser{constructor(){this.searchField=document.querySelector('input[name="search_field"]'),this.searchResultShown=""!==this.searchField.value,this.searchField.clearable({onClear:e=>{this.searchResultShown&&e.closest("form").submit()}}),self.location.hash&&window.scrollTo(window.pageXOffset,window.pageYOffset-40)}}export default new TypoScriptObjectBrowser; \ No newline at end of file diff --git a/typo3/sysext/viewpage/Configuration/JavaScriptModules.php b/typo3/sysext/viewpage/Configuration/JavaScriptModules.php index 1768746d7a6d577bc8d9c07c6a1a87a356898569..c25993b1a1ddd0f84c1d9dfc256c71ffbb76b15b 100644 --- a/typo3/sysext/viewpage/Configuration/JavaScriptModules.php +++ b/typo3/sysext/viewpage/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Viewpage/' => 'EXT:viewpage/Resources/Public/JavaScript/', + '@typo3/viewpage/' => 'EXT:viewpage/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/viewpage/Resources/Private/Templates/Show.html b/typo3/sysext/viewpage/Resources/Private/Templates/Show.html index bf730cdba822af11611a4cc35cf9690a3e0bb025..d9f53b666726fd375896dc0d77e91d5eed5760e1 100644 --- a/typo3/sysext/viewpage/Resources/Private/Templates/Show.html +++ b/typo3/sysext/viewpage/Resources/Private/Templates/Show.html @@ -13,7 +13,7 @@ 0:'{f:uri.resource(path:\'EXT:viewpage/Resources/Public/Css/ui-lightness/jquery-ui-1.10.3.custom.min.css\')}' }" includeJavaScriptModules="{ - 0:'TYPO3/CMS/Viewpage/Main.js' + 0:'@typo3/viewpage/main.js' }" /> diff --git a/typo3/sysext/viewpage/Resources/Public/JavaScript/Main.js b/typo3/sysext/viewpage/Resources/Public/JavaScript/Main.js deleted file mode 100644 index e61a28fc9b572f704c7af2c1cabd86ef2c7a51fb..0000000000000000000000000000000000000000 --- a/typo3/sysext/viewpage/Resources/Public/JavaScript/Main.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import"jquery-ui/resizable.js";import PersistentStorage from"TYPO3/CMS/Backend/Storage/Persistent.js";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";var Selectors;!function(e){e.resizableContainerIdentifier=".t3js-viewpage-resizeable",e.sizeIdentifier=".t3js-viewpage-size",e.moduleBodySelector=".t3js-module-body",e.customSelector=".t3js-preset-custom",e.customWidthSelector=".t3js-preset-custom",e.customHeightSelector=".t3js-preset-custom-height",e.changeOrientationSelector=".t3js-change-orientation",e.changePresetSelector=".t3js-change-preset",e.inputWidthSelector=".t3js-viewpage-input-width",e.inputHeightSelector=".t3js-viewpage-input-height",e.currentLabelSelector=".t3js-viewpage-current-label",e.topbarContainerSelector=".t3js-viewpage-topbar",e.refreshSelector=".t3js-viewpage-refresh"}(Selectors||(Selectors={}));class ViewPage{constructor(){this.defaultLabel="",this.minimalHeight=300,this.minimalWidth=300,this.storagePrefix="moduleData.web_view.States.",this.queue=[],this.queueIsRunning=!1,$(()=>{const e=$(".t3js-preset-custom-label");this.defaultLabel=e.length>0?e.html().trim():"",this.$iframe=$("#tx_this_iframe"),this.$resizableContainer=$(Selectors.resizableContainerIdentifier),this.$sizeSelector=$(Selectors.sizeIdentifier),this.initialize()})}static getCurrentWidth(){return $(Selectors.inputWidthSelector).val()}static getCurrentHeight(){return $(Selectors.inputHeightSelector).val()}static setLabel(e){$(Selectors.currentLabelSelector).html((new SecurityUtility).encodeHtml(e))}static getCurrentLabel(){return $(Selectors.currentLabelSelector).html().trim()}persistQueue(){if(!1===this.queueIsRunning&&this.queue.length>=1){this.queueIsRunning=!0;let e=this.queue.shift();PersistentStorage.set(e.storageIdentifier,e.data).done(()=>{this.queueIsRunning=!1,this.persistQueue()})}}addToQueue(e,t){const i={storageIdentifier:e,data:t};this.queue.push(i),this.queue.length>=1&&this.persistQueue()}setSize(e,t){isNaN(t)&&(t=this.calculateContainerMaxHeight()),t<this.minimalHeight&&(t=this.minimalHeight),isNaN(e)&&(e=this.calculateContainerMaxWidth()),e<this.minimalWidth&&(e=this.minimalWidth),$(Selectors.inputWidthSelector).val(e),$(Selectors.inputHeightSelector).val(t),this.$resizableContainer.css({width:e,height:t,left:0})}persistCurrentPreset(){let e={width:ViewPage.getCurrentWidth(),height:ViewPage.getCurrentHeight(),label:ViewPage.getCurrentLabel()};this.addToQueue(this.storagePrefix+"current",e)}persistCustomPreset(){let e={width:ViewPage.getCurrentWidth(),height:ViewPage.getCurrentHeight()};$(Selectors.customSelector).data("width",e.width),$(Selectors.customSelector).data("height",e.height),$(Selectors.customWidthSelector).html(e.width),$(Selectors.customHeightSelector).html(e.height),this.addToQueue(this.storagePrefix+"custom",e)}persistCustomPresetAfterChange(){clearTimeout(this.queueDelayTimer),this.queueDelayTimer=window.setTimeout(()=>{this.persistCustomPreset()},1e3)}initialize(){$(document).on("click",Selectors.changeOrientationSelector,()=>{const e=$(Selectors.inputHeightSelector).val(),t=$(Selectors.inputWidthSelector).val();this.setSize(e,t),this.persistCurrentPreset()}),$(document).on("change",Selectors.inputWidthSelector,()=>{const e=$(Selectors.inputWidthSelector).val(),t=$(Selectors.inputHeightSelector).val();this.setSize(e,t),ViewPage.setLabel(this.defaultLabel),this.persistCustomPresetAfterChange()}),$(document).on("change",Selectors.inputHeightSelector,()=>{const e=$(Selectors.inputWidthSelector).val(),t=$(Selectors.inputHeightSelector).val();this.setSize(e,t),ViewPage.setLabel(this.defaultLabel),this.persistCustomPresetAfterChange()}),$(document).on("click",Selectors.changePresetSelector,e=>{const t=$(e.currentTarget).data();this.setSize(parseInt(t.width,10),parseInt(t.height,10)),ViewPage.setLabel(t.label),this.persistCurrentPreset()}),$(document).on("click",Selectors.refreshSelector,()=>{document.getElementById("tx_viewpage_iframe").contentWindow.location.reload()}),this.$resizableContainer.resizable({handles:"w, sw, s, se, e"}),this.$resizableContainer.on("resizestart",e=>{$(e.currentTarget).append('<div id="viewpage-iframe-cover" style="z-index:99;position:absolute;width:100%;top:0;left:0;height:100%;"></div>')}),this.$resizableContainer.on("resize",(e,t)=>{t.size.width=t.originalSize.width+2*(t.size.width-t.originalSize.width),t.size.height<this.minimalHeight&&(t.size.height=this.minimalHeight),t.size.width<this.minimalWidth&&(t.size.width=this.minimalWidth),$(Selectors.inputWidthSelector).val(t.size.width),$(Selectors.inputHeightSelector).val(t.size.height),this.$resizableContainer.css({left:0}),ViewPage.setLabel(this.defaultLabel)}),this.$resizableContainer.on("resizestop",()=>{$("#viewpage-iframe-cover").remove(),this.persistCurrentPreset(),this.persistCustomPreset()})}calculateContainerMaxHeight(){this.$resizableContainer.hide();let e=$(Selectors.moduleBodySelector),t=e.outerHeight()-e.height(),i=$(document).height(),s=$(Selectors.topbarContainerSelector).outerHeight();return this.$resizableContainer.show(),i-t-s-8}calculateContainerMaxWidth(){this.$resizableContainer.hide();let e=$(Selectors.moduleBodySelector),t=e.outerWidth()-e.width(),i=$(document).width();return this.$resizableContainer.show(),parseInt(i-t+"",10)}}export default new ViewPage; \ No newline at end of file diff --git a/typo3/sysext/viewpage/Resources/Public/JavaScript/main.js b/typo3/sysext/viewpage/Resources/Public/JavaScript/main.js new file mode 100644 index 0000000000000000000000000000000000000000..a0ca703a3bed69ef90b16800382ff0beaa2cd3cd --- /dev/null +++ b/typo3/sysext/viewpage/Resources/Public/JavaScript/main.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import"jquery-ui/resizable.js";import PersistentStorage from"@typo3/backend/storage/persistent.js";import SecurityUtility from"@typo3/core/security-utility.js";var Selectors;!function(e){e.resizableContainerIdentifier=".t3js-viewpage-resizeable",e.sizeIdentifier=".t3js-viewpage-size",e.moduleBodySelector=".t3js-module-body",e.customSelector=".t3js-preset-custom",e.customWidthSelector=".t3js-preset-custom",e.customHeightSelector=".t3js-preset-custom-height",e.changeOrientationSelector=".t3js-change-orientation",e.changePresetSelector=".t3js-change-preset",e.inputWidthSelector=".t3js-viewpage-input-width",e.inputHeightSelector=".t3js-viewpage-input-height",e.currentLabelSelector=".t3js-viewpage-current-label",e.topbarContainerSelector=".t3js-viewpage-topbar",e.refreshSelector=".t3js-viewpage-refresh"}(Selectors||(Selectors={}));class ViewPage{constructor(){this.defaultLabel="",this.minimalHeight=300,this.minimalWidth=300,this.storagePrefix="moduleData.web_view.States.",this.queue=[],this.queueIsRunning=!1,$(()=>{const e=$(".t3js-preset-custom-label");this.defaultLabel=e.length>0?e.html().trim():"",this.$iframe=$("#tx_this_iframe"),this.$resizableContainer=$(Selectors.resizableContainerIdentifier),this.$sizeSelector=$(Selectors.sizeIdentifier),this.initialize()})}static getCurrentWidth(){return $(Selectors.inputWidthSelector).val()}static getCurrentHeight(){return $(Selectors.inputHeightSelector).val()}static setLabel(e){$(Selectors.currentLabelSelector).html((new SecurityUtility).encodeHtml(e))}static getCurrentLabel(){return $(Selectors.currentLabelSelector).html().trim()}persistQueue(){if(!1===this.queueIsRunning&&this.queue.length>=1){this.queueIsRunning=!0;let e=this.queue.shift();PersistentStorage.set(e.storageIdentifier,e.data).done(()=>{this.queueIsRunning=!1,this.persistQueue()})}}addToQueue(e,t){const i={storageIdentifier:e,data:t};this.queue.push(i),this.queue.length>=1&&this.persistQueue()}setSize(e,t){isNaN(t)&&(t=this.calculateContainerMaxHeight()),t<this.minimalHeight&&(t=this.minimalHeight),isNaN(e)&&(e=this.calculateContainerMaxWidth()),e<this.minimalWidth&&(e=this.minimalWidth),$(Selectors.inputWidthSelector).val(e),$(Selectors.inputHeightSelector).val(t),this.$resizableContainer.css({width:e,height:t,left:0})}persistCurrentPreset(){let e={width:ViewPage.getCurrentWidth(),height:ViewPage.getCurrentHeight(),label:ViewPage.getCurrentLabel()};this.addToQueue(this.storagePrefix+"current",e)}persistCustomPreset(){let e={width:ViewPage.getCurrentWidth(),height:ViewPage.getCurrentHeight()};$(Selectors.customSelector).data("width",e.width),$(Selectors.customSelector).data("height",e.height),$(Selectors.customWidthSelector).html(e.width),$(Selectors.customHeightSelector).html(e.height),this.addToQueue(this.storagePrefix+"custom",e)}persistCustomPresetAfterChange(){clearTimeout(this.queueDelayTimer),this.queueDelayTimer=window.setTimeout(()=>{this.persistCustomPreset()},1e3)}initialize(){$(document).on("click",Selectors.changeOrientationSelector,()=>{const e=$(Selectors.inputHeightSelector).val(),t=$(Selectors.inputWidthSelector).val();this.setSize(e,t),this.persistCurrentPreset()}),$(document).on("change",Selectors.inputWidthSelector,()=>{const e=$(Selectors.inputWidthSelector).val(),t=$(Selectors.inputHeightSelector).val();this.setSize(e,t),ViewPage.setLabel(this.defaultLabel),this.persistCustomPresetAfterChange()}),$(document).on("change",Selectors.inputHeightSelector,()=>{const e=$(Selectors.inputWidthSelector).val(),t=$(Selectors.inputHeightSelector).val();this.setSize(e,t),ViewPage.setLabel(this.defaultLabel),this.persistCustomPresetAfterChange()}),$(document).on("click",Selectors.changePresetSelector,e=>{const t=$(e.currentTarget).data();this.setSize(parseInt(t.width,10),parseInt(t.height,10)),ViewPage.setLabel(t.label),this.persistCurrentPreset()}),$(document).on("click",Selectors.refreshSelector,()=>{document.getElementById("tx_viewpage_iframe").contentWindow.location.reload()}),this.$resizableContainer.resizable({handles:"w, sw, s, se, e"}),this.$resizableContainer.on("resizestart",e=>{$(e.currentTarget).append('<div id="viewpage-iframe-cover" style="z-index:99;position:absolute;width:100%;top:0;left:0;height:100%;"></div>')}),this.$resizableContainer.on("resize",(e,t)=>{t.size.width=t.originalSize.width+2*(t.size.width-t.originalSize.width),t.size.height<this.minimalHeight&&(t.size.height=this.minimalHeight),t.size.width<this.minimalWidth&&(t.size.width=this.minimalWidth),$(Selectors.inputWidthSelector).val(t.size.width),$(Selectors.inputHeightSelector).val(t.size.height),this.$resizableContainer.css({left:0}),ViewPage.setLabel(this.defaultLabel)}),this.$resizableContainer.on("resizestop",()=>{$("#viewpage-iframe-cover").remove(),this.persistCurrentPreset(),this.persistCustomPreset()})}calculateContainerMaxHeight(){this.$resizableContainer.hide();let e=$(Selectors.moduleBodySelector),t=e.outerHeight()-e.height(),i=$(document).height(),s=$(Selectors.topbarContainerSelector).outerHeight();return this.$resizableContainer.show(),i-t-s-8}calculateContainerMaxWidth(){this.$resizableContainer.hide();let e=$(Selectors.moduleBodySelector),t=e.outerWidth()-e.width(),i=$(document).width();return this.$resizableContainer.show(),parseInt(i-t+"",10)}}export default new ViewPage; \ No newline at end of file diff --git a/typo3/sysext/workspaces/Classes/Controller/PreviewController.php b/typo3/sysext/workspaces/Classes/Controller/PreviewController.php index 7799deb22c28ec49b24a7da5ccfdb2cc0167f55f..f9e05e043ada177c395b81a51f24261dba6660b7 100644 --- a/typo3/sysext/workspaces/Classes/Controller/PreviewController.php +++ b/typo3/sysext/workspaces/Classes/Controller/PreviewController.php @@ -66,7 +66,7 @@ class PreviewController $view = $this->moduleTemplateFactory->create($request, 'typo3/cms-workspaces'); $view->getDocHeaderComponent()->disable(); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Workspaces/Preview.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/workspaces/preview.js'); $this->pageRenderer->addInlineSetting('Workspaces', 'States', $backendUser->uc['moduleData']['Workspaces']['States'] ?? []); $this->pageRenderer->addInlineSetting('FormEngine', 'moduleUrl', (string)$this->uriBuilder->buildUriFromRoute('record_edit')); $this->pageRenderer->addInlineSetting('RecordHistory', 'moduleUrl', (string)$this->uriBuilder->buildUriFromRoute('record_history')); diff --git a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php index 57cfb6a4eeadd93ac93ce9668635886875c62e56..6bf05d97c6d578a9ae789753ec5a8ced440b81cb 100644 --- a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php +++ b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php @@ -75,8 +75,8 @@ class ReviewController $this->pageRenderer->addInlineSetting('WebLayout', 'moduleUrl', (string)$this->uriBuilder->buildUriFromRoute( trim($this->getBackendUser()->getTSConfig()['options.']['overridePageModule'] ?? 'web_layout') )); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Workspaces/Backend.js'); - $this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/MultiRecordSelection.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/workspaces/backend.js'); + $this->pageRenderer->loadJavaScriptModule('@typo3/backend/multi-record-selection.js'); $this->pageRenderer->addInlineLanguageLabelFile('EXT:workspaces/Resources/Private/Language/locallang.xlf'); $backendUser = $this->getBackendUser(); diff --git a/typo3/sysext/workspaces/Configuration/JavaScriptModules.php b/typo3/sysext/workspaces/Configuration/JavaScriptModules.php index 20e14f6b1fbc0aeb9e87df61e3fcb22ed7f04cf5..d2508d69d56c7288fbe00d2b1f6a8480809d31e1 100644 --- a/typo3/sysext/workspaces/Configuration/JavaScriptModules.php +++ b/typo3/sysext/workspaces/Configuration/JavaScriptModules.php @@ -6,6 +6,6 @@ return [ 'core', ], 'imports' => [ - 'TYPO3/CMS/Workspaces/' => 'EXT:workspaces/Resources/Public/JavaScript/', + '@typo3/workspaces/' => 'EXT:workspaces/Resources/Public/JavaScript/', ], ]; diff --git a/typo3/sysext/workspaces/Resources/Private/Templates/ToolbarItems/ToolbarItem.html b/typo3/sysext/workspaces/Resources/Private/Templates/ToolbarItems/ToolbarItem.html index 7643441220275e80d9d1e827f31560b8279eb73a..5e2d0f6c6a2e811929d78858c1b7cff826f9bfad 100644 --- a/typo3/sysext/workspaces/Resources/Private/Templates/ToolbarItems/ToolbarItem.html +++ b/typo3/sysext/workspaces/Resources/Private/Templates/ToolbarItems/ToolbarItem.html @@ -1,7 +1,7 @@ <html xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true"> <f:be.pageRenderer includeJavaScriptModules="{ - 0: 'TYPO3/CMS/Workspaces/Toolbar/WorkspacesMenu.js' + 0: '@typo3/workspaces/toolbar/workspaces-menu.js' }" addJsInlineLabels="{ 'Workspaces.workspaceTitle': workspaceTitle diff --git a/typo3/sysext/workspaces/Resources/Public/JavaScript/Backend.js b/typo3/sysext/workspaces/Resources/Public/JavaScript/Backend.js deleted file mode 100644 index 8cd27034dabd292cee324934618c44b2f816f281..0000000000000000000000000000000000000000 --- a/typo3/sysext/workspaces/Resources/Public/JavaScript/Backend.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import"TYPO3/CMS/Backend/Element/IconElement.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import"TYPO3/CMS/Backend/Input/Clearable.js";import Workspaces from"TYPO3/CMS/Workspaces/Workspaces.js";import Modal from"TYPO3/CMS/Backend/Modal.js";import Persistent from"TYPO3/CMS/Backend/Storage/Persistent.js";import Tooltip from"TYPO3/CMS/Backend/Tooltip.js";import Utility from"TYPO3/CMS/Backend/Utility.js";import Wizard from"TYPO3/CMS/Backend/Wizard.js";import SecurityUtility from"TYPO3/CMS/Core/SecurityUtility.js";import windowManager from"TYPO3/CMS/Backend/WindowManager.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";var Identifiers;!function(e){e.searchForm="#workspace-settings-form",e.searchTextField='#workspace-settings-form input[name="search-text"]',e.searchSubmitBtn='#workspace-settings-form button[type="submit"]',e.depthSelector='#workspace-settings-form [name="depth"]',e.languageSelector='#workspace-settings-form select[name="languages"]',e.stagesSelector='#workspace-settings-form select[name="stages"]',e.workspaceActions=".workspace-actions",e.chooseStageAction='.workspace-actions [name="stage-action"]',e.chooseSelectionAction='.workspace-actions [name="selection-action"]',e.chooseMassAction='.workspace-actions [name="mass-action"]',e.container="#workspace-panel",e.contentsContainer="#workspace-contents",e.noContentsContainer="#workspace-contents-empty",e.previewLinksButton=".t3js-preview-link",e.pagination="#workspace-pagination"}(Identifiers||(Identifiers={}));class Backend extends Workspaces{constructor(){super(),this.elements={},this.settings={dir:"ASC",id:TYPO3.settings.Workspaces.id,depth:1,language:"all",limit:30,query:"",sort:"label_Live",start:0,filterTxt:""},this.paging={currentPage:1,totalPages:1,totalItems:0},this.latestPath="",this.markedRecordsForMassAction=[],this.indentationPadding=26,this.handleCheckboxStateChanged=e=>{const t=$(e.target),a=t.parents("tr"),s=t.prop("checked"),n=a.data("table")+":"+a.data("uid")+":"+a.data("t3ver_oid");if(s)this.markedRecordsForMassAction.push(n);else{const e=this.markedRecordsForMassAction.indexOf(n);e>-1&&this.markedRecordsForMassAction.splice(e,1)}a.data("collectionCurrent")?Backend.changeCollectionChildrenState(a.data("collectionCurrent"),s):a.data("collection")&&(Backend.changeCollectionChildrenState(a.data("collection"),s),Backend.changeCollectionParentState(a.data("collection"),s)),this.elements.$chooseMassAction.prop("disabled",this.markedRecordsForMassAction.length>0)},this.viewChanges=e=>{e.preventDefault();const t=$(e.currentTarget).closest("tr");this.sendRemoteRequest(this.generateRemotePayload("getRowDetails",{stage:t.data("stage"),t3ver_oid:t.data("t3ver_oid"),table:t.data("table"),uid:t.data("uid"),filterFields:!0})).then(async e=>{const a=(await e.resolve())[0].result.data[0],s=$("<div />"),n=$("<ul />",{class:"nav nav-tabs",role:"tablist"}),i=$("<div />",{class:"tab-content"}),o=[];s.append($("<p />").html(TYPO3.lang.path.replace("{0}",a.path_Live)),$("<p />").html(TYPO3.lang.current_step.replace("{0}",a.label_Stage).replace("{1}",a.stage_position).replace("{2}",a.stage_count))),a.diff.length>0&&(n.append($("<li />",{role:"presentation",class:"nav-item"}).append($("<a />",{class:"nav-link",href:"#workspace-changes","aria-controls":"workspace-changes",role:"tab","data-bs-toggle":"tab"}).text(TYPO3.lang["window.recordChanges.tabs.changeSummary"]))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-changes"}).append($("<div />",{class:"form-section"}).append(Backend.generateDiffView(a.diff))))),a.comments.length>0&&(n.append($("<li />",{role:"presentation",class:"nav-item"}).append($("<a />",{class:"nav-link",href:"#workspace-comments","aria-controls":"workspace-comments",role:"tab","data-bs-toggle":"tab"}).html(TYPO3.lang["window.recordChanges.tabs.comments"]+" ").append($("<span />",{class:"badge"}).text(a.comments.length)))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-comments"}).append($("<div />",{class:"form-section"}).append(Backend.generateCommentView(a.comments))))),a.history.total>0&&(n.append($("<li />",{role:"presentation",class:"nav-item"}).append($("<a />",{class:"nav-link",href:"#workspace-history","aria-controls":"workspace-history",role:"tab","data-bs-toggle":"tab"}).text(TYPO3.lang["window.recordChanges.tabs.history"]))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-history"}).append($("<div />",{class:"form-section"}).append(Backend.generateHistoryView(a.history.data))))),n.find("li > a").first().addClass("active"),i.find(".tab-pane").first().addClass("active"),s.append($("<div />").append(n,i)),!1!==a.label_PrevStage&&t.data("stage")!==t.data("prevStage")&&o.push({text:a.label_PrevStage.title,active:!0,btnClass:"btn-default",name:"prevstage",trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.sendToStage(t,"prev")}}),!1!==a.label_NextStage&&o.push({text:a.label_NextStage.title,active:!0,btnClass:"btn-default",name:"nextstage",trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.sendToStage(t,"next")}}),o.push({text:TYPO3.lang.close,active:!0,btnClass:"btn-info",name:"cancel",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}}),Modal.advanced({type:Modal.types.default,title:TYPO3.lang["window.recordInformation"].replace("{0}",t.find(".t3js-title-live").text().trim()),content:s,severity:SeverityEnum.info,buttons:o,size:Modal.sizes.medium})})},this.confirmDeleteRecordFromWorkspace=e=>{const t=$(e.target).closest("tr"),a=Modal.confirm(TYPO3.lang["window.discard.title"],TYPO3.lang["window.discard.message"],SeverityEnum.warning,[{text:TYPO3.lang.cancel,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{a.modal("hide")}},{text:TYPO3.lang.ok,btnClass:"btn-warning",name:"ok"}]);a.on("button.clicked",e=>{"ok"===e.target.name&&this.sendRemoteRequest([this.generateRemoteActionsPayload("deleteSingleRecord",[t.data("table"),t.data("uid")])]).then(()=>{a.modal("hide"),this.getWorkspaceInfos(),Backend.refreshPageTree()})})},this.runSelectionAction=e=>{const t=$(e.currentTarget).val(),a="discard"!==t;if(0===t.length)return;const s=[];for(let e=0;e<this.markedRecordsForMassAction.length;++e){const t=this.markedRecordsForMassAction[e].split(":");s.push({table:t[0],liveId:t[2],versionId:t[1]})}a?this.checkIntegrity({selection:s,type:"selection"}).then(async e=>{Wizard.setForceSelection(!1),"warning"===(await e.resolve())[0].result.result&&this.addIntegrityCheckWarningToWizard(),this.renderSelectionActionWizard(t,s)}):(Wizard.setForceSelection(!1),this.renderSelectionActionWizard(t,s))},this.addIntegrityCheckWarningToWizard=()=>{Wizard.addSlide("integrity-warning","Warning",TYPO3.lang["integrity.hasIssuesDescription"]+"<br>"+TYPO3.lang["integrity.hasIssuesQuestion"],SeverityEnum.warning)},this.runMassAction=e=>{const t=$(e.currentTarget).val(),a="discard"!==t;0!==t.length&&(a?this.checkIntegrity({language:this.settings.language,type:t}).then(async e=>{Wizard.setForceSelection(!1),"warning"===(await e.resolve())[0].result.result&&this.addIntegrityCheckWarningToWizard(),this.renderMassActionWizard(t)}):(Wizard.setForceSelection(!1),this.renderMassActionWizard(t)))},this.sendToSpecificStageAction=e=>{const t=[],a=$(e.currentTarget).val();for(let e=0;e<this.markedRecordsForMassAction.length;++e){const a=this.markedRecordsForMassAction[e].split(":");t.push({table:a[0],uid:a[1],t3ver_oid:a[2]})}this.sendRemoteRequest(this.generateRemoteActionsPayload("sendToSpecificStageWindow",[a,t])).then(async e=>{const s=this.renderSendToStageWindow(await e.resolve());s.on("button.clicked",e=>{if("ok"===e.target.name){const n=Utility.convertFormToObject(e.currentTarget.querySelector("form"));n.affects={elements:t,nextStage:a},this.sendRemoteRequest([this.generateRemoteActionsPayload("sendToSpecificStageExecute",[n]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).then(async e=>{const t=await e.resolve();s.modal("hide"),this.renderWorkspaceInfos(t[1].result),Backend.refreshPageTree()})}}).on("modal-destroyed",()=>{this.elements.$chooseStageAction.val("")})})},this.generatePreviewLinks=()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("generateWorkspacePreviewLinksForAllLanguages",[this.settings.id])).then(async e=>{const t=(await e.resolve())[0].result,a=$("<dl />");$.each(t,(e,t)=>{a.append($("<dt />").text(e),$("<dd />").append($("<a />",{href:t,target:"_blank"}).text(t)))}),Modal.show(TYPO3.lang.previewLink,a,SeverityEnum.info,[{text:TYPO3.lang.ok,active:!0,btnClass:"btn-info",name:"ok",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}}],["modal-inner-scroll"])})},$(()=>{this.getElements(),this.registerEvents(),this.notifyWorkspaceSwitchAction(),this.settings.depth=this.elements.$depthSelector.val(),this.settings.language=this.elements.$languageSelector.val(),this.settings.stage=this.elements.$stagesSelector.val(),this.elements.$container.length&&this.getWorkspaceInfos()})}static refreshPageTree(){top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}static generateDiffView(e){const t=$("<div />",{class:"diff"});for(let a of e)t.append($("<div />",{class:"diff-item"}).append($("<div />",{class:"diff-item-title"}).text(a.label),$("<div />",{class:"diff-item-result diff-item-result-inline"}).html(a.content)));return t}static generateCommentView(e){const t=$("<div />");for(let a of e){const e=$("<div />",{class:"panel panel-default"});a.user_comment.length>0&&e.append($("<div />",{class:"panel-body"}).html(a.user_comment)),e.append($("<div />",{class:"panel-footer"}).append($("<span />",{class:"label label-success"}).text(a.stage_title),$("<span />",{class:"label label-info"}).text(a.tstamp))),t.append($("<div />",{class:"media"}).append($("<div />",{class:"media-left text-center"}).text(a.user_username).prepend($("<div />").html(a.user_avatar)),$("<div />",{class:"media-body"}).append(e)))}return t}static generateHistoryView(e){const t=$("<div />");for(let a of e){const e=$("<div />",{class:"panel panel-default"});let s;if("object"==typeof a.differences){if(0===a.differences.length)continue;s=$("<div />",{class:"diff"});for(let e=0;e<a.differences.length;++e)s.append($("<div />",{class:"diff-item"}).append($("<div />",{class:"diff-item-title"}).text(a.differences[e].label),$("<div />",{class:"diff-item-result diff-item-result-inline"}).html(a.differences[e].html)));e.append($("<div />").append(s))}else e.append($("<div />",{class:"panel-body"}).text(a.differences));e.append($("<div />",{class:"panel-footer"}).append($("<span />",{class:"label label-info"}).text(a.datetime))),t.append($("<div />",{class:"media"}).append($("<div />",{class:"media-left text-center"}).text(a.user).prepend($("<div />").html(a.user_avatar)),$("<div />",{class:"media-body"}).append(e)))}return t}static changeCollectionParentState(e,t){const a=document.querySelector('tr[data-collection-current="'+e+'"] input[type=checkbox]');null!==a&&a.checked!==t&&(a.checked=t,a.dataset.manuallyChanged="true",a.dispatchEvent(new CustomEvent("multiRecordSelection:checkbox:state:changed",{bubbles:!0,cancelable:!1})))}static changeCollectionChildrenState(e,t){const a=document.querySelectorAll('tr[data-collection="'+e+'"] input[type=checkbox]');a.length&&a.forEach(e=>{e.checked!==t&&(e.checked=t,e.dataset.manuallyChanged="true",e.dispatchEvent(new CustomEvent("multiRecordSelection:checkbox:state:changed",{bubbles:!0,cancelable:!1})))})}notifyWorkspaceSwitchAction(){const e=document.querySelector("main[data-workspace-switch-action]");if(e.dataset.workspaceSwitchAction){const t=JSON.parse(e.dataset.workspaceSwitchAction);top.TYPO3.WorkspacesMenu.performWorkspaceSwitch(t.id,t.title),top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh")),top.TYPO3.ModuleMenu.App.refreshMenu()}}checkIntegrity(e){return this.sendRemoteRequest(this.generateRemotePayload("checkIntegrity",e))}getElements(){this.elements.$searchForm=$(Identifiers.searchForm),this.elements.$searchTextField=$(Identifiers.searchTextField),this.elements.$searchSubmitBtn=$(Identifiers.searchSubmitBtn),this.elements.$depthSelector=$(Identifiers.depthSelector),this.elements.$languageSelector=$(Identifiers.languageSelector),this.elements.$stagesSelector=$(Identifiers.stagesSelector),this.elements.$container=$(Identifiers.container),this.elements.$contentsContainer=$(Identifiers.contentsContainer),this.elements.$noContentsContainer=$(Identifiers.noContentsContainer),this.elements.$tableBody=this.elements.$contentsContainer.find("tbody"),this.elements.$workspaceActions=$(Identifiers.workspaceActions),this.elements.$chooseStageAction=$(Identifiers.chooseStageAction),this.elements.$chooseSelectionAction=$(Identifiers.chooseSelectionAction),this.elements.$chooseMassAction=$(Identifiers.chooseMassAction),this.elements.$previewLinksButton=$(Identifiers.previewLinksButton),this.elements.$pagination=$(Identifiers.pagination)}registerEvents(){$(document).on("click",'[data-action="publish"]',e=>{const t=e.target.closest("tr");this.checkIntegrity({selection:[{liveId:t.dataset.uid,versionId:t.dataset.t3ver_oid,table:t.dataset.table}],type:"selection"}).then(async e=>{"warning"===(await e.resolve())[0].result.result&&this.addIntegrityCheckWarningToWizard(),Wizard.setForceSelection(!1),Wizard.addSlide("publish-confirm","Publish",TYPO3.lang["window.publish.message"],SeverityEnum.info),Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("publishSingleRecord",[t.dataset.table,t.dataset.t3ver_oid,t.dataset.uid])).then(()=>{Wizard.dismiss(),this.getWorkspaceInfos(),Backend.refreshPageTree()})}).then(()=>{Wizard.show()})})}).on("click",'[data-action="prevstage"]',e=>{this.sendToStage($(e.currentTarget).closest("tr"),"prev")}).on("click",'[data-action="nextstage"]',e=>{this.sendToStage($(e.currentTarget).closest("tr"),"next")}).on("click",'[data-action="changes"]',this.viewChanges).on("click",'[data-action="preview"]',this.openPreview.bind(this)).on("click",'[data-action="open"]',e=>{const t=e.currentTarget.closest("tr");let a=TYPO3.settings.FormEngine.moduleUrl+"&returnUrl="+encodeURIComponent(document.location.href)+"&id="+TYPO3.settings.Workspaces.id+"&edit["+t.dataset.table+"]["+t.dataset.uid+"]=edit";window.location.href=a}).on("click",'[data-action="version"]',e=>{const t=e.currentTarget.closest("tr"),a="pages"===t.dataset.table?t.dataset.t3ver_oid:t.dataset.pid;window.location.href=TYPO3.settings.WebLayout.moduleUrl+"&id="+a}).on("click",'[data-action="remove"]',this.confirmDeleteRecordFromWorkspace).on("click",'[data-action="expand"]',e=>{const t=$(e.currentTarget);let a;a="true"===t.first().attr("aria-expanded")?"apps-pagetree-expand":"apps-pagetree-collapse",t.empty().append(this.getIcon(a))}),$(window.top.document).on("click",".t3js-workspace-recipients-selectall",()=>{$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!0)}).on("click",".t3js-workspace-recipients-deselectall",()=>{$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!1)}),this.elements.$searchForm.on("submit",e=>{e.preventDefault(),this.settings.filterTxt=this.elements.$searchTextField.val(),this.getWorkspaceInfos()}),this.elements.$searchTextField.on("keyup",e=>{""!==e.target.value?this.elements.$searchSubmitBtn.removeClass("disabled"):(this.elements.$searchSubmitBtn.addClass("disabled"),this.getWorkspaceInfos())});const e=this.elements.$searchTextField.get(0);void 0!==e&&e.clearable({onClear:()=>{this.elements.$searchSubmitBtn.addClass("disabled"),this.settings.filterTxt="",this.getWorkspaceInfos()}}),new RegularEvent("multiRecordSelection:checkbox:state:changed",this.handleCheckboxStateChanged).bindTo(document),this.elements.$depthSelector.on("change",e=>{const t=e.target.value;Persistent.set("moduleData.workspaces.settings.depth",t),this.settings.depth=t,this.getWorkspaceInfos()}),this.elements.$previewLinksButton.on("click",this.generatePreviewLinks),this.elements.$languageSelector.on("change",e=>{const t=$(e.target);Persistent.set("moduleData.workspaces.settings.language",t.val()),this.settings.language=t.val(),this.sendRemoteRequest(this.generateRemotePayload("getWorkspaceInfos",this.settings)).then(async e=>{const a=await e.resolve();this.elements.$languageSelector.prev().html(t.find(":selected").data("icon")),this.renderWorkspaceInfos(a[0].result)})}),this.elements.$stagesSelector.on("change",e=>{const t=e.target.value;Persistent.set("moduleData.workspaces.settings.stage",t),this.settings.stage=t,this.getWorkspaceInfos()}),this.elements.$chooseStageAction.on("change",this.sendToSpecificStageAction),this.elements.$chooseSelectionAction.on("change",this.runSelectionAction),this.elements.$chooseMassAction.on("change",this.runMassAction),this.elements.$pagination.on("click","[data-action]",e=>{e.preventDefault();const t=$(e.currentTarget);let a=!1;switch(t.data("action")){case"previous":this.paging.currentPage>1&&(this.paging.currentPage--,a=!0);break;case"next":this.paging.currentPage<this.paging.totalPages&&(this.paging.currentPage++,a=!0);break;case"page":this.paging.currentPage=parseInt(t.data("page"),10),a=!0;break;default:throw'Unknown action "'+t.data("action")+'"'}a&&(this.settings.start=parseInt(this.settings.limit.toString(),10)*(this.paging.currentPage-1),this.getWorkspaceInfos())})}sendToStage(e,t){let a,s,n;if("next"===t)a=e.data("nextStage"),s="sendToNextStageWindow",n="sendToNextStageExecute";else{if("prev"!==t)throw"Invalid direction given.";a=e.data("prevStage"),s="sendToPrevStageWindow",n="sendToPrevStageExecute"}this.sendRemoteRequest(this.generateRemoteActionsPayload(s,[e.data("uid"),e.data("table"),e.data("t3ver_oid")])).then(async t=>{const s=this.renderSendToStageWindow(await t.resolve());s.on("button.clicked",t=>{if("ok"===t.target.name){const i=Utility.convertFormToObject(t.currentTarget.querySelector("form"));i.affects={table:e.data("table"),nextStage:a,t3ver_oid:e.data("t3ver_oid"),uid:e.data("uid"),elements:[]},this.sendRemoteRequest([this.generateRemoteActionsPayload(n,[i]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).then(async e=>{const t=await e.resolve();s.modal("hide"),this.renderWorkspaceInfos(t[1].result),Backend.refreshPageTree()})}})})}getWorkspaceInfos(){this.sendRemoteRequest(this.generateRemotePayload("getWorkspaceInfos",this.settings)).then(async e=>{this.renderWorkspaceInfos((await e.resolve())[0].result)})}renderWorkspaceInfos(e){this.elements.$tableBody.children().remove(),this.resetMassActionState(e.data.length),this.buildPagination(e.total),0===e.total?(this.elements.$contentsContainer.hide(),this.elements.$noContentsContainer.show()):(this.elements.$contentsContainer.show(),this.elements.$noContentsContainer.hide());for(let t=0;t<e.data.length;++t){const a=e.data[t],s=$("<div />",{class:"btn-group"});let n,i=a.Workspaces_CollectionChildren>0&&""!==a.Workspaces_CollectionCurrent;s.append(this.getAction(i,"expand",a.expanded?"apps-pagetree-expand":"apps-pagetree-collapse").attr("title",TYPO3.lang["tooltip.expand"]).attr("data-bs-target",'[data-collection="'+a.Workspaces_CollectionCurrent+'"]').attr("aria-expanded",!i||a.expanded?"true":"false").attr("data-bs-toggle","collapse"),this.getAction(a.hasChanges,"changes","actions-document-info").attr("title",TYPO3.lang["tooltip.showChanges"]),this.getAction(a.allowedAction_publish&&""===a.Workspaces_CollectionParent,"publish","actions-version-swap-version").attr("title",TYPO3.lang["tooltip.publish"]),this.getAction(a.allowedAction_view,"preview","actions-version-workspace-preview").attr("title",TYPO3.lang["tooltip.viewElementAction"]),this.getAction(a.allowedAction_edit,"open","actions-open").attr("title",TYPO3.lang["tooltip.editElementAction"]),this.getAction(a.allowedAction_versionPageOpen,"version","actions-version-page-open").attr("title",TYPO3.lang["tooltip.openPage"]),this.getAction(a.allowedAction_delete,"remove","actions-version-document-remove").attr("title",TYPO3.lang["tooltip.discardVersion"])),""!==a.integrity.messages&&(n=$("<span>"+this.getIcon(a.integrity.status)+"</span>"),n.attr("data-bs-toggle","tooltip").attr("data-bs-placement","top").attr("data-bs-html","true").attr("title",a.integrity.messages)),this.latestPath!==a.path_Workspace&&(this.latestPath=a.path_Workspace,this.elements.$tableBody.append($("<tr />").append($("<th />"),$("<th />",{colspan:6}).html('<span title="'+a.path_Workspace+'">'+a.path_Workspace_crop+"</span>"))));const o=$("<span />",{class:"form-check form-toggle"}).append($("<input />",{type:"checkbox",class:"form-check-input t3js-multi-record-selection-check"})),r={"data-uid":a.uid,"data-pid":a.livepid,"data-t3ver_oid":a.t3ver_oid,"data-t3ver_wsid":a.t3ver_wsid,"data-table":a.table,"data-next-stage":a.value_nextStage,"data-prev-stage":a.value_prevStage,"data-stage":a.stage};if(""!==a.Workspaces_CollectionParent){let t=e.data.find(e=>e.Workspaces_CollectionCurrent===a.Workspaces_CollectionParent);r["data-collection"]=a.Workspaces_CollectionParent,r.class="collapse"+(t.expanded?" show":"")}else""!==a.Workspaces_CollectionCurrent&&(r["data-collection-current"]=a.Workspaces_CollectionCurrent);this.elements.$tableBody.append($("<tr />",r).append($("<td />").empty().append(o),$("<td />",{class:"t3js-title-workspace",style:a.Workspaces_CollectionLevel>0?"padding-left: "+this.indentationPadding*a.Workspaces_CollectionLevel+"px":""}).html('<span class="icon icon-size-small">'+this.getIcon(a.icon_Workspace)+'</span> <a href="#" data-action="changes"><span class="workspace-state-'+a.state_Workspace+'" title="'+a.label_Workspace+'">'+a.label_Workspace_crop+"</span></a>"),$("<td />",{class:"t3js-title-live"}).html('<span class="icon icon-size-small">'+this.getIcon(a.icon_Live)+'</span> <span class"workspace-live-title title="'+a.label_Live+'">'+a.label_Live_crop+"</span>"),$("<td />").text(a.label_Stage),$("<td />").empty().append(n),$("<td />").html(this.getIcon(a.language.icon)),$("<td />",{class:"text-end nowrap"}).append(s))),Tooltip.initialize('[data-bs-toggle="tooltip"]',{delay:{show:500,hide:100},trigger:"hover",container:"body"})}}buildPagination(e){if(0===e)return void this.elements.$pagination.contents().remove();if(this.paging.totalItems=e,this.paging.totalPages=Math.ceil(e/parseInt(this.settings.limit.toString(),10)),1===this.paging.totalPages)return void this.elements.$pagination.contents().remove();const t=$("<ul />",{class:"pagination"}),a=[],s=$("<li />",{class:"page-item"}).append($("<button />",{class:"page-link",type:"button","data-action":"previous"}).append($("<typo3-backend-icon />",{identifier:"actions-arrow-left-alt",size:"small"}))),n=$("<li />",{class:"page-item"}).append($("<button />",{class:"page-link",type:"button","data-action":"next"}).append($("<typo3-backend-icon />",{identifier:"actions-arrow-right-alt",size:"small"})));1===this.paging.currentPage&&s.disablePagingAction(),this.paging.currentPage===this.paging.totalPages&&n.disablePagingAction();for(let e=1;e<=this.paging.totalPages;e++){const t=$("<li />",{class:"page-item"+(this.paging.currentPage===e?" active":"")});t.append($("<button />",{class:"page-link",type:"button","data-action":"page","data-page":e}).append($("<span />").text(e))),a.push(t)}t.append(s,a,n),this.elements.$pagination.empty().append(t)}openPreview(e){const t=$(e.currentTarget).closest("tr");this.sendRemoteRequest(this.generateRemoteActionsPayload("viewSingleRecord",[t.data("table"),t.data("uid")])).then(async e=>{const t=(await e.resolve())[0].result;windowManager.localOpen(t)})}renderSelectionActionWizard(e,t){Wizard.addSlide("mass-action-confirmation",TYPO3.lang["window.selectionAction.title"],"<p>"+(new SecurityUtility).encodeHtml(TYPO3.lang["tooltip."+e+"Selected"])+"</p>",SeverityEnum.warning),Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("executeSelectionAction",{action:e,selection:t})).then(()=>{this.markedRecordsForMassAction=[],this.getWorkspaceInfos(),Wizard.dismiss(),Backend.refreshPageTree()})}).then(()=>{Wizard.show(),Wizard.getComponent().on("wizard-dismissed",()=>{this.elements.$chooseSelectionAction.val("")})})}renderMassActionWizard(e){let t;switch(e){case"publish":t="publishWorkspace";break;case"discard":t="flushWorkspace";break;default:throw"Invalid mass action "+e+" called."}const a=new SecurityUtility;Wizard.setForceSelection(!1),Wizard.addSlide("mass-action-confirmation",TYPO3.lang["window.massAction.title"],"<p>"+a.encodeHtml(TYPO3.lang["tooltip."+e+"All"])+"<br><br>"+a.encodeHtml(TYPO3.lang["tooltip.affectWholeWorkspace"])+"</p>",SeverityEnum.warning);const s=async e=>{const a=(await e.resolve())[0].result;a.processed<a.total?this.sendRemoteRequest(this.generateRemoteMassActionsPayload(t,a)).then(s):(this.getWorkspaceInfos(),Wizard.dismiss())};Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteMassActionsPayload(t,{init:!0,total:0,processed:0,language:this.settings.language})).then(s)}).then(()=>{Wizard.show(),Wizard.getComponent().on("wizard-dismissed",()=>{this.elements.$chooseMassAction.val("")})})}getAction(e,t,a){return e?$("<button />",{class:"btn btn-default","data-action":t,"data-bs-toggle":"tooltip"}).append(this.getIcon(a)):$("<span />",{class:"btn btn-default disabled"}).append(this.getIcon("empty-empty"))}getIcon(e){switch(e){case"language":e="flags-multiple";break;case"integrity":case"info":e="status-dialog-information";break;case"success":e="status-dialog-ok";break;case"warning":e="status-dialog-warning";break;case"error":e="status-dialog-error"}return'<typo3-backend-icon identifier="'+e+'" size="small"></typo3-backend-icon>'}resetMassActionState(e){this.markedRecordsForMassAction=[],e&&(this.elements.$workspaceActions.removeClass("hidden"),this.elements.$chooseMassAction.prop("disabled",!1)),document.dispatchEvent(new CustomEvent("multiRecordSelection:actions:hide"))}}$.fn.disablePagingAction=function(){$(this).addClass("disabled").find("button").prop("disabled",!0)};export default new Backend; \ No newline at end of file diff --git a/typo3/sysext/workspaces/Resources/Public/JavaScript/Preview.js b/typo3/sysext/workspaces/Resources/Public/JavaScript/Preview.js deleted file mode 100644 index 94be4e6ee99ba96660ebd76e96f57c6d63e1c4f2..0000000000000000000000000000000000000000 --- a/typo3/sysext/workspaces/Resources/Public/JavaScript/Preview.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import $ from"jquery";import Modal from"TYPO3/CMS/Backend/Modal.js";import Utility from"TYPO3/CMS/Backend/Utility.js";import Workspaces from"TYPO3/CMS/Workspaces/Workspaces.js";import ThrottleEvent from"TYPO3/CMS/Core/Event/ThrottleEvent.js";var Identifiers;!function(e){e.topbar="#typo3-topbar",e.workspacePanel=".workspace-panel",e.liveView="#live-view",e.stageSlider="#workspace-stage-slider",e.workspaceView="#workspace-view",e.sendToStageAction='[data-action="send-to-stage"]',e.discardAction='[data-action="discard"]',e.stageButtonsContainer=".t3js-stage-buttons",e.previewModeContainer=".t3js-preview-mode",e.activePreviewMode=".t3js-active-preview-mode",e.workspacePreview=".t3js-workspace-preview"}(Identifiers||(Identifiers={}));class Preview extends Workspaces{constructor(){super(),this.currentSlidePosition=100,this.elements={},this.updateSlidePosition=e=>{this.currentSlidePosition=parseInt(e.target.value,10),this.resizeViews()},this.renderDiscardWindow=()=>{const e=Modal.confirm(TYPO3.lang["window.discardAll.title"],TYPO3.lang["window.discardAll.message"],SeverityEnum.warning,[{text:TYPO3.lang.cancel,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{e.modal("hide")}},{text:TYPO3.lang.ok,btnClass:"btn-warning",name:"ok"}]);e.on("button.clicked",t=>{"ok"===t.target.name&&this.sendRemoteRequest([this.generateRemoteActionsPayload("discardStagesFromPage",[TYPO3.settings.Workspaces.id]),this.generateRemoteActionsPayload("updateStageChangeButtons",[TYPO3.settings.Workspaces.id])],"#typo3-topbar").then(async t=>{e.modal("hide"),this.renderStageButtons((await t.resolve())[1].result),this.elements.$workspaceView.attr("src",this.elements.$workspaceView.attr("src"))})})},this.renderSendPageToStageWindow=e=>{const t=e.currentTarget,i=t.dataset.direction;let s;if("prev"===i)s="sendPageToPreviousStage";else{if("next"!==i)throw"Invalid direction "+i+" requested.";s="sendPageToNextStage"}this.sendRemoteRequest(this.generateRemoteActionsPayload(s,[TYPO3.settings.Workspaces.id]),"#typo3-topbar").then(async e=>{const i=await e.resolve(),s=this.renderSendToStageWindow(i);s.on("button.clicked",e=>{if("ok"===e.target.name){const n=Utility.convertFormToObject(e.currentTarget.querySelector("form"));n.affects=i[0].result.affects,n.stageId=t.dataset.stageId,this.sendRemoteRequest([this.generateRemoteActionsPayload("sentCollectionToStage",[n]),this.generateRemoteActionsPayload("updateStageChangeButtons",[TYPO3.settings.Workspaces.id])],"#typo3-topbar").then(async e=>{s.modal("hide"),this.renderStageButtons((await e.resolve())[1].result)})}})})},this.changePreviewMode=e=>{e.preventDefault();const t=$(e.currentTarget),i=this.elements.$activePreviewMode.data("activePreviewMode"),s=t.data("previewMode");this.elements.$activePreviewMode.text(t.text()).data("activePreviewMode",s),this.elements.$workspacePreview.parent().removeClass("preview-mode-"+i).addClass("preview-mode-"+s),"slider"===s?(this.elements.$stageSlider.parent().toggle(!0),this.resizeViews()):(this.elements.$stageSlider.parent().toggle(!1),"vbox"===s?this.elements.$liveView.height("100%"):this.elements.$liveView.height("50%"))},$(()=>{this.getElements(),this.resizeViews(),this.adjustPreviewModeSelectorWidth(),this.registerEvents()})}static getAvailableSpace(){return $(window).height()-$(Identifiers.topbar).outerHeight()}getElements(){this.elements.$liveView=$(Identifiers.liveView),this.elements.$workspacePanel=$(Identifiers.workspacePanel),this.elements.$stageSlider=$(Identifiers.stageSlider),this.elements.$workspaceView=$(Identifiers.workspaceView),this.elements.$stageButtonsContainer=$(Identifiers.stageButtonsContainer),this.elements.$previewModeContainer=$(Identifiers.previewModeContainer),this.elements.$activePreviewMode=$(Identifiers.activePreviewMode),this.elements.$workspacePreview=$(Identifiers.workspacePreview)}registerEvents(){new ThrottleEvent("resize",()=>{this.resizeViews()},50).bindTo(window),$(document).on("click",Identifiers.discardAction,this.renderDiscardWindow).on("click",Identifiers.sendToStageAction,this.renderSendPageToStageWindow).on("click",".t3js-workspace-recipients-selectall",()=>{$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!0)}).on("click",".t3js-workspace-recipients-deselectall",()=>{$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!1)}),new ThrottleEvent("input",this.updateSlidePosition,25).bindTo(document.querySelector(Identifiers.stageSlider)),this.elements.$previewModeContainer.find("[data-preview-mode]").on("click",this.changePreviewMode)}renderStageButtons(e){this.elements.$stageButtonsContainer.html(e)}resizeViews(){const e=Preview.getAvailableSpace(),t=-1*(this.currentSlidePosition-100),i=Math.round(Math.abs(e*t/100)),s=this.elements.$liveView.outerHeight()-this.elements.$liveView.height();this.elements.$workspacePreview.height(e),"slider"===this.elements.$activePreviewMode.data("activePreviewMode")&&this.elements.$liveView.height(i-s)}adjustPreviewModeSelectorWidth(){const e=this.elements.$previewModeContainer.find(".dropdown-menu");let t=0;e.addClass("show"),this.elements.$previewModeContainer.find("li > a > span").each((e,i)=>{const s=$(i).width();t<s&&(t=s)}),e.removeClass("show"),this.elements.$activePreviewMode.width(t)}}export default new Preview; \ No newline at end of file diff --git a/typo3/sysext/workspaces/Resources/Public/JavaScript/Toolbar/WorkspacesMenu.js b/typo3/sysext/workspaces/Resources/Public/JavaScript/Toolbar/WorkspacesMenu.js deleted file mode 100644 index 074d0894ece900a795b0367a814b972e66a58ad9..0000000000000000000000000000000000000000 --- a/typo3/sysext/workspaces/Resources/Public/JavaScript/Toolbar/WorkspacesMenu.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import $ from"jquery";import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import ModuleMenu from"TYPO3/CMS/Backend/ModuleMenu.js";import Viewport from"TYPO3/CMS/Backend/Viewport.js";import RegularEvent from"TYPO3/CMS/Core/Event/RegularEvent.js";import{ModuleStateStorage}from"TYPO3/CMS/Backend/Storage/ModuleStateStorage.js";import Icons from"TYPO3/CMS/Backend/Icons.js";var Identifiers,Classes;!function(e){e.containerSelector="#typo3-cms-workspaces-backend-toolbaritems-workspaceselectortoolbaritem",e.activeMenuItemLinkSelector=".dropdown-menu .selected",e.menuItemIconHolderSelector=".dropdown-table-icon",e.menuItemSelector=".t3js-workspace-item",e.menuItemLinkSelector=".t3js-workspaces-switchlink",e.toolbarItemSelector=".dropdown-toggle",e.workspaceModuleLinkSelector=".t3js-workspaces-modulelink"}(Identifiers||(Identifiers={})),function(e){e.workspaceBodyClass="typo3-in-workspace",e.workspacesTitleInToolbarClass="toolbar-item-name"}(Classes||(Classes={}));class WorkspacesMenu{static refreshPageTree(){document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}static getWorkspaceState(){const e=document.querySelector([Identifiers.containerSelector,Identifiers.activeMenuItemLinkSelector,Identifiers.menuItemLinkSelector].join(" "));if(null===e)return null;const t=parseInt(e.dataset.workspaceid||"0",10);return{id:t,title:e.innerText.trim(),inWorkspace:0!==t}}static updateTopBar(e){$("."+Classes.workspacesTitleInToolbarClass,Identifiers.containerSelector).remove(),Icons.getIcon("empty-empty",Icons.sizes.small).then(e=>{$(Identifiers.containerSelector+" "+Identifiers.menuItemSelector).each((t,o)=>{const r=o.querySelector(Identifiers.menuItemIconHolderSelector);r&&(r.innerHTML=e)})}),e.inWorkspace&&e.title&&$(Identifiers.toolbarItemSelector,Identifiers.containerSelector).append($("<span>",{class:Classes.workspacesTitleInToolbarClass}).text(e.title));const t=document.querySelector([Identifiers.containerSelector,Identifiers.activeMenuItemLinkSelector,Identifiers.menuItemIconHolderSelector].join(" "));null!==t&&Icons.getIcon("actions-check",Icons.sizes.small).then(e=>{t.innerHTML=e})}static updateBackendContext(e=null){null===e&&null===(e=WorkspacesMenu.getWorkspaceState())||(e.inWorkspace?($("body").addClass(Classes.workspaceBodyClass),e.title||(e.title=TYPO3.lang["Workspaces.workspaceTitle"])):$("body").removeClass(Classes.workspaceBodyClass),WorkspacesMenu.updateTopBar(e))}constructor(){Viewport.Topbar.Toolbar.registerEvent(()=>{this.initializeEvents(),WorkspacesMenu.updateBackendContext()}),new RegularEvent("typo3:datahandler:process",e=>{const t=e.detail.payload;"sys_workspace"===t.table&&"delete"===t.action&&!1===t.hasErrors&&Viewport.Topbar.refresh()}).bindTo(document)}performWorkspaceSwitch(e,t){$(Identifiers.activeMenuItemLinkSelector,Identifiers.containerSelector).removeClass("selected"),$(Identifiers.menuItemLinkSelector+"[data-workspaceid="+e+"]",Identifiers.containerSelector)?.closest(Identifiers.menuItemSelector)?.addClass("selected"),WorkspacesMenu.updateBackendContext({id:e,title:t,inWorkspace:0!==e})}initializeEvents(){$(Identifiers.containerSelector).on("click",Identifiers.workspaceModuleLinkSelector,e=>{e.preventDefault(),ModuleMenu.App.showModule(e.currentTarget.dataset.module)}),$(Identifiers.containerSelector).on("click",Identifiers.menuItemLinkSelector,e=>{e.preventDefault(),this.switchWorkspace(parseInt(e.currentTarget.dataset.workspaceid,10))})}switchWorkspace(e){new AjaxRequest(TYPO3.settings.ajaxUrls.workspace_switch).post({workspaceId:e,pageId:ModuleStateStorage.current("web").identifier}).then(async t=>{const o=await t.resolve();o.workspaceId||(o.workspaceId=0),this.performWorkspaceSwitch(o.workspaceId,o.title||"");const r=ModuleMenu.App.getCurrentModule();if(o.pageId){let e=TYPO3.Backend.ContentContainer.getUrl();e+=(e.includes("?")?"&":"?")+"id="+o.pageId,Viewport.ContentContainer.setUrl(e)}else r.startsWith("web_")?"web_WorkspacesWorkspaces"===r?ModuleMenu.App.showModule(r,"workspace="+e):ModuleMenu.App.reloadFrames():o.pageModule&&ModuleMenu.App.showModule(o.pageModule);WorkspacesMenu.refreshPageTree(),ModuleMenu.App.refreshMenu()})}}const workspacesMenu=new WorkspacesMenu;TYPO3.WorkspacesMenu=workspacesMenu;export default workspacesMenu; \ No newline at end of file diff --git a/typo3/sysext/workspaces/Resources/Public/JavaScript/Workspaces.js b/typo3/sysext/workspaces/Resources/Public/JavaScript/Workspaces.js deleted file mode 100644 index bd8abd7bf75dd71fc106a81fc23f8e3674a59afc..0000000000000000000000000000000000000000 --- a/typo3/sysext/workspaces/Resources/Public/JavaScript/Workspaces.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import AjaxRequest from"TYPO3/CMS/Core/Ajax/AjaxRequest.js";import{SeverityEnum}from"TYPO3/CMS/Backend/Enum/Severity.js";import $ from"jquery";import NProgress from"nprogress";import Modal from"TYPO3/CMS/Backend/Modal.js";export default class Workspaces{constructor(){this.tid=0}renderSendToStageWindow(e){const t=e[0].result,a=$("<form />");if(void 0!==t.sendMailTo&&t.sendMailTo.length>0){a.append($("<label />",{class:"control-label"}).text(TYPO3.lang["window.sendToNextStageWindow.itemsWillBeSentTo"])),a.append($("<div />",{class:"form-group"}).append($('<button type="button" class="btn btn-default btn-xs t3js-workspace-recipients-selectall" />').text(TYPO3.lang["window.sendToNextStageWindow.selectAll"])," ",$('<button type="button" class="btn btn-default btn-xs t3js-workspace-recipients-deselectall" />').text(TYPO3.lang["window.sendToNextStageWindow.deselectAll"])));for(const e of t.sendMailTo)a.append($("<div />",{class:"form-check"}).append($("<input />",{type:"checkbox",name:"recipients",class:"form-check-input t3js-workspace-recipient",id:e.name,value:e.value}).prop("checked",e.checked).prop("disabled",e.disabled),$("<label />",{class:"form-check-label",for:e.name}).text(e.label)))}void 0!==t.additional&&a.append($("<div />",{class:"form-group"}).append($("<label />",{class:"control-label",for:"additional"}).text(TYPO3.lang["window.sendToNextStageWindow.additionalRecipients"]),$("<textarea />",{class:"form-control",name:"additional",id:"additional"}).text(t.additional.value),$("<span />",{class:"help-block"}).text(TYPO3.lang["window.sendToNextStageWindow.additionalRecipients.hint"]))),a.append($("<div />",{class:"form-group"}).append($("<label />",{class:"control-label",for:"comments"}).text(TYPO3.lang["window.sendToNextStageWindow.comments"]),$("<textarea />",{class:"form-control",name:"comments",id:"comments"}).text(t.comments.value)));const o=Modal.show(TYPO3.lang.actionSendToStage,a,SeverityEnum.info,[{text:TYPO3.lang.cancel,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{o.modal("hide")}},{text:TYPO3.lang.ok,btnClass:"btn-info",name:"ok"}]);return o}sendRemoteRequest(e,t="#workspace-content-wrapper"){return NProgress.configure({parent:t,showSpinner:!1}),NProgress.start(),new AjaxRequest(TYPO3.settings.ajaxUrls.workspace_dispatch).post(e,{headers:{"Content-Type":"application/json; charset=utf-8"}}).finally(()=>NProgress.done())}generateRemotePayload(e,t={}){return this.generateRemotePayloadBody("RemoteServer",e,t)}generateRemoteMassActionsPayload(e,t={}){return this.generateRemotePayloadBody("MassActions",e,t)}generateRemoteActionsPayload(e,t={}){return this.generateRemotePayloadBody("Actions",e,t)}generateRemotePayloadBody(e,t,a){return a instanceof Array?a.push(TYPO3.settings.Workspaces.token):a=[a,TYPO3.settings.Workspaces.token],{action:e,data:a,method:t,type:"rpc",tid:this.tid++}}} \ No newline at end of file diff --git a/typo3/sysext/workspaces/Resources/Public/JavaScript/backend.js b/typo3/sysext/workspaces/Resources/Public/JavaScript/backend.js new file mode 100644 index 0000000000000000000000000000000000000000..7535d4509f43c128eb155fef968a10aa2c219a14 --- /dev/null +++ b/typo3/sysext/workspaces/Resources/Public/JavaScript/backend.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import"@typo3/backend/element/icon-element.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import"@typo3/backend/input/clearable.js";import Workspaces from"@typo3/workspaces/workspaces.js";import Modal from"@typo3/backend/modal.js";import Persistent from"@typo3/backend/storage/persistent.js";import Tooltip from"@typo3/backend/tooltip.js";import Utility from"@typo3/backend/utility.js";import Wizard from"@typo3/backend/wizard.js";import SecurityUtility from"@typo3/core/security-utility.js";import windowManager from"@typo3/backend/window-manager.js";import RegularEvent from"@typo3/core/event/regular-event.js";var Identifiers;!function(e){e.searchForm="#workspace-settings-form",e.searchTextField='#workspace-settings-form input[name="search-text"]',e.searchSubmitBtn='#workspace-settings-form button[type="submit"]',e.depthSelector='#workspace-settings-form [name="depth"]',e.languageSelector='#workspace-settings-form select[name="languages"]',e.stagesSelector='#workspace-settings-form select[name="stages"]',e.workspaceActions=".workspace-actions",e.chooseStageAction='.workspace-actions [name="stage-action"]',e.chooseSelectionAction='.workspace-actions [name="selection-action"]',e.chooseMassAction='.workspace-actions [name="mass-action"]',e.container="#workspace-panel",e.contentsContainer="#workspace-contents",e.noContentsContainer="#workspace-contents-empty",e.previewLinksButton=".t3js-preview-link",e.pagination="#workspace-pagination"}(Identifiers||(Identifiers={}));class Backend extends Workspaces{constructor(){super(),this.elements={},this.settings={dir:"ASC",id:TYPO3.settings.Workspaces.id,depth:1,language:"all",limit:30,query:"",sort:"label_Live",start:0,filterTxt:""},this.paging={currentPage:1,totalPages:1,totalItems:0},this.latestPath="",this.markedRecordsForMassAction=[],this.indentationPadding=26,this.handleCheckboxStateChanged=e=>{const t=$(e.target),a=t.parents("tr"),s=t.prop("checked"),n=a.data("table")+":"+a.data("uid")+":"+a.data("t3ver_oid");if(s)this.markedRecordsForMassAction.push(n);else{const e=this.markedRecordsForMassAction.indexOf(n);e>-1&&this.markedRecordsForMassAction.splice(e,1)}a.data("collectionCurrent")?Backend.changeCollectionChildrenState(a.data("collectionCurrent"),s):a.data("collection")&&(Backend.changeCollectionChildrenState(a.data("collection"),s),Backend.changeCollectionParentState(a.data("collection"),s)),this.elements.$chooseMassAction.prop("disabled",this.markedRecordsForMassAction.length>0)},this.viewChanges=e=>{e.preventDefault();const t=$(e.currentTarget).closest("tr");this.sendRemoteRequest(this.generateRemotePayload("getRowDetails",{stage:t.data("stage"),t3ver_oid:t.data("t3ver_oid"),table:t.data("table"),uid:t.data("uid"),filterFields:!0})).then(async e=>{const a=(await e.resolve())[0].result.data[0],s=$("<div />"),n=$("<ul />",{class:"nav nav-tabs",role:"tablist"}),i=$("<div />",{class:"tab-content"}),o=[];s.append($("<p />").html(TYPO3.lang.path.replace("{0}",a.path_Live)),$("<p />").html(TYPO3.lang.current_step.replace("{0}",a.label_Stage).replace("{1}",a.stage_position).replace("{2}",a.stage_count))),a.diff.length>0&&(n.append($("<li />",{role:"presentation",class:"nav-item"}).append($("<a />",{class:"nav-link",href:"#workspace-changes","aria-controls":"workspace-changes",role:"tab","data-bs-toggle":"tab"}).text(TYPO3.lang["window.recordChanges.tabs.changeSummary"]))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-changes"}).append($("<div />",{class:"form-section"}).append(Backend.generateDiffView(a.diff))))),a.comments.length>0&&(n.append($("<li />",{role:"presentation",class:"nav-item"}).append($("<a />",{class:"nav-link",href:"#workspace-comments","aria-controls":"workspace-comments",role:"tab","data-bs-toggle":"tab"}).html(TYPO3.lang["window.recordChanges.tabs.comments"]+" ").append($("<span />",{class:"badge"}).text(a.comments.length)))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-comments"}).append($("<div />",{class:"form-section"}).append(Backend.generateCommentView(a.comments))))),a.history.total>0&&(n.append($("<li />",{role:"presentation",class:"nav-item"}).append($("<a />",{class:"nav-link",href:"#workspace-history","aria-controls":"workspace-history",role:"tab","data-bs-toggle":"tab"}).text(TYPO3.lang["window.recordChanges.tabs.history"]))),i.append($("<div />",{role:"tabpanel",class:"tab-pane",id:"workspace-history"}).append($("<div />",{class:"form-section"}).append(Backend.generateHistoryView(a.history.data))))),n.find("li > a").first().addClass("active"),i.find(".tab-pane").first().addClass("active"),s.append($("<div />").append(n,i)),!1!==a.label_PrevStage&&t.data("stage")!==t.data("prevStage")&&o.push({text:a.label_PrevStage.title,active:!0,btnClass:"btn-default",name:"prevstage",trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.sendToStage(t,"prev")}}),!1!==a.label_NextStage&&o.push({text:a.label_NextStage.title,active:!0,btnClass:"btn-default",name:"nextstage",trigger:()=>{Modal.currentModal.trigger("modal-dismiss"),this.sendToStage(t,"next")}}),o.push({text:TYPO3.lang.close,active:!0,btnClass:"btn-info",name:"cancel",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}}),Modal.advanced({type:Modal.types.default,title:TYPO3.lang["window.recordInformation"].replace("{0}",t.find(".t3js-title-live").text().trim()),content:s,severity:SeverityEnum.info,buttons:o,size:Modal.sizes.medium})})},this.confirmDeleteRecordFromWorkspace=e=>{const t=$(e.target).closest("tr"),a=Modal.confirm(TYPO3.lang["window.discard.title"],TYPO3.lang["window.discard.message"],SeverityEnum.warning,[{text:TYPO3.lang.cancel,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{a.modal("hide")}},{text:TYPO3.lang.ok,btnClass:"btn-warning",name:"ok"}]);a.on("button.clicked",e=>{"ok"===e.target.name&&this.sendRemoteRequest([this.generateRemoteActionsPayload("deleteSingleRecord",[t.data("table"),t.data("uid")])]).then(()=>{a.modal("hide"),this.getWorkspaceInfos(),Backend.refreshPageTree()})})},this.runSelectionAction=e=>{const t=$(e.currentTarget).val(),a="discard"!==t;if(0===t.length)return;const s=[];for(let e=0;e<this.markedRecordsForMassAction.length;++e){const t=this.markedRecordsForMassAction[e].split(":");s.push({table:t[0],liveId:t[2],versionId:t[1]})}a?this.checkIntegrity({selection:s,type:"selection"}).then(async e=>{Wizard.setForceSelection(!1),"warning"===(await e.resolve())[0].result.result&&this.addIntegrityCheckWarningToWizard(),this.renderSelectionActionWizard(t,s)}):(Wizard.setForceSelection(!1),this.renderSelectionActionWizard(t,s))},this.addIntegrityCheckWarningToWizard=()=>{Wizard.addSlide("integrity-warning","Warning",TYPO3.lang["integrity.hasIssuesDescription"]+"<br>"+TYPO3.lang["integrity.hasIssuesQuestion"],SeverityEnum.warning)},this.runMassAction=e=>{const t=$(e.currentTarget).val(),a="discard"!==t;0!==t.length&&(a?this.checkIntegrity({language:this.settings.language,type:t}).then(async e=>{Wizard.setForceSelection(!1),"warning"===(await e.resolve())[0].result.result&&this.addIntegrityCheckWarningToWizard(),this.renderMassActionWizard(t)}):(Wizard.setForceSelection(!1),this.renderMassActionWizard(t)))},this.sendToSpecificStageAction=e=>{const t=[],a=$(e.currentTarget).val();for(let e=0;e<this.markedRecordsForMassAction.length;++e){const a=this.markedRecordsForMassAction[e].split(":");t.push({table:a[0],uid:a[1],t3ver_oid:a[2]})}this.sendRemoteRequest(this.generateRemoteActionsPayload("sendToSpecificStageWindow",[a,t])).then(async e=>{const s=this.renderSendToStageWindow(await e.resolve());s.on("button.clicked",e=>{if("ok"===e.target.name){const n=Utility.convertFormToObject(e.currentTarget.querySelector("form"));n.affects={elements:t,nextStage:a},this.sendRemoteRequest([this.generateRemoteActionsPayload("sendToSpecificStageExecute",[n]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).then(async e=>{const t=await e.resolve();s.modal("hide"),this.renderWorkspaceInfos(t[1].result),Backend.refreshPageTree()})}}).on("modal-destroyed",()=>{this.elements.$chooseStageAction.val("")})})},this.generatePreviewLinks=()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("generateWorkspacePreviewLinksForAllLanguages",[this.settings.id])).then(async e=>{const t=(await e.resolve())[0].result,a=$("<dl />");$.each(t,(e,t)=>{a.append($("<dt />").text(e),$("<dd />").append($("<a />",{href:t,target:"_blank"}).text(t)))}),Modal.show(TYPO3.lang.previewLink,a,SeverityEnum.info,[{text:TYPO3.lang.ok,active:!0,btnClass:"btn-info",name:"ok",trigger:()=>{Modal.currentModal.trigger("modal-dismiss")}}],["modal-inner-scroll"])})},$(()=>{this.getElements(),this.registerEvents(),this.notifyWorkspaceSwitchAction(),this.settings.depth=this.elements.$depthSelector.val(),this.settings.language=this.elements.$languageSelector.val(),this.settings.stage=this.elements.$stagesSelector.val(),this.elements.$container.length&&this.getWorkspaceInfos()})}static refreshPageTree(){top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}static generateDiffView(e){const t=$("<div />",{class:"diff"});for(let a of e)t.append($("<div />",{class:"diff-item"}).append($("<div />",{class:"diff-item-title"}).text(a.label),$("<div />",{class:"diff-item-result diff-item-result-inline"}).html(a.content)));return t}static generateCommentView(e){const t=$("<div />");for(let a of e){const e=$("<div />",{class:"panel panel-default"});a.user_comment.length>0&&e.append($("<div />",{class:"panel-body"}).html(a.user_comment)),e.append($("<div />",{class:"panel-footer"}).append($("<span />",{class:"label label-success"}).text(a.stage_title),$("<span />",{class:"label label-info"}).text(a.tstamp))),t.append($("<div />",{class:"media"}).append($("<div />",{class:"media-left text-center"}).text(a.user_username).prepend($("<div />").html(a.user_avatar)),$("<div />",{class:"media-body"}).append(e)))}return t}static generateHistoryView(e){const t=$("<div />");for(let a of e){const e=$("<div />",{class:"panel panel-default"});let s;if("object"==typeof a.differences){if(0===a.differences.length)continue;s=$("<div />",{class:"diff"});for(let e=0;e<a.differences.length;++e)s.append($("<div />",{class:"diff-item"}).append($("<div />",{class:"diff-item-title"}).text(a.differences[e].label),$("<div />",{class:"diff-item-result diff-item-result-inline"}).html(a.differences[e].html)));e.append($("<div />").append(s))}else e.append($("<div />",{class:"panel-body"}).text(a.differences));e.append($("<div />",{class:"panel-footer"}).append($("<span />",{class:"label label-info"}).text(a.datetime))),t.append($("<div />",{class:"media"}).append($("<div />",{class:"media-left text-center"}).text(a.user).prepend($("<div />").html(a.user_avatar)),$("<div />",{class:"media-body"}).append(e)))}return t}static changeCollectionParentState(e,t){const a=document.querySelector('tr[data-collection-current="'+e+'"] input[type=checkbox]');null!==a&&a.checked!==t&&(a.checked=t,a.dataset.manuallyChanged="true",a.dispatchEvent(new CustomEvent("multiRecordSelection:checkbox:state:changed",{bubbles:!0,cancelable:!1})))}static changeCollectionChildrenState(e,t){const a=document.querySelectorAll('tr[data-collection="'+e+'"] input[type=checkbox]');a.length&&a.forEach(e=>{e.checked!==t&&(e.checked=t,e.dataset.manuallyChanged="true",e.dispatchEvent(new CustomEvent("multiRecordSelection:checkbox:state:changed",{bubbles:!0,cancelable:!1})))})}notifyWorkspaceSwitchAction(){const e=document.querySelector("main[data-workspace-switch-action]");if(e.dataset.workspaceSwitchAction){const t=JSON.parse(e.dataset.workspaceSwitchAction);top.TYPO3.WorkspacesMenu.performWorkspaceSwitch(t.id,t.title),top.document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh")),top.TYPO3.ModuleMenu.App.refreshMenu()}}checkIntegrity(e){return this.sendRemoteRequest(this.generateRemotePayload("checkIntegrity",e))}getElements(){this.elements.$searchForm=$(Identifiers.searchForm),this.elements.$searchTextField=$(Identifiers.searchTextField),this.elements.$searchSubmitBtn=$(Identifiers.searchSubmitBtn),this.elements.$depthSelector=$(Identifiers.depthSelector),this.elements.$languageSelector=$(Identifiers.languageSelector),this.elements.$stagesSelector=$(Identifiers.stagesSelector),this.elements.$container=$(Identifiers.container),this.elements.$contentsContainer=$(Identifiers.contentsContainer),this.elements.$noContentsContainer=$(Identifiers.noContentsContainer),this.elements.$tableBody=this.elements.$contentsContainer.find("tbody"),this.elements.$workspaceActions=$(Identifiers.workspaceActions),this.elements.$chooseStageAction=$(Identifiers.chooseStageAction),this.elements.$chooseSelectionAction=$(Identifiers.chooseSelectionAction),this.elements.$chooseMassAction=$(Identifiers.chooseMassAction),this.elements.$previewLinksButton=$(Identifiers.previewLinksButton),this.elements.$pagination=$(Identifiers.pagination)}registerEvents(){$(document).on("click",'[data-action="publish"]',e=>{const t=e.target.closest("tr");this.checkIntegrity({selection:[{liveId:t.dataset.uid,versionId:t.dataset.t3ver_oid,table:t.dataset.table}],type:"selection"}).then(async e=>{"warning"===(await e.resolve())[0].result.result&&this.addIntegrityCheckWarningToWizard(),Wizard.setForceSelection(!1),Wizard.addSlide("publish-confirm","Publish",TYPO3.lang["window.publish.message"],SeverityEnum.info),Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("publishSingleRecord",[t.dataset.table,t.dataset.t3ver_oid,t.dataset.uid])).then(()=>{Wizard.dismiss(),this.getWorkspaceInfos(),Backend.refreshPageTree()})}).then(()=>{Wizard.show()})})}).on("click",'[data-action="prevstage"]',e=>{this.sendToStage($(e.currentTarget).closest("tr"),"prev")}).on("click",'[data-action="nextstage"]',e=>{this.sendToStage($(e.currentTarget).closest("tr"),"next")}).on("click",'[data-action="changes"]',this.viewChanges).on("click",'[data-action="preview"]',this.openPreview.bind(this)).on("click",'[data-action="open"]',e=>{const t=e.currentTarget.closest("tr");let a=TYPO3.settings.FormEngine.moduleUrl+"&returnUrl="+encodeURIComponent(document.location.href)+"&id="+TYPO3.settings.Workspaces.id+"&edit["+t.dataset.table+"]["+t.dataset.uid+"]=edit";window.location.href=a}).on("click",'[data-action="version"]',e=>{const t=e.currentTarget.closest("tr"),a="pages"===t.dataset.table?t.dataset.t3ver_oid:t.dataset.pid;window.location.href=TYPO3.settings.WebLayout.moduleUrl+"&id="+a}).on("click",'[data-action="remove"]',this.confirmDeleteRecordFromWorkspace).on("click",'[data-action="expand"]',e=>{const t=$(e.currentTarget);let a;a="true"===t.first().attr("aria-expanded")?"apps-pagetree-expand":"apps-pagetree-collapse",t.empty().append(this.getIcon(a))}),$(window.top.document).on("click",".t3js-workspace-recipients-selectall",()=>{$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!0)}).on("click",".t3js-workspace-recipients-deselectall",()=>{$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!1)}),this.elements.$searchForm.on("submit",e=>{e.preventDefault(),this.settings.filterTxt=this.elements.$searchTextField.val(),this.getWorkspaceInfos()}),this.elements.$searchTextField.on("keyup",e=>{""!==e.target.value?this.elements.$searchSubmitBtn.removeClass("disabled"):(this.elements.$searchSubmitBtn.addClass("disabled"),this.getWorkspaceInfos())});const e=this.elements.$searchTextField.get(0);void 0!==e&&e.clearable({onClear:()=>{this.elements.$searchSubmitBtn.addClass("disabled"),this.settings.filterTxt="",this.getWorkspaceInfos()}}),new RegularEvent("multiRecordSelection:checkbox:state:changed",this.handleCheckboxStateChanged).bindTo(document),this.elements.$depthSelector.on("change",e=>{const t=e.target.value;Persistent.set("moduleData.workspaces.settings.depth",t),this.settings.depth=t,this.getWorkspaceInfos()}),this.elements.$previewLinksButton.on("click",this.generatePreviewLinks),this.elements.$languageSelector.on("change",e=>{const t=$(e.target);Persistent.set("moduleData.workspaces.settings.language",t.val()),this.settings.language=t.val(),this.sendRemoteRequest(this.generateRemotePayload("getWorkspaceInfos",this.settings)).then(async e=>{const a=await e.resolve();this.elements.$languageSelector.prev().html(t.find(":selected").data("icon")),this.renderWorkspaceInfos(a[0].result)})}),this.elements.$stagesSelector.on("change",e=>{const t=e.target.value;Persistent.set("moduleData.workspaces.settings.stage",t),this.settings.stage=t,this.getWorkspaceInfos()}),this.elements.$chooseStageAction.on("change",this.sendToSpecificStageAction),this.elements.$chooseSelectionAction.on("change",this.runSelectionAction),this.elements.$chooseMassAction.on("change",this.runMassAction),this.elements.$pagination.on("click","[data-action]",e=>{e.preventDefault();const t=$(e.currentTarget);let a=!1;switch(t.data("action")){case"previous":this.paging.currentPage>1&&(this.paging.currentPage--,a=!0);break;case"next":this.paging.currentPage<this.paging.totalPages&&(this.paging.currentPage++,a=!0);break;case"page":this.paging.currentPage=parseInt(t.data("page"),10),a=!0;break;default:throw'Unknown action "'+t.data("action")+'"'}a&&(this.settings.start=parseInt(this.settings.limit.toString(),10)*(this.paging.currentPage-1),this.getWorkspaceInfos())})}sendToStage(e,t){let a,s,n;if("next"===t)a=e.data("nextStage"),s="sendToNextStageWindow",n="sendToNextStageExecute";else{if("prev"!==t)throw"Invalid direction given.";a=e.data("prevStage"),s="sendToPrevStageWindow",n="sendToPrevStageExecute"}this.sendRemoteRequest(this.generateRemoteActionsPayload(s,[e.data("uid"),e.data("table"),e.data("t3ver_oid")])).then(async t=>{const s=this.renderSendToStageWindow(await t.resolve());s.on("button.clicked",t=>{if("ok"===t.target.name){const i=Utility.convertFormToObject(t.currentTarget.querySelector("form"));i.affects={table:e.data("table"),nextStage:a,t3ver_oid:e.data("t3ver_oid"),uid:e.data("uid"),elements:[]},this.sendRemoteRequest([this.generateRemoteActionsPayload(n,[i]),this.generateRemotePayload("getWorkspaceInfos",this.settings)]).then(async e=>{const t=await e.resolve();s.modal("hide"),this.renderWorkspaceInfos(t[1].result),Backend.refreshPageTree()})}})})}getWorkspaceInfos(){this.sendRemoteRequest(this.generateRemotePayload("getWorkspaceInfos",this.settings)).then(async e=>{this.renderWorkspaceInfos((await e.resolve())[0].result)})}renderWorkspaceInfos(e){this.elements.$tableBody.children().remove(),this.resetMassActionState(e.data.length),this.buildPagination(e.total),0===e.total?(this.elements.$contentsContainer.hide(),this.elements.$noContentsContainer.show()):(this.elements.$contentsContainer.show(),this.elements.$noContentsContainer.hide());for(let t=0;t<e.data.length;++t){const a=e.data[t],s=$("<div />",{class:"btn-group"});let n,i=a.Workspaces_CollectionChildren>0&&""!==a.Workspaces_CollectionCurrent;s.append(this.getAction(i,"expand",a.expanded?"apps-pagetree-expand":"apps-pagetree-collapse").attr("title",TYPO3.lang["tooltip.expand"]).attr("data-bs-target",'[data-collection="'+a.Workspaces_CollectionCurrent+'"]').attr("aria-expanded",!i||a.expanded?"true":"false").attr("data-bs-toggle","collapse"),this.getAction(a.hasChanges,"changes","actions-document-info").attr("title",TYPO3.lang["tooltip.showChanges"]),this.getAction(a.allowedAction_publish&&""===a.Workspaces_CollectionParent,"publish","actions-version-swap-version").attr("title",TYPO3.lang["tooltip.publish"]),this.getAction(a.allowedAction_view,"preview","actions-version-workspace-preview").attr("title",TYPO3.lang["tooltip.viewElementAction"]),this.getAction(a.allowedAction_edit,"open","actions-open").attr("title",TYPO3.lang["tooltip.editElementAction"]),this.getAction(a.allowedAction_versionPageOpen,"version","actions-version-page-open").attr("title",TYPO3.lang["tooltip.openPage"]),this.getAction(a.allowedAction_delete,"remove","actions-version-document-remove").attr("title",TYPO3.lang["tooltip.discardVersion"])),""!==a.integrity.messages&&(n=$("<span>"+this.getIcon(a.integrity.status)+"</span>"),n.attr("data-bs-toggle","tooltip").attr("data-bs-placement","top").attr("data-bs-html","true").attr("title",a.integrity.messages)),this.latestPath!==a.path_Workspace&&(this.latestPath=a.path_Workspace,this.elements.$tableBody.append($("<tr />").append($("<th />"),$("<th />",{colspan:6}).html('<span title="'+a.path_Workspace+'">'+a.path_Workspace_crop+"</span>"))));const o=$("<span />",{class:"form-check form-toggle"}).append($("<input />",{type:"checkbox",class:"form-check-input t3js-multi-record-selection-check"})),r={"data-uid":a.uid,"data-pid":a.livepid,"data-t3ver_oid":a.t3ver_oid,"data-t3ver_wsid":a.t3ver_wsid,"data-table":a.table,"data-next-stage":a.value_nextStage,"data-prev-stage":a.value_prevStage,"data-stage":a.stage};if(""!==a.Workspaces_CollectionParent){let t=e.data.find(e=>e.Workspaces_CollectionCurrent===a.Workspaces_CollectionParent);r["data-collection"]=a.Workspaces_CollectionParent,r.class="collapse"+(t.expanded?" show":"")}else""!==a.Workspaces_CollectionCurrent&&(r["data-collection-current"]=a.Workspaces_CollectionCurrent);this.elements.$tableBody.append($("<tr />",r).append($("<td />").empty().append(o),$("<td />",{class:"t3js-title-workspace",style:a.Workspaces_CollectionLevel>0?"padding-left: "+this.indentationPadding*a.Workspaces_CollectionLevel+"px":""}).html('<span class="icon icon-size-small">'+this.getIcon(a.icon_Workspace)+'</span> <a href="#" data-action="changes"><span class="workspace-state-'+a.state_Workspace+'" title="'+a.label_Workspace+'">'+a.label_Workspace_crop+"</span></a>"),$("<td />",{class:"t3js-title-live"}).html('<span class="icon icon-size-small">'+this.getIcon(a.icon_Live)+'</span> <span class"workspace-live-title title="'+a.label_Live+'">'+a.label_Live_crop+"</span>"),$("<td />").text(a.label_Stage),$("<td />").empty().append(n),$("<td />").html(this.getIcon(a.language.icon)),$("<td />",{class:"text-end nowrap"}).append(s))),Tooltip.initialize('[data-bs-toggle="tooltip"]',{delay:{show:500,hide:100},trigger:"hover",container:"body"})}}buildPagination(e){if(0===e)return void this.elements.$pagination.contents().remove();if(this.paging.totalItems=e,this.paging.totalPages=Math.ceil(e/parseInt(this.settings.limit.toString(),10)),1===this.paging.totalPages)return void this.elements.$pagination.contents().remove();const t=$("<ul />",{class:"pagination"}),a=[],s=$("<li />",{class:"page-item"}).append($("<button />",{class:"page-link",type:"button","data-action":"previous"}).append($("<typo3-backend-icon />",{identifier:"actions-arrow-left-alt",size:"small"}))),n=$("<li />",{class:"page-item"}).append($("<button />",{class:"page-link",type:"button","data-action":"next"}).append($("<typo3-backend-icon />",{identifier:"actions-arrow-right-alt",size:"small"})));1===this.paging.currentPage&&s.disablePagingAction(),this.paging.currentPage===this.paging.totalPages&&n.disablePagingAction();for(let e=1;e<=this.paging.totalPages;e++){const t=$("<li />",{class:"page-item"+(this.paging.currentPage===e?" active":"")});t.append($("<button />",{class:"page-link",type:"button","data-action":"page","data-page":e}).append($("<span />").text(e))),a.push(t)}t.append(s,a,n),this.elements.$pagination.empty().append(t)}openPreview(e){const t=$(e.currentTarget).closest("tr");this.sendRemoteRequest(this.generateRemoteActionsPayload("viewSingleRecord",[t.data("table"),t.data("uid")])).then(async e=>{const t=(await e.resolve())[0].result;windowManager.localOpen(t)})}renderSelectionActionWizard(e,t){Wizard.addSlide("mass-action-confirmation",TYPO3.lang["window.selectionAction.title"],"<p>"+(new SecurityUtility).encodeHtml(TYPO3.lang["tooltip."+e+"Selected"])+"</p>",SeverityEnum.warning),Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteActionsPayload("executeSelectionAction",{action:e,selection:t})).then(()=>{this.markedRecordsForMassAction=[],this.getWorkspaceInfos(),Wizard.dismiss(),Backend.refreshPageTree()})}).then(()=>{Wizard.show(),Wizard.getComponent().on("wizard-dismissed",()=>{this.elements.$chooseSelectionAction.val("")})})}renderMassActionWizard(e){let t;switch(e){case"publish":t="publishWorkspace";break;case"discard":t="flushWorkspace";break;default:throw"Invalid mass action "+e+" called."}const a=new SecurityUtility;Wizard.setForceSelection(!1),Wizard.addSlide("mass-action-confirmation",TYPO3.lang["window.massAction.title"],"<p>"+a.encodeHtml(TYPO3.lang["tooltip."+e+"All"])+"<br><br>"+a.encodeHtml(TYPO3.lang["tooltip.affectWholeWorkspace"])+"</p>",SeverityEnum.warning);const s=async e=>{const a=(await e.resolve())[0].result;a.processed<a.total?this.sendRemoteRequest(this.generateRemoteMassActionsPayload(t,a)).then(s):(this.getWorkspaceInfos(),Wizard.dismiss())};Wizard.addFinalProcessingSlide(()=>{this.sendRemoteRequest(this.generateRemoteMassActionsPayload(t,{init:!0,total:0,processed:0,language:this.settings.language})).then(s)}).then(()=>{Wizard.show(),Wizard.getComponent().on("wizard-dismissed",()=>{this.elements.$chooseMassAction.val("")})})}getAction(e,t,a){return e?$("<button />",{class:"btn btn-default","data-action":t,"data-bs-toggle":"tooltip"}).append(this.getIcon(a)):$("<span />",{class:"btn btn-default disabled"}).append(this.getIcon("empty-empty"))}getIcon(e){switch(e){case"language":e="flags-multiple";break;case"integrity":case"info":e="status-dialog-information";break;case"success":e="status-dialog-ok";break;case"warning":e="status-dialog-warning";break;case"error":e="status-dialog-error"}return'<typo3-backend-icon identifier="'+e+'" size="small"></typo3-backend-icon>'}resetMassActionState(e){this.markedRecordsForMassAction=[],e&&(this.elements.$workspaceActions.removeClass("hidden"),this.elements.$chooseMassAction.prop("disabled",!1)),document.dispatchEvent(new CustomEvent("multiRecordSelection:actions:hide"))}}$.fn.disablePagingAction=function(){$(this).addClass("disabled").find("button").prop("disabled",!0)};export default new Backend; \ No newline at end of file diff --git a/typo3/sysext/workspaces/Resources/Public/JavaScript/preview.js b/typo3/sysext/workspaces/Resources/Public/JavaScript/preview.js new file mode 100644 index 0000000000000000000000000000000000000000..7371d2b6278f86569195bbed24db048b0c07d8db --- /dev/null +++ b/typo3/sysext/workspaces/Resources/Public/JavaScript/preview.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import{SeverityEnum}from"@typo3/backend/enum/severity.js";import $ from"jquery";import Modal from"@typo3/backend/modal.js";import Utility from"@typo3/backend/utility.js";import Workspaces from"@typo3/workspaces/workspaces.js";import ThrottleEvent from"@typo3/core/event/throttle-event.js";var Identifiers;!function(e){e.topbar="#typo3-topbar",e.workspacePanel=".workspace-panel",e.liveView="#live-view",e.stageSlider="#workspace-stage-slider",e.workspaceView="#workspace-view",e.sendToStageAction='[data-action="send-to-stage"]',e.discardAction='[data-action="discard"]',e.stageButtonsContainer=".t3js-stage-buttons",e.previewModeContainer=".t3js-preview-mode",e.activePreviewMode=".t3js-active-preview-mode",e.workspacePreview=".t3js-workspace-preview"}(Identifiers||(Identifiers={}));class Preview extends Workspaces{constructor(){super(),this.currentSlidePosition=100,this.elements={},this.updateSlidePosition=e=>{this.currentSlidePosition=parseInt(e.target.value,10),this.resizeViews()},this.renderDiscardWindow=()=>{const e=Modal.confirm(TYPO3.lang["window.discardAll.title"],TYPO3.lang["window.discardAll.message"],SeverityEnum.warning,[{text:TYPO3.lang.cancel,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{e.modal("hide")}},{text:TYPO3.lang.ok,btnClass:"btn-warning",name:"ok"}]);e.on("button.clicked",t=>{"ok"===t.target.name&&this.sendRemoteRequest([this.generateRemoteActionsPayload("discardStagesFromPage",[TYPO3.settings.Workspaces.id]),this.generateRemoteActionsPayload("updateStageChangeButtons",[TYPO3.settings.Workspaces.id])],"#typo3-topbar").then(async t=>{e.modal("hide"),this.renderStageButtons((await t.resolve())[1].result),this.elements.$workspaceView.attr("src",this.elements.$workspaceView.attr("src"))})})},this.renderSendPageToStageWindow=e=>{const t=e.currentTarget,i=t.dataset.direction;let s;if("prev"===i)s="sendPageToPreviousStage";else{if("next"!==i)throw"Invalid direction "+i+" requested.";s="sendPageToNextStage"}this.sendRemoteRequest(this.generateRemoteActionsPayload(s,[TYPO3.settings.Workspaces.id]),"#typo3-topbar").then(async e=>{const i=await e.resolve(),s=this.renderSendToStageWindow(i);s.on("button.clicked",e=>{if("ok"===e.target.name){const n=Utility.convertFormToObject(e.currentTarget.querySelector("form"));n.affects=i[0].result.affects,n.stageId=t.dataset.stageId,this.sendRemoteRequest([this.generateRemoteActionsPayload("sentCollectionToStage",[n]),this.generateRemoteActionsPayload("updateStageChangeButtons",[TYPO3.settings.Workspaces.id])],"#typo3-topbar").then(async e=>{s.modal("hide"),this.renderStageButtons((await e.resolve())[1].result)})}})})},this.changePreviewMode=e=>{e.preventDefault();const t=$(e.currentTarget),i=this.elements.$activePreviewMode.data("activePreviewMode"),s=t.data("previewMode");this.elements.$activePreviewMode.text(t.text()).data("activePreviewMode",s),this.elements.$workspacePreview.parent().removeClass("preview-mode-"+i).addClass("preview-mode-"+s),"slider"===s?(this.elements.$stageSlider.parent().toggle(!0),this.resizeViews()):(this.elements.$stageSlider.parent().toggle(!1),"vbox"===s?this.elements.$liveView.height("100%"):this.elements.$liveView.height("50%"))},$(()=>{this.getElements(),this.resizeViews(),this.adjustPreviewModeSelectorWidth(),this.registerEvents()})}static getAvailableSpace(){return $(window).height()-$(Identifiers.topbar).outerHeight()}getElements(){this.elements.$liveView=$(Identifiers.liveView),this.elements.$workspacePanel=$(Identifiers.workspacePanel),this.elements.$stageSlider=$(Identifiers.stageSlider),this.elements.$workspaceView=$(Identifiers.workspaceView),this.elements.$stageButtonsContainer=$(Identifiers.stageButtonsContainer),this.elements.$previewModeContainer=$(Identifiers.previewModeContainer),this.elements.$activePreviewMode=$(Identifiers.activePreviewMode),this.elements.$workspacePreview=$(Identifiers.workspacePreview)}registerEvents(){new ThrottleEvent("resize",()=>{this.resizeViews()},50).bindTo(window),$(document).on("click",Identifiers.discardAction,this.renderDiscardWindow).on("click",Identifiers.sendToStageAction,this.renderSendPageToStageWindow).on("click",".t3js-workspace-recipients-selectall",()=>{$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!0)}).on("click",".t3js-workspace-recipients-deselectall",()=>{$(".t3js-workspace-recipient",window.top.document).not(":disabled").prop("checked",!1)}),new ThrottleEvent("input",this.updateSlidePosition,25).bindTo(document.querySelector(Identifiers.stageSlider)),this.elements.$previewModeContainer.find("[data-preview-mode]").on("click",this.changePreviewMode)}renderStageButtons(e){this.elements.$stageButtonsContainer.html(e)}resizeViews(){const e=Preview.getAvailableSpace(),t=-1*(this.currentSlidePosition-100),i=Math.round(Math.abs(e*t/100)),s=this.elements.$liveView.outerHeight()-this.elements.$liveView.height();this.elements.$workspacePreview.height(e),"slider"===this.elements.$activePreviewMode.data("activePreviewMode")&&this.elements.$liveView.height(i-s)}adjustPreviewModeSelectorWidth(){const e=this.elements.$previewModeContainer.find(".dropdown-menu");let t=0;e.addClass("show"),this.elements.$previewModeContainer.find("li > a > span").each((e,i)=>{const s=$(i).width();t<s&&(t=s)}),e.removeClass("show"),this.elements.$activePreviewMode.width(t)}}export default new Preview; \ No newline at end of file diff --git a/typo3/sysext/workspaces/Resources/Public/JavaScript/toolbar/workspaces-menu.js b/typo3/sysext/workspaces/Resources/Public/JavaScript/toolbar/workspaces-menu.js new file mode 100644 index 0000000000000000000000000000000000000000..9a72544ad00a4aa40a64e06ee6629eb50c6ed9f2 --- /dev/null +++ b/typo3/sysext/workspaces/Resources/Public/JavaScript/toolbar/workspaces-menu.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import $ from"jquery";import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import ModuleMenu from"@typo3/backend/module-menu.js";import Viewport from"@typo3/backend/viewport.js";import RegularEvent from"@typo3/core/event/regular-event.js";import{ModuleStateStorage}from"@typo3/backend/storage/module-state-storage.js";import Icons from"@typo3/backend/icons.js";var Identifiers,Classes;!function(e){e.containerSelector="#typo3-cms-workspaces-backend-toolbaritems-workspaceselectortoolbaritem",e.activeMenuItemLinkSelector=".dropdown-menu .selected",e.menuItemIconHolderSelector=".dropdown-table-icon",e.menuItemSelector=".t3js-workspace-item",e.menuItemLinkSelector=".t3js-workspaces-switchlink",e.toolbarItemSelector=".dropdown-toggle",e.workspaceModuleLinkSelector=".t3js-workspaces-modulelink"}(Identifiers||(Identifiers={})),function(e){e.workspaceBodyClass="typo3-in-workspace",e.workspacesTitleInToolbarClass="toolbar-item-name"}(Classes||(Classes={}));class WorkspacesMenu{static refreshPageTree(){document.dispatchEvent(new CustomEvent("typo3:pagetree:refresh"))}static getWorkspaceState(){const e=document.querySelector([Identifiers.containerSelector,Identifiers.activeMenuItemLinkSelector,Identifiers.menuItemLinkSelector].join(" "));if(null===e)return null;const t=parseInt(e.dataset.workspaceid||"0",10);return{id:t,title:e.innerText.trim(),inWorkspace:0!==t}}static updateTopBar(e){$("."+Classes.workspacesTitleInToolbarClass,Identifiers.containerSelector).remove(),Icons.getIcon("empty-empty",Icons.sizes.small).then(e=>{$(Identifiers.containerSelector+" "+Identifiers.menuItemSelector).each((t,o)=>{const r=o.querySelector(Identifiers.menuItemIconHolderSelector);r&&(r.innerHTML=e)})}),e.inWorkspace&&e.title&&$(Identifiers.toolbarItemSelector,Identifiers.containerSelector).append($("<span>",{class:Classes.workspacesTitleInToolbarClass}).text(e.title));const t=document.querySelector([Identifiers.containerSelector,Identifiers.activeMenuItemLinkSelector,Identifiers.menuItemIconHolderSelector].join(" "));null!==t&&Icons.getIcon("actions-check",Icons.sizes.small).then(e=>{t.innerHTML=e})}static updateBackendContext(e=null){null===e&&null===(e=WorkspacesMenu.getWorkspaceState())||(e.inWorkspace?($("body").addClass(Classes.workspaceBodyClass),e.title||(e.title=TYPO3.lang["Workspaces.workspaceTitle"])):$("body").removeClass(Classes.workspaceBodyClass),WorkspacesMenu.updateTopBar(e))}constructor(){Viewport.Topbar.Toolbar.registerEvent(()=>{this.initializeEvents(),WorkspacesMenu.updateBackendContext()}),new RegularEvent("typo3:datahandler:process",e=>{const t=e.detail.payload;"sys_workspace"===t.table&&"delete"===t.action&&!1===t.hasErrors&&Viewport.Topbar.refresh()}).bindTo(document)}performWorkspaceSwitch(e,t){$(Identifiers.activeMenuItemLinkSelector,Identifiers.containerSelector).removeClass("selected"),$(Identifiers.menuItemLinkSelector+"[data-workspaceid="+e+"]",Identifiers.containerSelector)?.closest(Identifiers.menuItemSelector)?.addClass("selected"),WorkspacesMenu.updateBackendContext({id:e,title:t,inWorkspace:0!==e})}initializeEvents(){$(Identifiers.containerSelector).on("click",Identifiers.workspaceModuleLinkSelector,e=>{e.preventDefault(),ModuleMenu.App.showModule(e.currentTarget.dataset.module)}),$(Identifiers.containerSelector).on("click",Identifiers.menuItemLinkSelector,e=>{e.preventDefault(),this.switchWorkspace(parseInt(e.currentTarget.dataset.workspaceid,10))})}switchWorkspace(e){new AjaxRequest(TYPO3.settings.ajaxUrls.workspace_switch).post({workspaceId:e,pageId:ModuleStateStorage.current("web").identifier}).then(async t=>{const o=await t.resolve();o.workspaceId||(o.workspaceId=0),this.performWorkspaceSwitch(o.workspaceId,o.title||"");const r=ModuleMenu.App.getCurrentModule();if(o.pageId){let e=TYPO3.Backend.ContentContainer.getUrl();e+=(e.includes("?")?"&":"?")+"id="+o.pageId,Viewport.ContentContainer.setUrl(e)}else r.startsWith("web_")?"web_WorkspacesWorkspaces"===r?ModuleMenu.App.showModule(r,"workspace="+e):ModuleMenu.App.reloadFrames():o.pageModule&&ModuleMenu.App.showModule(o.pageModule);WorkspacesMenu.refreshPageTree(),ModuleMenu.App.refreshMenu()})}}const workspacesMenu=new WorkspacesMenu;TYPO3.WorkspacesMenu=workspacesMenu;export default workspacesMenu; \ No newline at end of file diff --git a/typo3/sysext/workspaces/Resources/Public/JavaScript/workspaces.js b/typo3/sysext/workspaces/Resources/Public/JavaScript/workspaces.js new file mode 100644 index 0000000000000000000000000000000000000000..d1ec08cafd24975ab691e55936dfa0c4086978a4 --- /dev/null +++ b/typo3/sysext/workspaces/Resources/Public/JavaScript/workspaces.js @@ -0,0 +1,13 @@ +/* + * This file is part of the TYPO3 CMS project. + * + * It is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License, either version 2 + * of the License, or any later version. + * + * For the full copyright and license information, please read the + * LICENSE.txt file that was distributed with this source code. + * + * The TYPO3 project - inspiring people to share! + */ +import AjaxRequest from"@typo3/core/ajax/ajax-request.js";import{SeverityEnum}from"@typo3/backend/enum/severity.js";import $ from"jquery";import NProgress from"nprogress";import Modal from"@typo3/backend/modal.js";export default class Workspaces{constructor(){this.tid=0}renderSendToStageWindow(e){const t=e[0].result,a=$("<form />");if(void 0!==t.sendMailTo&&t.sendMailTo.length>0){a.append($("<label />",{class:"control-label"}).text(TYPO3.lang["window.sendToNextStageWindow.itemsWillBeSentTo"])),a.append($("<div />",{class:"form-group"}).append($('<button type="button" class="btn btn-default btn-xs t3js-workspace-recipients-selectall" />').text(TYPO3.lang["window.sendToNextStageWindow.selectAll"])," ",$('<button type="button" class="btn btn-default btn-xs t3js-workspace-recipients-deselectall" />').text(TYPO3.lang["window.sendToNextStageWindow.deselectAll"])));for(const e of t.sendMailTo)a.append($("<div />",{class:"form-check"}).append($("<input />",{type:"checkbox",name:"recipients",class:"form-check-input t3js-workspace-recipient",id:e.name,value:e.value}).prop("checked",e.checked).prop("disabled",e.disabled),$("<label />",{class:"form-check-label",for:e.name}).text(e.label)))}void 0!==t.additional&&a.append($("<div />",{class:"form-group"}).append($("<label />",{class:"control-label",for:"additional"}).text(TYPO3.lang["window.sendToNextStageWindow.additionalRecipients"]),$("<textarea />",{class:"form-control",name:"additional",id:"additional"}).text(t.additional.value),$("<span />",{class:"help-block"}).text(TYPO3.lang["window.sendToNextStageWindow.additionalRecipients.hint"]))),a.append($("<div />",{class:"form-group"}).append($("<label />",{class:"control-label",for:"comments"}).text(TYPO3.lang["window.sendToNextStageWindow.comments"]),$("<textarea />",{class:"form-control",name:"comments",id:"comments"}).text(t.comments.value)));const o=Modal.show(TYPO3.lang.actionSendToStage,a,SeverityEnum.info,[{text:TYPO3.lang.cancel,active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{o.modal("hide")}},{text:TYPO3.lang.ok,btnClass:"btn-info",name:"ok"}]);return o}sendRemoteRequest(e,t="#workspace-content-wrapper"){return NProgress.configure({parent:t,showSpinner:!1}),NProgress.start(),new AjaxRequest(TYPO3.settings.ajaxUrls.workspace_dispatch).post(e,{headers:{"Content-Type":"application/json; charset=utf-8"}}).finally(()=>NProgress.done())}generateRemotePayload(e,t={}){return this.generateRemotePayloadBody("RemoteServer",e,t)}generateRemoteMassActionsPayload(e,t={}){return this.generateRemotePayloadBody("MassActions",e,t)}generateRemoteActionsPayload(e,t={}){return this.generateRemotePayloadBody("Actions",e,t)}generateRemotePayloadBody(e,t,a){return a instanceof Array?a.push(TYPO3.settings.Workspaces.token):a=[a,TYPO3.settings.Workspaces.token],{action:e,data:a,method:t,type:"rpc",tid:this.tid++}}} \ No newline at end of file