typo3-typescript-sources 14.1.0 → 14.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.last-synced-tag +1 -1
- package/README.md +1 -1
- package/backend/Contrib/bootstrap.ts +39 -0
- package/backend/action-button/deferred-action.ts +0 -2
- package/backend/action-button/immediate-action.ts +0 -2
- package/backend/action-dispatcher.ts +0 -2
- package/backend/bookmark/bookmark-manager.ts +1234 -0
- package/backend/bookmark/bookmark-store.ts +701 -0
- package/backend/bookmark/element/bookmark-button-element.ts +144 -0
- package/backend/bookmark/toolbar/bookmark-menu-element.ts +139 -0
- package/backend/clear-cache.ts +12 -4
- package/backend/clipboard-panel.ts +4 -4
- package/backend/code-editor/element/code-mirror-element.ts +6 -1
- package/backend/color-picker.ts +7 -5
- package/backend/color-scheme-switch.ts +1 -1
- package/backend/column-selector-button.ts +4 -4
- package/backend/context-menu-actions.ts +63 -9
- package/backend/context-menu.ts +3 -3
- package/backend/contextual-record-edit.ts +212 -0
- package/backend/copy-to-clipboard.ts +32 -13
- package/backend/date-time-picker.ts +7 -5
- package/backend/drag-tooltip.ts +1 -1
- package/backend/drag-uploader.ts +58 -43
- package/backend/dropdown.ts +317 -0
- package/backend/element/alert-element.ts +5 -5
- package/backend/element/breadcrumb.ts +162 -38
- package/backend/element/combobox-element.ts +3 -2
- package/backend/element/contextual-record-edit-trigger.ts +117 -0
- package/backend/element/datetime-element.ts +282 -0
- package/backend/element/dispatch-modal-button.ts +1 -1
- package/backend/element/draggable-resizable-element.ts +1 -1
- package/backend/element/editable-page-title.ts +8 -6
- package/backend/element/icon-element.ts +2 -2
- package/backend/element/link-browser-download-element.ts +86 -0
- package/backend/element/pagination.ts +4 -4
- package/backend/element/progress-bar-element.ts +6 -2
- package/backend/element/progress-tracker-element.ts +4 -4
- package/backend/element/pseudo-button.ts +1 -1
- package/backend/element/qrcode-element.ts +54 -7
- package/{redirects → backend}/element/qrcode-modal-button.ts +20 -14
- package/backend/element/sidebar-toggle-element.ts +1 -1
- package/backend/element/spinner-element.ts +1 -1
- package/backend/element-browser.ts +62 -6
- package/backend/event/form-engine-link-browser-set-link-event.ts +34 -0
- package/backend/form/submit-interceptor.ts +7 -5
- package/backend/form-engine/container/flex-form-container-container.ts +42 -32
- package/backend/form-engine/container/flex-form-section-container.ts +8 -28
- package/backend/form-engine/container/inline-control-container.ts +304 -293
- package/backend/form-engine/element/extra/char-counter.ts +3 -3
- package/backend/form-engine/element/online-media-form-element.ts +2 -2
- package/backend/form-engine/element/select-tree-toolbar.ts +6 -6
- package/backend/form-engine/element/select-tree.ts +1 -1
- package/backend/form-engine/element/suggest/result-container.ts +3 -3
- package/backend/form-engine/element/suggest/result-item.ts +1 -1
- package/backend/form-engine/element/table-wizard-element.ts +23 -22
- package/backend/form-engine/field-control/link-popup.ts +22 -3
- package/backend/form-engine/field-control/password-generator.ts +9 -3
- package/backend/form-engine-link-browser-adapter.ts +15 -86
- package/backend/form-engine-review.ts +9 -4
- package/backend/form-engine-validation.ts +13 -6
- package/backend/form-engine.ts +170 -113
- package/backend/grid-editor.ts +32 -29
- package/backend/hotkeys/events.ts +47 -0
- package/backend/hotkeys/hotkey-storage.ts +3 -18
- package/backend/hotkeys/hotkey-struct.ts +58 -0
- package/backend/hotkeys/negotiator.ts +53 -0
- package/backend/hotkeys.ts +27 -46
- package/backend/image-manipulation.ts +82 -2
- package/backend/input/clearable.ts +4 -3
- package/backend/layout-module/paste.ts +7 -6
- package/backend/link-browser.ts +1 -0
- package/backend/live-search/element/backend-search.ts +1 -1
- package/backend/live-search/element/hint.ts +1 -1
- package/backend/live-search/element/provider/default-result-item.ts +3 -3
- package/backend/live-search/element/provider/page-provider-result-item.ts +3 -3
- package/backend/live-search/element/result/item/action/action-container.ts +1 -1
- package/backend/live-search/element/result/item/action/action.ts +2 -2
- package/backend/live-search/element/result/item/item-container.ts +3 -3
- package/backend/live-search/element/result/item/item.ts +2 -1
- package/backend/live-search/element/result/result-container.ts +5 -5
- package/backend/live-search/element/result/result-detail-container.ts +1 -1
- package/backend/live-search/element/result/result-pagination.ts +2 -2
- package/backend/live-search/element/search-option-item.ts +2 -2
- package/backend/live-search/live-search-shortcut.ts +1 -14
- package/backend/{toolbar → live-search}/live-search.ts +10 -22
- package/backend/live-search/result-types/default-result-type.ts +6 -1
- package/backend/live-search/result-types/page-result-type.ts +2 -2
- package/backend/live-search/toolbar/live-search-toolbar-item.ts +24 -0
- package/backend/localization/finisher/localization-submission-service.ts +33 -0
- package/backend/localization/label-provider.ts +187 -0
- package/backend/localization/localization-button.ts +3 -3
- package/backend/localization/localization-wizard.ts +70 -351
- package/backend/localization/steps/content-record-selection-step.ts +35 -42
- package/backend/localization/steps/handler-selection-step.ts +27 -31
- package/backend/localization/steps/mode-step.ts +26 -30
- package/backend/localization/steps/source-language-step.ts +28 -30
- package/backend/localization/steps/target-language-step.ts +34 -35
- package/backend/login-refresh.ts +15 -14
- package/backend/modal.ts +81 -18
- package/backend/module/iframe.ts +5 -5
- package/backend/module/router.ts +1 -1
- package/backend/multi-record-selection-delete-action.ts +4 -2
- package/backend/multi-step-wizard.ts +7 -6
- package/backend/new-content-element-wizard-button.ts +1 -1
- package/backend/new-record-wizard.ts +14 -17
- package/backend/notification.ts +5 -5
- package/backend/online-media.ts +2 -1
- package/backend/page-wizard/finisher/page-wizard-submission-service.ts +42 -0
- package/backend/page-wizard/helper/wizard-helper.ts +34 -0
- package/backend/page-wizard/new-page-wizard-button.ts +32 -0
- package/backend/page-wizard/page-wizard-configuration.ts +20 -0
- package/backend/page-wizard/page-wizard.ts +114 -0
- package/backend/page-wizard/steps/doktype-step.ts +239 -0
- package/backend/page-wizard/steps/form-engine-step.ts +165 -0
- package/backend/page-wizard/steps/position-step.ts +158 -0
- package/backend/pagetsconfig/pagetsconfig-includes.ts +1 -1
- package/backend/record-download-button.ts +4 -4
- package/backend/security/element/csp-reports.ts +30 -30
- package/backend/security/element/sudo-mode.ts +1 -1
- package/backend/settings/editor/editable-setting.ts +7 -6
- package/backend/settings/editor.ts +9 -8
- package/backend/settings/type/base.ts +1 -1
- package/backend/settings/type/bool.ts +1 -1
- package/backend/settings/type/color.ts +1 -1
- package/backend/settings/type/int.ts +2 -2
- package/backend/settings/type/number.ts +2 -2
- package/backend/settings/type/page.ts +9 -5
- package/backend/settings/type/string.ts +2 -2
- package/backend/settings/type/stringlist.ts +1 -1
- package/backend/settings/type/url.ts +1 -1
- package/backend/sortable-table.ts +3 -2
- package/backend/switch-user.ts +1 -1
- package/backend/tab.ts +424 -0
- package/backend/tabs.ts +2 -59
- package/backend/tests/localization/label-provider-test.ts +72 -0
- package/backend/toolbar/clear-cache-menu.ts +12 -9
- package/backend/toolbar/system-information-menu.ts +6 -16
- package/backend/tree/file-storage-browser.ts +1 -1
- package/backend/tree/file-storage-tree-container.ts +14 -11
- package/backend/tree/page-browser.ts +13 -12
- package/backend/tree/page-position-select.ts +293 -0
- package/backend/tree/page-tree-element.ts +233 -83
- package/backend/tree/page-tree.ts +20 -0
- package/backend/tree/tree-module-state.ts +1 -1
- package/backend/tree/tree-node-toggle.ts +1 -1
- package/backend/tree/tree-toolbar.ts +43 -38
- package/backend/tree/tree.ts +69 -23
- package/backend/type/date-configuration.ts +31 -0
- package/backend/user-settings-manager.ts +34 -18
- package/backend/utility/collapse-state-search.ts +2 -1
- package/backend/viewport/content-container.ts +1 -1
- package/backend/viewport/content-navigation-toggle.ts +14 -4
- package/backend/viewport/content-navigation.ts +6 -6
- package/backend/viewport/loader.ts +6 -4
- package/backend/wizard/events/auto-advance-event.ts +21 -0
- package/backend/wizard/events/before-next-step-event.ts +24 -0
- package/backend/wizard/events/step-summary-event.ts +26 -0
- package/backend/wizard/finisher/finisher-config.ts +19 -0
- package/backend/{localization/localization-finisher.ts → wizard/finisher/finisher-interface.ts} +2 -11
- package/backend/wizard/finisher/finisher-result.ts +26 -0
- package/backend/{localization → wizard}/finisher/noop-finisher.ts +3 -2
- package/backend/{localization → wizard}/finisher/redirect-finisher.ts +3 -2
- package/backend/{localization → wizard}/finisher/reload-finisher.ts +4 -3
- package/backend/wizard/finisher/submission-service-interface.ts +17 -0
- package/backend/wizard/helper/dynamic-steps-loader.ts +60 -0
- package/backend/wizard/move-content-element.ts +14 -8
- package/backend/wizard/move-page.ts +7 -5
- package/backend/wizard/steps/confirm-step.ts +63 -0
- package/backend/{localization → wizard}/steps/finisher-step.ts +37 -61
- package/backend/wizard/steps/summary-item-interface.ts +19 -0
- package/backend/wizard/steps/wizard-step-after-render-interface.ts +16 -0
- package/backend/wizard/steps/wizard-step-interface.ts +26 -0
- package/backend/wizard/steps/wizard-step-summary-interface.ts +18 -0
- package/backend/wizard/steps/wizard-step-value-interface.ts +20 -0
- package/backend/wizard/wizard.ts +399 -0
- package/belog/backend-log.ts +8 -2
- package/core/authentication/mfa-provider/totp.ts +1 -1
- package/core/directive/markdown.ts +2 -2
- package/core/lit-helper.ts +2 -2
- package/core/utility/debug-exception-handler-service.ts +188 -0
- package/dashboard/dashboard.ts +51 -49
- package/dashboard/widget/bookmarks-widget-element.ts +140 -0
- package/extensionmanager/dependency-check.ts +179 -0
- package/extensionmanager/distribution-image.ts +1 -1
- package/extensionmanager/extension-toggle-button.ts +201 -0
- package/extensionmanager/main.ts +55 -69
- package/extensionmanager/repository.ts +22 -16
- package/extensionmanager/update.ts +4 -3
- package/filelist/context-menu-actions.ts +14 -13
- package/filelist/file-delete.ts +3 -2
- package/filelist/file-list-rename-handler.ts +6 -5
- package/filelist/file-list-replace-handler.ts +17 -14
- package/filelist/file-list-transfer-handler.ts +8 -11
- package/filelist/file-list.ts +38 -12
- package/filelist/rename-file.ts +9 -6
- package/form/backend/form-editor/component/date-editor.ts +265 -0
- package/form/backend/form-editor/component/form-element-selector.ts +74 -0
- package/form/backend/form-editor/component/form-element-stage-item-toolbar.ts +112 -0
- package/form/backend/form-editor/component/form-element-stage-item.ts +188 -0
- package/form/backend/form-editor/component/page-stage-item.ts +53 -0
- package/form/backend/form-editor/component/property-grid-editor.ts +54 -23
- package/form/backend/form-editor/core.ts +119 -105
- package/form/backend/form-editor/helper.ts +17 -10
- package/form/backend/form-editor/inspector-component.ts +689 -703
- package/form/backend/form-editor/mediator.ts +54 -43
- package/form/backend/form-editor/modals-component.ts +59 -61
- package/form/backend/form-editor/stage-component.ts +635 -328
- package/form/backend/form-editor/tree-component-adapter.ts +651 -0
- package/form/backend/form-editor/utility/string-utility.ts +33 -0
- package/form/backend/form-editor/view-model.ts +240 -229
- package/form/backend/form-editor-tree-container.ts +105 -0
- package/form/backend/form-editor-tree-events.ts +138 -0
- package/form/backend/form-editor-tree.ts +784 -0
- package/form/backend/form-editor.ts +26 -42
- package/form/backend/form-manager/view-model.ts +155 -674
- package/form/backend/form-manager.ts +26 -9
- package/form/backend/form-wizard/finisher/create-form-submission-service.ts +59 -0
- package/form/backend/form-wizard/finisher/duplicate-form-submission-service.ts +58 -0
- package/form/backend/form-wizard/form-wizard.ts +135 -0
- package/form/backend/form-wizard/steps/mode-step.ts +140 -0
- package/form/backend/form-wizard/steps/settings-step.ts +248 -0
- package/form/backend/form-wizard/steps/storage-step.ts +128 -0
- package/form/frontend/date-picker.ts +2 -0
- package/install/module/settings/extension-configuration.ts +0 -8
- package/install/module/settings/local-configuration.ts +0 -8
- package/install/renderable/flash-message.ts +1 -1
- package/install/renderable/info-box.ts +1 -1
- package/install/renderable/language-packs.ts +3 -3
- package/install/renderable/offset-group.ts +1 -1
- package/install/renderable/wrap-group.ts +1 -1
- package/install/router.ts +1 -1
- package/lowlevel/query-generator.ts +1 -1
- package/opendocs/open-document-store.ts +195 -0
- package/opendocs/toolbar/open-document-menu-element.ts +127 -0
- package/opendocs/widget/recent-documents-widget-element.ts +130 -0
- package/package.json +2 -2
- package/recycler/recycler.ts +55 -56
- package/redirects/event-handler.ts +15 -7
- package/redirects/short-url-generator.ts +145 -0
- package/rte-ckeditor/ckeditor5.ts +3 -3
- package/rte-ckeditor/plugin/typo3-link.ts +24 -4
- package/scheduler/new-scheduler-task-wizard-button.ts +1 -1
- package/scheduler/scheduler-add-group.ts +6 -6
- package/scheduler/setup-check-button.ts +1 -1
- package/styleguide/element/theme-switcher-element.ts +10 -9
- package/sys-note/element/delete-button.ts +1 -1
- package/tstemplate/template-analyzer.ts +1 -1
- package/workspaces/backend.ts +27 -25
- package/workspaces/element/workspace-selector-element.ts +186 -0
- package/workspaces/element/workspace-top-indicator-element.ts +159 -0
- package/workspaces/preview.ts +5 -4
- package/workspaces/renderable/comment-view.ts +3 -3
- package/workspaces/renderable/diff-view.ts +3 -3
- package/workspaces/renderable/history-view.ts +3 -3
- package/workspaces/renderable/record-information.ts +8 -12
- package/workspaces/renderable/record-table.ts +56 -32
- package/workspaces/renderable/send-to-stage-form.ts +14 -8
- package/workspaces/workspace-state.ts +251 -0
- package/workspaces/workspaces.ts +4 -5
- package/backend/form-engine/container/files-control-container.ts +0 -716
- package/backend/form-engine/container/site-language-container.ts +0 -616
- package/backend/key-bindings.ts +0 -42
- package/backend/localization/steps/confirm-step.ts +0 -61
- package/backend/toolbar/shortcut-menu.ts +0 -254
- package/form/backend/form-editor/tree-component.ts +0 -550
- package/opendocs/toolbar/opendocs-menu.ts +0 -117
- package/workspaces/toolbar/workspaces-menu.ts +0 -192
|
@@ -14,15 +14,18 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* Module: @typo3/form/backend/form-manager/view-model
|
|
16
16
|
*/
|
|
17
|
-
import $ from 'jquery';
|
|
18
17
|
import Modal, { type ModalElement } from '@typo3/backend/modal';
|
|
19
18
|
import Severity from '@typo3/backend/severity';
|
|
20
|
-
import MultiStepWizard from '@typo3/backend/multi-step-wizard';
|
|
21
19
|
import Icons from '@typo3/backend/icons';
|
|
22
20
|
import Notification from '@typo3/backend/notification';
|
|
23
21
|
import SecurityUtility from '@typo3/core/security-utility';
|
|
24
|
-
import
|
|
22
|
+
import AjaxRequest from '@typo3/core/ajax/ajax-request';
|
|
23
|
+
import { AjaxResponse } from '@typo3/core/ajax/ajax-response';
|
|
25
24
|
import type { FormManager } from '@typo3/form/backend/form-manager';
|
|
25
|
+
import { SeverityEnum } from '@typo3/backend/enum/severity';
|
|
26
|
+
import { topLevelModuleImport } from '@typo3/backend/utility/top-level-module-import';
|
|
27
|
+
import { html } from 'lit';
|
|
28
|
+
import formManagerLabels from '~labels/form.form_manager_javascript';
|
|
26
29
|
|
|
27
30
|
const securityUtility = new SecurityUtility();
|
|
28
31
|
|
|
@@ -31,713 +34,191 @@ enum Identifiers {
|
|
|
31
34
|
duplicateFormModalTrigger = '[data-identifier="duplicateForm"]',
|
|
32
35
|
removeFormModalTrigger = '[data-identifier="removeForm"]',
|
|
33
36
|
|
|
34
|
-
newFormModeButton = '[data-identifier="newFormModeButton"]',
|
|
35
|
-
newFormName = '[data-identifier="newFormName"]',
|
|
36
|
-
newFormSavePath = '[data-identifier="newFormSavePath"]',
|
|
37
|
-
newFormPrototypeName = '[data-identifier="newFormPrototypeName"]',
|
|
38
|
-
newFormTemplate = '[data-identifier="newFormTemplate"]',
|
|
39
|
-
|
|
40
|
-
duplicateFormName = '[data-identifier="duplicateFormName"]',
|
|
41
|
-
duplicateFormSavePath = '[data-identifier="duplicateFormSavePath"]',
|
|
42
|
-
|
|
43
37
|
showReferences = '[data-identifier="showReferences"]',
|
|
44
38
|
referenceLink = '[data-identifier="referenceLink"]',
|
|
45
|
-
|
|
46
|
-
moduleBody = '.module-body.t3js-module-body',
|
|
47
|
-
t3Logo = '.t3-message-page-logo',
|
|
48
|
-
|
|
49
|
-
t3Footer = '#t3-footer',
|
|
50
|
-
|
|
51
|
-
formsTable = '#forms'
|
|
52
39
|
}
|
|
53
40
|
|
|
54
|
-
/**
|
|
55
|
-
* @throws 1477506500
|
|
56
|
-
* @throws 1477506501
|
|
57
|
-
* @throws 1477506502
|
|
58
|
-
*/
|
|
59
41
|
function newFormSetup(formManagerApp: FormManager): void {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const nextButton = modal.find('.modal-footer').find('button[name="next"]');
|
|
74
|
-
|
|
75
|
-
MultiStepWizard.blurCancelStep();
|
|
76
|
-
MultiStepWizard.lockNextStep();
|
|
77
|
-
MultiStepWizard.lockPrevStep();
|
|
78
|
-
|
|
79
|
-
const folders = formManagerApp.getAccessibleFormStorageFolders();
|
|
80
|
-
if (folders.length === 0) {
|
|
81
|
-
html = '<h5 class="form-section-headline">' + TYPO3.lang['formManager.newFormWizard.step1.noStorages'] + '</h5>';
|
|
82
|
-
slide.html(html);
|
|
83
|
-
formManagerApp.assert(false, 'No accessible form storage folders', 1477506500);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
html = '<div class="card-container">'
|
|
87
|
-
+ '<div class="card card-size-medium">'
|
|
88
|
-
+ '<div class="card-header">'
|
|
89
|
-
+ '<div class="card-icon">' + blankIconMarkup + '</div>'
|
|
90
|
-
+ '<div class="card-header-body">'
|
|
91
|
-
+ '<h2 class="card-title">' + TYPO3.lang['formManager.blankForm.label'] + '</h2>'
|
|
92
|
-
+ '<span class="card-subtitle">' + TYPO3.lang['formManager.blankForm.subtitle'] + '</span>'
|
|
93
|
-
+ '</div>'
|
|
94
|
-
+ '</div>'
|
|
95
|
-
+ '<div class="card-body">'
|
|
96
|
-
+ '<p class="card-text">' + TYPO3.lang['formManager.blankForm.description'] + '</p>'
|
|
97
|
-
+ '</div>'
|
|
98
|
-
+ '<div class="card-footer">'
|
|
99
|
-
+ '<button type="button" class="btn btn-default" data-inline="1" value="blank" data-identifier="newFormModeButton">' + addIconMarkup + ' ' + TYPO3.lang['formManager.blankForm.label'] + '</button>'
|
|
100
|
-
+ '</div>'
|
|
101
|
-
+ '</div>'
|
|
102
|
-
+ '<div class="card card-size-medium">'
|
|
103
|
-
+ '<div class="card-header">'
|
|
104
|
-
+ '<div class="card-icon">' + duplicateIconMarkup + '</div>'
|
|
105
|
-
+ '<div class="card-header-body">'
|
|
106
|
-
+ '<h2 class="card-title">' + TYPO3.lang['formManager.predefinedForm.label'] + '</h2>'
|
|
107
|
-
+ '<span class="card-subtitle">' + TYPO3.lang['formManager.predefinedForm.subtitle'] + '</span>'
|
|
108
|
-
+ '</div>'
|
|
109
|
-
+ '</div>'
|
|
110
|
-
+ '<div class="card-body">'
|
|
111
|
-
+ '<p class="card-text">' + TYPO3.lang['formManager.predefinedForm.description'] + '</p>'
|
|
112
|
-
+ '</div>'
|
|
113
|
-
+ '<div class="card-footer">'
|
|
114
|
-
+ '<button type="button" class="btn btn-default" data-inline="1" value="predefined" data-identifier="newFormModeButton">' + addIconMarkup + ' ' + TYPO3.lang['formManager.predefinedForm.label'] + '</button>'
|
|
115
|
-
+ '</div>'
|
|
116
|
-
+ '</div>'
|
|
117
|
-
+ '</div>';
|
|
118
|
-
|
|
119
|
-
slide.html(html);
|
|
120
|
-
|
|
121
|
-
$(Identifiers.newFormModeButton, modal).on('click', function (e: Event) {
|
|
122
|
-
MultiStepWizard.set('newFormMode', $(e.currentTarget).val());
|
|
123
|
-
MultiStepWizard.next();
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
nextButton.on('click', async function() {
|
|
127
|
-
slide.html($('<div />', { class: 'text-center' })
|
|
128
|
-
.append(await Icons.getIcon('spinner-circle', Icons.sizes.default, null, null))
|
|
129
|
-
.prop('outerHTML'));
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Wizard step 2
|
|
135
|
-
*/
|
|
136
|
-
MultiStepWizard.addSlide('new-form-step-2', TYPO3.lang['formManager.newFormWizard.step2.title'], '', Severity.notice, top.TYPO3.lang['wizard.progressStep.configure'], function(slide, settings) {
|
|
137
|
-
let html, savePathSelect;
|
|
138
|
-
|
|
139
|
-
MultiStepWizard.lockNextStep();
|
|
140
|
-
MultiStepWizard.unlockPrevStep();
|
|
141
|
-
|
|
142
|
-
const modal = MultiStepWizard.setup.$carousel.closest('.modal');
|
|
143
|
-
const nextButton = modal.find('.modal-footer').find('button[name="next"]');
|
|
144
|
-
|
|
145
|
-
const folders = formManagerApp.getAccessibleFormStorageFolders();
|
|
146
|
-
|
|
147
|
-
if (!settings.savePath) {
|
|
148
|
-
MultiStepWizard.set('savePath', folders[0].value);
|
|
149
|
-
MultiStepWizard.set('savePathName', folders[0].label);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
if (folders.length > 1) {
|
|
153
|
-
savePathSelect = $('<select class="new-form-save-path form-select" id="new-form-save-path" data-identifier="newFormSavePath" />');
|
|
154
|
-
for (let i = 0, len = folders.length; i < len; ++i) {
|
|
155
|
-
const option = new Option(folders[i].label, folders[i].value);
|
|
156
|
-
$(savePathSelect).append(option);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const prototypes = formManagerApp.getPrototypes();
|
|
161
|
-
formManagerApp.assert(prototypes.length > 0, 'No prototypes available', 1477506501);
|
|
162
|
-
|
|
163
|
-
if (!settings.prototypeName) {
|
|
164
|
-
MultiStepWizard.set('prototypeName', prototypes[0].value);
|
|
165
|
-
MultiStepWizard.set('prototypeNameName', prototypes[0].label);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
const prototypeNameSelect = $('<select class="new-form-prototype-name form-select" id="new-form-prototype-name" data-identifier="newFormPrototypeName" />');
|
|
169
|
-
for (let i = 0, len = prototypes.length; i < len; ++i) {
|
|
170
|
-
const option = new Option(prototypes[i].label, prototypes[i].value);
|
|
171
|
-
$(prototypeNameSelect).append(option);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
let templates = formManagerApp.getTemplatesForPrototype(prototypes[0].value);
|
|
175
|
-
formManagerApp.assert(templates.length > 0, 'No templates available', 1477506502);
|
|
176
|
-
|
|
177
|
-
if (!settings.templatePath) {
|
|
178
|
-
MultiStepWizard.set('templatePath', templates[0].value);
|
|
179
|
-
MultiStepWizard.set('templatePathName', templates[0].label);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const templateSelect = $('<select class="new-form-template form-select" id="new-form-template" data-identifier="newFormTemplate" />');
|
|
183
|
-
for (let i = 0, len = templates.length; i < len; ++i) {
|
|
184
|
-
const option = new Option(templates[i].label, templates[i].value);
|
|
185
|
-
$(templateSelect).append(option);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
html = '';
|
|
189
|
-
|
|
190
|
-
if (settings.newFormMode === 'blank') {
|
|
191
|
-
html += '<h5 class="form-section-headline">' + TYPO3.lang['formManager.blankForm.label'] + '</h5>';
|
|
192
|
-
MultiStepWizard.set('templatePath', 'EXT:form/Resources/Private/Backend/Templates/FormEditor/Yaml/NewForms/BlankForm.yaml');
|
|
193
|
-
MultiStepWizard.set('templatePathName', TYPO3.lang['formManager.blankForm.label']);
|
|
194
|
-
} else {
|
|
195
|
-
html += '<h5 class="form-section-headline">' + TYPO3.lang['formManager.predefinedForm.label'] + '</h5>';
|
|
196
|
-
if (prototypes.length > 1) {
|
|
197
|
-
html += '<div class="form-group">'
|
|
198
|
-
+ '<label class="form-label" for="new-form-prototype-name">' + TYPO3.lang['formManager.form_prototype'] + '</label>'
|
|
199
|
-
+ $(prototypeNameSelect)[0].outerHTML
|
|
200
|
-
+ '</div>';
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (templates.length > 1) {
|
|
204
|
-
html += '<div class="form-group">'
|
|
205
|
-
+ '<label class="form-label" for="new-form-template">' + TYPO3.lang['formManager.form_template'] + '</label>'
|
|
206
|
-
+ '<div class="form-description">' + TYPO3.lang['formManager.form_template_description'] + '</div>'
|
|
207
|
-
+ $(templateSelect)[0].outerHTML
|
|
208
|
-
+ '</div>';
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
html += '<div class="form-group">'
|
|
213
|
-
+ '<label class="form-label" for="new-form-name">' + TYPO3.lang['formManager.form_name'] + '</label>'
|
|
214
|
-
+ '<div class="form-description">' + TYPO3.lang['formManager.form_name_description'] + '</div>';
|
|
215
|
-
|
|
216
|
-
if (settings.formName) {
|
|
217
|
-
html += '<input class="form-control" id="new-form-name" data-identifier="newFormName" value="' + securityUtility.encodeHtml(settings.formName) + '" />';
|
|
218
|
-
|
|
219
|
-
setTimeout(
|
|
220
|
-
function() {
|
|
221
|
-
MultiStepWizard.unlockNextStep();
|
|
222
|
-
}, 200);
|
|
223
|
-
} else {
|
|
224
|
-
html += '<input class="form-control has-error" id="new-form-name" data-identifier="newFormName" />';
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
html += '</div>';
|
|
228
|
-
|
|
229
|
-
if (savePathSelect) {
|
|
230
|
-
html += '<div class="form-group">'
|
|
231
|
-
+ '<label class="form-label" for="new-form-save-path">' + TYPO3.lang['formManager.form_save_path'] + '</label>'
|
|
232
|
-
+ '<div class="form-description">' + TYPO3.lang['formManager.form_save_path_description'] + '</div>'
|
|
233
|
-
+ $(savePathSelect)[0].outerHTML
|
|
234
|
-
+ '</div>';
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
slide.html(html);
|
|
238
|
-
|
|
239
|
-
if (settings.savePath) {
|
|
240
|
-
$(Identifiers.newFormSavePath, modal).val(settings.savePath);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (settings.templatePath) {
|
|
244
|
-
$(Identifiers.newFormTemplate, modal).val(settings.templatePath);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (prototypes.length > 1) {
|
|
248
|
-
$(Identifiers.newFormPrototypeName, modal).focus();
|
|
249
|
-
} else if (templates.length > 1) {
|
|
250
|
-
$(Identifiers.newFormTemplate, modal).focus();
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const addOnTemplateChangeEvents = function() {
|
|
254
|
-
$(Identifiers.newFormTemplate, modal).on('change', function() {
|
|
255
|
-
MultiStepWizard.set('templatePath', $(Identifiers.newFormTemplate + ' option:selected', modal).val());
|
|
256
|
-
MultiStepWizard.set('templatePathName', $(Identifiers.newFormTemplate + ' option:selected', modal).text());
|
|
257
|
-
MultiStepWizard.set('templatePathOnPrev', $(Identifiers.newFormTemplate + ' option:selected', modal).val());
|
|
258
|
-
});
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
$(Identifiers.newFormPrototypeName, modal).on('change', function(e: Event) {
|
|
262
|
-
MultiStepWizard.set('prototypeName', $(Identifiers.newFormPrototypeName + ' option:selected', modal).val());
|
|
263
|
-
MultiStepWizard.set('prototypeNameName', $(Identifiers.newFormPrototypeName + ' option:selected', modal).text());
|
|
264
|
-
|
|
265
|
-
templates = formManagerApp.getTemplatesForPrototype($(e.currentTarget).val());
|
|
266
|
-
$(Identifiers.newFormTemplate, modal).off().empty();
|
|
267
|
-
for (let i = 0, len = templates.length; i < len; ++i) {
|
|
268
|
-
const option = new Option(templates[i].label, templates[i].value);
|
|
269
|
-
$(Identifiers.newFormTemplate, modal).append(option);
|
|
270
|
-
MultiStepWizard.set('templatePath', templates[0].value);
|
|
271
|
-
MultiStepWizard.set('templatePathName', templates[0].label);
|
|
272
|
-
}
|
|
273
|
-
addOnTemplateChangeEvents();
|
|
274
|
-
});
|
|
275
|
-
|
|
276
|
-
addOnTemplateChangeEvents();
|
|
277
|
-
|
|
278
|
-
if (settings.prototypeName) {
|
|
279
|
-
$(Identifiers.newFormPrototypeName, modal).val(settings.prototypeName);
|
|
280
|
-
$(Identifiers.newFormPrototypeName, modal).trigger('change');
|
|
281
|
-
|
|
282
|
-
if (settings.templatePathOnPrev) {
|
|
283
|
-
$(Identifiers.newFormTemplate, modal).find(selector`option[value="${settings.templatePathOnPrev}"]`).prop('selected', true);
|
|
284
|
-
$(Identifiers.newFormTemplate, modal).trigger('change');
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
$(Identifiers.newFormName, modal).focus();
|
|
289
|
-
|
|
290
|
-
$(Identifiers.newFormName, modal).on('keyup paste', function(e: JQueryEventObject) {
|
|
291
|
-
if ($(e.currentTarget).val().length > 0) {
|
|
292
|
-
$(e.currentTarget).removeClass('has-error');
|
|
293
|
-
MultiStepWizard.unlockNextStep();
|
|
294
|
-
MultiStepWizard.set('formName', $(e.currentTarget).val());
|
|
295
|
-
if ('code' in e && e.code === 'Enter') {
|
|
296
|
-
MultiStepWizard.triggerStepButton('next');
|
|
297
|
-
}
|
|
298
|
-
} else {
|
|
299
|
-
$(e.currentTarget).addClass('has-error');
|
|
300
|
-
MultiStepWizard.lockNextStep();
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
$(Identifiers.newFormSavePath, modal).on('change', function() {
|
|
305
|
-
MultiStepWizard.set('savePath', $(Identifiers.newFormSavePath + ' option:selected', modal).val());
|
|
306
|
-
MultiStepWizard.set('savePathName', $(Identifiers.newFormSavePath + ' option:selected', modal).text());
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
if (settings.newFormMode !== 'blank' && !settings.templatePathName) {
|
|
310
|
-
MultiStepWizard.set('templatePathName', $(Identifiers.newFormTemplate + ' option:selected', modal).text());
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
nextButton.on('click', async function() {
|
|
314
|
-
MultiStepWizard.setup.forceSelection = false;
|
|
315
|
-
slide.html($('<div />', { class: 'text-center' })
|
|
316
|
-
.append(await Icons.getIcon('spinner-circle', Icons.sizes.default, null, null))
|
|
317
|
-
.prop('outerHTML'));
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Wizard step 3
|
|
323
|
-
*/
|
|
324
|
-
MultiStepWizard.addSlide('new-form-step-3', TYPO3.lang['formManager.newFormWizard.step3.title'], '', Severity.notice, TYPO3.lang['formManager.newFormWizard.step3.progressLabel'], async function(slide, settings) {
|
|
325
|
-
const formPrototypeIconMarkup = await Icons.getIcon('actions-cog', Icons.sizes.small);
|
|
326
|
-
const formTemplateIconMarkup = await Icons.getIcon('actions-file-t3d', Icons.sizes.small);
|
|
327
|
-
const formNameIconMarkup = await Icons.getIcon('actions-tag', Icons.sizes.small);
|
|
328
|
-
const formStorageMarkup = await Icons.getIcon('actions-database', Icons.sizes.small);
|
|
329
|
-
const modal = MultiStepWizard.setup.$carousel.closest('.modal');
|
|
330
|
-
const nextButton = modal.find('.modal-footer').find('button[name="next"]');
|
|
331
|
-
|
|
332
|
-
let html = '<h5 class="form-section-headline">' + TYPO3.lang['formManager.newFormWizard.step3.check'] + '</h5>'
|
|
333
|
-
+ '<p>' + TYPO3.lang['formManager.newFormWizard.step3.message'] + '</p>'
|
|
334
|
-
+ '<div class="alert alert-notice">';
|
|
335
|
-
|
|
336
|
-
if (settings.prototypeNameName) {
|
|
337
|
-
html += '<div class="row my-1">'
|
|
338
|
-
+ '<div class="col col-sm-6">'
|
|
339
|
-
+ formPrototypeIconMarkup + ' '
|
|
340
|
-
+ TYPO3.lang['formManager.form_prototype']
|
|
341
|
-
+ '</div>'
|
|
342
|
-
+ '<div class="col">'
|
|
343
|
-
+ securityUtility.encodeHtml(settings.prototypeNameName)
|
|
344
|
-
+ '</div>'
|
|
345
|
-
+ '</div>';
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
if (settings.templatePathName) {
|
|
349
|
-
html += '<div class="row my-1">'
|
|
350
|
-
+ '<div class="col col-sm-6">'
|
|
351
|
-
+ formTemplateIconMarkup + ' '
|
|
352
|
-
+ TYPO3.lang['formManager.form_template']
|
|
353
|
-
+ '</div>'
|
|
354
|
-
+ '<div class="col">'
|
|
355
|
-
+ securityUtility.encodeHtml(settings.templatePathName)
|
|
356
|
-
+ '</div>'
|
|
357
|
-
+ '</div>';
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
html += '<div class="row my-1">'
|
|
361
|
-
+ '<div class="col col-sm-6">'
|
|
362
|
-
+ formNameIconMarkup + ' '
|
|
363
|
-
+ TYPO3.lang['formManager.form_name']
|
|
364
|
-
+ '</div>'
|
|
365
|
-
+ '<div class="col">'
|
|
366
|
-
+ securityUtility.encodeHtml(settings.formName)
|
|
367
|
-
+ '</div>'
|
|
368
|
-
+ '</div>'
|
|
369
|
-
+ '<div class="row my-1">'
|
|
370
|
-
+ '<div class="col col-sm-6">'
|
|
371
|
-
+ formStorageMarkup + ' '
|
|
372
|
-
+ TYPO3.lang['formManager.form_save_path']
|
|
373
|
-
+ '</div>'
|
|
374
|
-
+ '<div class="col">'
|
|
375
|
-
+ securityUtility.encodeHtml(settings.savePathName)
|
|
376
|
-
+ '</div>'
|
|
377
|
-
+ '</div>'
|
|
378
|
-
+ '</div>';
|
|
379
|
-
|
|
380
|
-
slide.html(html);
|
|
381
|
-
|
|
382
|
-
nextButton.focus();
|
|
383
|
-
|
|
384
|
-
nextButton.on('click', async function() {
|
|
385
|
-
MultiStepWizard.setup.forceSelection = false;
|
|
386
|
-
slide.html($('<div />', { class: 'text-center' })
|
|
387
|
-
.append(await Icons.getIcon('spinner-circle', Icons.sizes.default, null, null))
|
|
388
|
-
.prop('outerHTML'));
|
|
389
|
-
});
|
|
390
|
-
});
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Wizard step 4
|
|
394
|
-
*/
|
|
395
|
-
MultiStepWizard.addFinalProcessingSlide(function() {
|
|
396
|
-
$.post(formManagerApp.getAjaxEndpoint('create'), {
|
|
397
|
-
formName: MultiStepWizard.setup.settings.formName,
|
|
398
|
-
templatePath: MultiStepWizard.setup.settings.templatePath,
|
|
399
|
-
prototypeName: MultiStepWizard.setup.settings.prototypeName,
|
|
400
|
-
savePath: MultiStepWizard.setup.settings.savePath
|
|
401
|
-
}, function(data) {
|
|
402
|
-
if (data.status === 'success') {
|
|
403
|
-
document.location = data.url;
|
|
404
|
-
} else {
|
|
405
|
-
Notification.error(TYPO3.lang['formManager.newFormWizard.step4.errorTitle'], TYPO3.lang['formManager.newFormWizard.step4.errorMessage'] + ' ' + data.message);
|
|
406
|
-
}
|
|
407
|
-
MultiStepWizard.dismiss();
|
|
408
|
-
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
409
|
-
const parser = new DOMParser(),
|
|
410
|
-
responseDocument = parser.parseFromString(jqXHR.responseText, 'text/html'),
|
|
411
|
-
responseBody = $(responseDocument.body);
|
|
412
|
-
|
|
413
|
-
Notification.error(textStatus, errorThrown, 2);
|
|
414
|
-
MultiStepWizard.dismiss();
|
|
415
|
-
|
|
416
|
-
$(Identifiers.t3Logo, responseBody).remove();
|
|
417
|
-
$(Identifiers.t3Footer, responseBody).remove();
|
|
418
|
-
$(Identifiers.moduleBody).html(responseBody.html());
|
|
419
|
-
});
|
|
420
|
-
}).then(function() {
|
|
421
|
-
MultiStepWizard.show();
|
|
42
|
+
const newFormModalTrigger: HTMLElement = document.querySelector<HTMLElement>(Identifiers.newFormModalTrigger);
|
|
43
|
+
newFormModalTrigger.addEventListener('click', async (): Promise<void> => {
|
|
44
|
+
await topLevelModuleImport('@typo3/form/backend/form-wizard/form-wizard.js');
|
|
45
|
+
const content = html`<typo3-backend-form-wizard .formManager="${formManagerApp}"
|
|
46
|
+
></typo3-backend-form-wizard>`;
|
|
47
|
+
|
|
48
|
+
Modal.advanced({
|
|
49
|
+
title: formManagerLabels.get('formManager.newFormWizard.step1.title'),
|
|
50
|
+
content: content,
|
|
51
|
+
severity: SeverityEnum.notice,
|
|
52
|
+
size: Modal.sizes.medium,
|
|
53
|
+
staticBackdrop: true,
|
|
54
|
+
buttons: []
|
|
422
55
|
});
|
|
423
56
|
});
|
|
424
57
|
}
|
|
425
58
|
|
|
426
59
|
function removeFormSetup(formManagerApp: FormManager): void {
|
|
427
|
-
|
|
428
|
-
|
|
60
|
+
document.querySelectorAll<HTMLElement>(Identifiers.removeFormModalTrigger).forEach((element: HTMLElement): void => {
|
|
61
|
+
element.addEventListener('click', async (e: Event): Promise<void> => {
|
|
62
|
+
const modalButtons = [];
|
|
429
63
|
|
|
430
|
-
|
|
431
|
-
const that = $(e.currentTarget);
|
|
64
|
+
e.preventDefault();
|
|
432
65
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
modal.hideModal();
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
|
|
443
|
-
modalButtons.push({
|
|
444
|
-
text: TYPO3.lang['formManager.remove_form'],
|
|
445
|
-
active: true,
|
|
446
|
-
btnClass: 'btn-danger',
|
|
447
|
-
name: 'createform',
|
|
448
|
-
trigger: function(e: Event, modal: ModalElement) {
|
|
449
|
-
$.post(formManagerApp.getAjaxEndpoint('delete'), {
|
|
450
|
-
formPersistenceIdentifier: that.data('formPersistenceIdentifier'),
|
|
451
|
-
}, function(data) {
|
|
452
|
-
if (data.status === 'success') {
|
|
453
|
-
document.location = data.url;
|
|
454
|
-
} else {
|
|
455
|
-
Notification.error(data.title, data.message);
|
|
456
|
-
}
|
|
66
|
+
modalButtons.push({
|
|
67
|
+
text: formManagerLabels.get('formManager.cancel'),
|
|
68
|
+
active: true,
|
|
69
|
+
btnClass: 'btn-default',
|
|
70
|
+
name: 'cancel',
|
|
71
|
+
trigger: function(e: Event, modal: ModalElement) {
|
|
457
72
|
modal.hideModal();
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
|
|
462
|
-
Modal.show(
|
|
463
|
-
TYPO3.lang['formManager.remove_form_title'],
|
|
464
|
-
TYPO3.lang['formManager.remove_form_message'].replace('{0}', that.data('formName')),
|
|
465
|
-
Severity.error ,
|
|
466
|
-
modalButtons
|
|
467
|
-
);
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
/**
|
|
472
|
-
* @throws 1477649539
|
|
473
|
-
*/
|
|
474
|
-
function duplicateFormSetup(formManagerApp: FormManager): void {
|
|
475
|
-
$(Identifiers.duplicateFormModalTrigger).on('click', function(e: Event) {
|
|
476
|
-
e.preventDefault();
|
|
477
|
-
const that = $(e.currentTarget);
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Wizard step 1
|
|
481
|
-
*/
|
|
482
|
-
MultiStepWizard.addSlide('duplicate-form-step-1', TYPO3.lang['formManager.duplicateFormWizard.step1.title'].replace('{0}', that.data('formName')), '', Severity.notice, top.TYPO3.lang['wizard.progressStep.configure'], function(slide) {
|
|
483
|
-
let html, savePathSelect;
|
|
484
|
-
|
|
485
|
-
MultiStepWizard.lockPrevStep();
|
|
486
|
-
MultiStepWizard.lockNextStep();
|
|
487
|
-
|
|
488
|
-
const modal = MultiStepWizard.setup.$carousel.closest('.modal');
|
|
489
|
-
const nextButton = modal.find('.modal-footer').find('button[name="next"]');
|
|
490
|
-
|
|
491
|
-
const folders = formManagerApp.getAccessibleFormStorageFolders();
|
|
492
|
-
formManagerApp.assert(folders.length > 0, 'No accessible form storage folders', 1477649539);
|
|
493
|
-
|
|
494
|
-
MultiStepWizard.set('formPersistenceIdentifier', that.data('formPersistenceIdentifier'));
|
|
495
|
-
MultiStepWizard.set('savePath', folders[0].value);
|
|
496
|
-
if (folders.length > 1) {
|
|
497
|
-
savePathSelect = $('<select id="duplicate-form-save-path" class="form-select" data-identifier="duplicateFormSavePath" />');
|
|
498
|
-
for (let i = 0, len = folders.length; i < len; ++i) {
|
|
499
|
-
const option = new Option(folders[i].label, folders[i].value);
|
|
500
|
-
$(savePathSelect).append(option);
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
html = '<div class="duplicate-form-modal">'
|
|
505
|
-
+ '<h2 class="h3 form-section-headline">' + TYPO3.lang['formManager.new_form_name'] + '</h2>'
|
|
506
|
-
+ '<div class="form-group">'
|
|
507
|
-
+ '<label class="form-label for="duplicate-form-name">' + TYPO3.lang['formManager.form_name'] + '</label>'
|
|
508
|
-
+ '<div class="form-description">' + TYPO3.lang['formManager.form_name_description'] + '</div>'
|
|
509
|
-
+ '<div class="formengine-field-item t3js-formengine-field-item">'
|
|
510
|
-
+ '<input id="duplicate-form-name" class="form-control has-error" data-identifier="duplicateFormName" />'
|
|
511
|
-
+ '</div>'
|
|
512
|
-
+ '</div>';
|
|
513
|
-
|
|
514
|
-
if (savePathSelect) {
|
|
515
|
-
html += '<div class="form-group">'
|
|
516
|
-
+ '<label class="form-label" for="duplicate-form-save-path">' + TYPO3.lang['formManager.form_save_path'] + '</label>'
|
|
517
|
-
+ '<div class="form-description">' + TYPO3.lang['formManager.form_save_path_description'] + '</div>'
|
|
518
|
-
+ '<div class="formengine-field-item t3js-formengine-field-item">'
|
|
519
|
-
+ $(savePathSelect)[0].outerHTML
|
|
520
|
-
+ '</div>'
|
|
521
|
-
+ '</div>';
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
html += '</div>';
|
|
525
|
-
|
|
526
|
-
slide.html(html);
|
|
527
|
-
$(Identifiers.duplicateFormName, modal).focus();
|
|
528
|
-
|
|
529
|
-
$(Identifiers.duplicateFormName, modal).on('keyup paste', function(e: JQueryEventObject) {
|
|
530
|
-
const $el = $(event.currentTarget);
|
|
531
|
-
if ($el.val().length > 0) {
|
|
532
|
-
$el.removeClass('has-error');
|
|
533
|
-
MultiStepWizard.unlockNextStep();
|
|
534
|
-
MultiStepWizard.set('formName', $el.val());
|
|
535
|
-
if ('code' in e && e.code === 'Enter') {
|
|
536
|
-
MultiStepWizard.triggerStepButton('next');
|
|
537
|
-
}
|
|
538
|
-
} else {
|
|
539
|
-
$el.addClass('has-error');
|
|
540
|
-
MultiStepWizard.lockNextStep();
|
|
541
73
|
}
|
|
542
74
|
});
|
|
543
75
|
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
76
|
+
modalButtons.push({
|
|
77
|
+
text: formManagerLabels.get('formManager.remove_form'),
|
|
78
|
+
active: true,
|
|
79
|
+
btnClass: 'btn-danger',
|
|
80
|
+
name: 'createform',
|
|
81
|
+
trigger: function(e: Event, modal: ModalElement) {
|
|
82
|
+
new AjaxRequest(formManagerApp.getAjaxEndpoint('delete')).post({
|
|
83
|
+
formPersistenceIdentifier: element.dataset.formPersistenceIdentifier,
|
|
84
|
+
}).then(async (response: AjaxResponse): Promise<void> => {
|
|
85
|
+
const data = await response.resolve();
|
|
86
|
+
if (data.status === 'success') {
|
|
87
|
+
document.location = data.url;
|
|
88
|
+
} else {
|
|
89
|
+
Notification.error(data.title, data.message);
|
|
90
|
+
}
|
|
91
|
+
modal.hideModal();
|
|
92
|
+
});
|
|
554
93
|
}
|
|
555
|
-
|
|
556
|
-
slide.html($('<div />', { class: 'text-center' })
|
|
557
|
-
.append(await Icons.getIcon('spinner-circle', Icons.sizes.default, null, null))
|
|
558
|
-
.prop('outerHTML'));
|
|
559
94
|
});
|
|
560
|
-
});
|
|
561
|
-
|
|
562
|
-
/**
|
|
563
|
-
* Wizard step 2
|
|
564
|
-
*/
|
|
565
|
-
MultiStepWizard.addSlide('duplicate-form-step-2', TYPO3.lang['formManager.duplicateFormWizard.step2.title'], '', Severity.notice, TYPO3.lang['formManager.duplicateFormWizard.step2.progressLabel'], async function(slide, settings) {
|
|
566
|
-
const formTemplateIconMarkup = await Icons.getIcon('actions-file-t3d', Icons.sizes.small);
|
|
567
|
-
const formNameIconMarkup = await Icons.getIcon('actions-tag', Icons.sizes.small);
|
|
568
|
-
const formStorageMarkup = await Icons.getIcon('actions-database', Icons.sizes.small);
|
|
569
|
-
|
|
570
|
-
MultiStepWizard.unlockPrevStep();
|
|
571
|
-
MultiStepWizard.unlockNextStep();
|
|
572
|
-
|
|
573
|
-
const modal = MultiStepWizard.setup.$carousel.closest('.modal');
|
|
574
|
-
const nextButton = modal.find('.modal-footer').find('button[name="next"]');
|
|
575
|
-
|
|
576
|
-
const html = '<h5 class="form-section-headline">' + TYPO3.lang['formManager.duplicateFormWizard.step2.check'] + '</h5>'
|
|
577
|
-
+ '<p>' + TYPO3.lang['formManager.newFormWizard.step3.message'] + '</p>'
|
|
578
|
-
+ '<div class="alert alert-notice">'
|
|
579
|
-
+ '<div class="dropdown-table-row">'
|
|
580
|
-
+ '<div class="dropdown-table-column dropdown-table-icon">'
|
|
581
|
-
+ formTemplateIconMarkup
|
|
582
|
-
+ '</div>'
|
|
583
|
-
+ '<div class="dropdown-table-column dropdown-table-title">'
|
|
584
|
-
+ TYPO3.lang['formManager.form_copied']
|
|
585
|
-
+ '</div>'
|
|
586
|
-
+ '<div class="dropdown-table-column dropdown-table-value">'
|
|
587
|
-
+ securityUtility.encodeHtml(settings.confirmationDuplicateFormName)
|
|
588
|
-
+ '</div>'
|
|
589
|
-
+ '</div>'
|
|
590
|
-
+ '<div class="dropdown-table-row">'
|
|
591
|
-
+ '<div class="dropdown-table-column dropdown-table-icon">'
|
|
592
|
-
+ formNameIconMarkup
|
|
593
|
-
+ '</div>'
|
|
594
|
-
+ '<div class="dropdown-table-column dropdown-table-title">'
|
|
595
|
-
+ TYPO3.lang['formManager.form_name']
|
|
596
|
-
+ '</div>'
|
|
597
|
-
+ '<div class="dropdown-table-column dropdown-table-value">'
|
|
598
|
-
+ securityUtility.encodeHtml(settings.formName)
|
|
599
|
-
+ '</div>'
|
|
600
|
-
+ '</div>'
|
|
601
|
-
+ '<div class="dropdown-table-row">'
|
|
602
|
-
+ '<div class="dropdown-table-column dropdown-table-icon">'
|
|
603
|
-
+ formStorageMarkup
|
|
604
|
-
+ '</div>'
|
|
605
|
-
+ '<div class="dropdown-table-column dropdown-table-title">'
|
|
606
|
-
+ TYPO3.lang['formManager.form_save_path']
|
|
607
|
-
+ '</div>'
|
|
608
|
-
+ '<div class="dropdown-table-column dropdown-table-value">'
|
|
609
|
-
+ securityUtility.encodeHtml(settings.confirmationDuplicateFormSavePath)
|
|
610
|
-
+ '</div>'
|
|
611
|
-
+ '</div>'
|
|
612
|
-
+ '</div>'
|
|
613
|
-
+ '</div>';
|
|
614
95
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
slide.html($('<div />', { class: 'text-center' })
|
|
622
|
-
.append(await Icons.getIcon('spinner-circle', Icons.sizes.default, null, null))
|
|
623
|
-
.prop('outerHTML'));
|
|
624
|
-
});
|
|
96
|
+
Modal.show(
|
|
97
|
+
formManagerLabels.get('formManager.remove_form_title'),
|
|
98
|
+
formManagerLabels.get('formManager.remove_form_message', { '0': element.dataset.formName }),
|
|
99
|
+
Severity.error ,
|
|
100
|
+
modalButtons
|
|
101
|
+
);
|
|
625
102
|
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
626
105
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
}
|
|
636
|
-
if (data.status === 'success') {
|
|
637
|
-
document.location = data.url;
|
|
638
|
-
} else {
|
|
639
|
-
Notification.error(TYPO3.lang['formManager.duplicateFormWizard.step3.errorTitle'], TYPO3.lang['formManager.duplicateFormWizard.step3.errorMessage'] + ' ' + data.message);
|
|
640
|
-
}
|
|
641
|
-
MultiStepWizard.dismiss();
|
|
642
|
-
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
643
|
-
const parser = new DOMParser(),
|
|
644
|
-
responseDocument = parser.parseFromString(jqXHR.responseText, 'text/html'),
|
|
645
|
-
responseBody = $(responseDocument.body);
|
|
646
|
-
|
|
647
|
-
Notification.error(textStatus, errorThrown, 2);
|
|
648
|
-
MultiStepWizard.dismiss();
|
|
106
|
+
function duplicateFormSetup(formManagerApp: FormManager): void {
|
|
107
|
+
document.querySelectorAll<HTMLElement>(Identifiers.duplicateFormModalTrigger).forEach((element: HTMLElement): void => {
|
|
108
|
+
element.addEventListener('click', async (e: Event): Promise<void> => {
|
|
109
|
+
e.preventDefault();
|
|
110
|
+
await topLevelModuleImport('@typo3/form/backend/form-wizard/form-wizard.js');
|
|
111
|
+
const duplicateForm = {
|
|
112
|
+
name: element.dataset.formName,
|
|
113
|
+
persistenceIdentifier: element.dataset.formPersistenceIdentifier
|
|
114
|
+
};
|
|
649
115
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
116
|
+
const content = html`
|
|
117
|
+
<typo3-backend-form-wizard
|
|
118
|
+
.formManager="${formManagerApp}"
|
|
119
|
+
.duplicateForm="${duplicateForm}"
|
|
120
|
+
></typo3-backend-form-wizard>
|
|
121
|
+
`;
|
|
122
|
+
Modal.advanced({
|
|
123
|
+
title: formManagerLabels.get('formManager.duplicateFormWizard.step1.title', { '0': element.dataset.formName }),
|
|
124
|
+
content: content,
|
|
125
|
+
severity: SeverityEnum.notice,
|
|
126
|
+
size: Modal.sizes.medium,
|
|
127
|
+
staticBackdrop: true,
|
|
128
|
+
buttons: []
|
|
653
129
|
});
|
|
654
|
-
}).then(function() {
|
|
655
|
-
MultiStepWizard.show();
|
|
656
130
|
});
|
|
657
131
|
});
|
|
658
132
|
}
|
|
659
133
|
|
|
660
134
|
function showReferencesSetup(formManagerApp: FormManager): void {
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
135
|
+
document.querySelectorAll<HTMLElement>(Identifiers.showReferences).forEach((element: HTMLElement): void => {
|
|
136
|
+
element.addEventListener('click', (e: Event): void => {
|
|
137
|
+
e.preventDefault();
|
|
138
|
+
const url = formManagerApp.getAjaxEndpoint('references') + '&formPersistenceIdentifier=' + element.dataset.formPersistenceIdentifier;
|
|
139
|
+
|
|
140
|
+
new AjaxRequest(url).get().then(async (response: AjaxResponse): Promise<void> => {
|
|
141
|
+
const data = await response.resolve();
|
|
142
|
+
let htmlString: string;
|
|
143
|
+
const modalButtons = [];
|
|
144
|
+
|
|
145
|
+
modalButtons.push({
|
|
146
|
+
text: formManagerLabels.get('formManager.cancel'),
|
|
147
|
+
active: true,
|
|
148
|
+
btnClass: 'btn-default',
|
|
149
|
+
name: 'cancel',
|
|
150
|
+
trigger: function(e: Event, modal: ModalElement) {
|
|
151
|
+
modal.hideModal();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
665
154
|
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
155
|
+
const referencesLength = data.references.length;
|
|
156
|
+
const editIconMarkup = await Icons.getIcon('actions-open', Icons.sizes.small);
|
|
157
|
+
|
|
158
|
+
if (referencesLength > 0) {
|
|
159
|
+
htmlString = '<h2 class="h3">' + formManagerLabels.get('formManager.references.headline') + '</h2>'
|
|
160
|
+
+ '<div class="table-fit">'
|
|
161
|
+
+ '<table id="forms" class="table table-striped table-hover">'
|
|
162
|
+
+ '<thead>'
|
|
163
|
+
+ '<tr>'
|
|
164
|
+
+ '<th class="col-icon"></th>'
|
|
165
|
+
+ '<th class="col-recordtitle">' + formManagerLabels.get('formManager.table.field.title') + '</th>'
|
|
166
|
+
+ '<th>' + formManagerLabels.get('formManager.table.field.uid') + '</th>'
|
|
167
|
+
+ '<th class="col-control nowrap"><span class="visually-hidden">' + formManagerLabels.get('formManager.table.field.control') + '</span></th>'
|
|
168
|
+
+ '</tr>'
|
|
169
|
+
+ '</thead>'
|
|
170
|
+
+ '<tbody>';
|
|
171
|
+
|
|
172
|
+
for (let i = 0, len = data.references.length; i < len; ++i) {
|
|
173
|
+
htmlString += '<tr>'
|
|
174
|
+
+ '<td class="col-icon">' + data.references[i].recordIcon + '</td>'
|
|
175
|
+
+ '<td class="col-recordtitle">'
|
|
176
|
+
+ '<a href="' + securityUtility.encodeHtml(data.references[i].recordEditUrl) + '" data-identifier="referenceLink">' + securityUtility.encodeHtml(data.references[i].recordTitle) + '</a>'
|
|
177
|
+
+ '</td>'
|
|
178
|
+
+ '<td>' + securityUtility.encodeHtml(data.references[i].recordUid) + '</td>'
|
|
179
|
+
+ '<td class="col-control">'
|
|
180
|
+
+ '<div class="btn-group" role="group">'
|
|
181
|
+
+ '<a href="' + securityUtility.encodeHtml(data.references[i].recordEditUrl) + '" data-identifier="referenceLink" class="btn btn-default" title="' + formManagerLabels.get('formManager.btn.edit.title') + '">'
|
|
182
|
+
+ editIconMarkup
|
|
183
|
+
+ '</a>'
|
|
184
|
+
+ '</div>'
|
|
185
|
+
+ '</td>'
|
|
186
|
+
+ '</tr>';
|
|
187
|
+
}
|
|
669
188
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
189
|
+
htmlString += '</tbody>'
|
|
190
|
+
+ '</table>'
|
|
191
|
+
+ '</div>';
|
|
192
|
+
} else {
|
|
193
|
+
htmlString = '<div>'
|
|
194
|
+
+ '<h1>' + formManagerLabels.get('formManager.references.title', { '0': securityUtility.encodeHtml(data.formPersistenceIdentifier) }) + '</h1>'
|
|
195
|
+
+ '</div>'
|
|
196
|
+
+ '<div>' + formManagerLabels.get('formManager.no_references') + '</div>';
|
|
677
197
|
}
|
|
678
|
-
});
|
|
679
198
|
|
|
680
|
-
|
|
681
|
-
|
|
199
|
+
const template = document.createElement('template');
|
|
200
|
+
template.innerHTML = htmlString;
|
|
201
|
+
const fragment = template.content;
|
|
682
202
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
+ '<th class="col-recordtitle">' + TYPO3.lang['formManager.table.field.title'] + '</th>'
|
|
691
|
-
+ '<th>' + TYPO3.lang['formManager.table.field.uid'] + '</th>'
|
|
692
|
-
+ '<th class="col-control nowrap"><span class="visually-hidden">' + TYPO3.lang['formManager.table.field._CONTROL_'] + '</span></th>'
|
|
693
|
-
+ '</tr>'
|
|
694
|
-
+ '</thead>'
|
|
695
|
-
+ '<tbody>';
|
|
203
|
+
fragment.querySelectorAll<HTMLAnchorElement>(Identifiers.referenceLink).forEach((link: HTMLAnchorElement): void => {
|
|
204
|
+
link.addEventListener('click', (e: Event): void => {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
Modal.currentModal.hideModal();
|
|
207
|
+
document.location = (e.currentTarget as HTMLAnchorElement).href;
|
|
208
|
+
});
|
|
209
|
+
});
|
|
696
210
|
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
+ '<a href="' + securityUtility.encodeHtml(data.references[i].recordEditUrl) + '" data-identifier="referenceLink" class="btn btn-default" title="' + TYPO3.lang['formManager.btn.edit.title'] + '">'
|
|
707
|
-
+ editIconMarkup
|
|
708
|
-
+ '</a>'
|
|
709
|
-
+ '</div>'
|
|
710
|
-
+ '</td>'
|
|
711
|
-
+ '</tr>';
|
|
211
|
+
Modal.show(
|
|
212
|
+
formManagerLabels.get('formManager.references.title', { '0': element.dataset.formName }),
|
|
213
|
+
fragment,
|
|
214
|
+
Severity.notice,
|
|
215
|
+
modalButtons
|
|
216
|
+
);
|
|
217
|
+
}).catch((error: unknown): void => {
|
|
218
|
+
if (error instanceof AjaxResponse) {
|
|
219
|
+
Notification.error(error.response.statusText, String(error.response.status), 2);
|
|
712
220
|
}
|
|
713
|
-
|
|
714
|
-
html += '</tbody>'
|
|
715
|
-
+ '</table>'
|
|
716
|
-
+ '</div>';
|
|
717
|
-
} else {
|
|
718
|
-
html = '<div>'
|
|
719
|
-
+ '<h1>' + TYPO3.lang['formManager.references.title'].replace('{0}', securityUtility.encodeHtml(data.formPersistenceIdentifier)) + '</h1>'
|
|
720
|
-
+ '</div>'
|
|
721
|
-
+ '<div>' + TYPO3.lang['formManager.no_references'] + '</div>';
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
html = $(html);
|
|
725
|
-
$(Identifiers.referenceLink, html).on('click', function(e) {
|
|
726
|
-
e.preventDefault();
|
|
727
|
-
Modal.currentModal.hideModal();
|
|
728
|
-
document.location = $(e.currentTarget).prop('href');
|
|
729
221
|
});
|
|
730
|
-
|
|
731
|
-
Modal.show(
|
|
732
|
-
TYPO3.lang['formManager.references.title'].replace('{0}', $that.data('formName')),
|
|
733
|
-
html,
|
|
734
|
-
Severity.notice,
|
|
735
|
-
modalButtons
|
|
736
|
-
);
|
|
737
|
-
}).fail(function(jqXHR, textStatus, errorThrown) {
|
|
738
|
-
if (jqXHR.status !== 0) {
|
|
739
|
-
Notification.error(textStatus, errorThrown, 2);
|
|
740
|
-
}
|
|
741
222
|
});
|
|
742
223
|
});
|
|
743
224
|
}
|