Commit 1e30ed34 authored by Benjamin Franzke's avatar Benjamin Franzke
Browse files

[TASK] Support FLAG_USE_TOP_WINDOW for ES6 module instructions

Implement top-frame-module loading for ES6 module.
This has been marked as todo in #96510 in order to
be implemented in a separately testable patch.

Migrate EXT:redirect and EXT:install to make use of this.

Resolves: #96610
Related: #96510
Related: #96323
Releases: main
Change-Id: I699a7a39beb788c843e3c8292e29bf3db97e8cd9
parent fc95fe87
Pipeline #22354 failed with stages
in 15 minutes and 19 seconds
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
document.addEventListener('typo3:import-javascript-module', (e: CustomEvent<{ specifier: string; importPromise?: Promise<any>; }>) => {
e.detail.importPromise = import(e.detail.specifier);
});
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
export function topLevelModuleImport(specifier: string): Promise<any> {
const event: CustomEvent<{ specifier: string; importPromise?: Promise<any>; }> = new CustomEvent('typo3:import-javascript-module', {
detail: {
specifier,
importPromise: null
}
});
top.document.dispatchEvent(event);
if (event.detail.importPromise) {
return event.detail.importPromise;
}
return Promise.reject(new Error('Top level did not respond with a promise.'));
}
......@@ -69,8 +69,17 @@ function loadModule(payload: JavaScriptItemPayload): Promise<any> {
if (!(payload.flags & FLAG_USE_TOP_WINDOW)) {
return moduleImporter(payload.name);
} else {
// @todo implement
throw new Error('FLAG_USE_TOP_WINDOW is not yet supported for JavaScript modules');
const event = new CustomEvent<{ specifier: string; importPromise: null|Promise<any>; }>(
'typo3:import-javascript-module',
{
detail: {
specifier: payload.name,
importPromise: null
}
}
);
top.document.dispatchEvent(event);
return event.detail.importPromise || Promise.reject(new Error('Top-level import failed'));
}
}
......
......@@ -15,6 +15,7 @@ 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';
......@@ -32,7 +33,7 @@ class SystemMaintainer extends AbstractInteractableModule {
this.currentModal = currentModal;
const isInIframe = window.location !== window.parent.location;
if (isInIframe) {
top.require(['TYPO3/CMS/Install/chosen.jquery.min'], (): void => {
topLevelModuleImport('TYPO3/CMS/Install/chosen.jquery.min.js').then((): void => {
this.getList();
});
} else {
......
......@@ -18,6 +18,7 @@ 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';
......@@ -52,7 +53,7 @@ class UpgradeDocs extends AbstractInteractableModule {
this.currentModal = currentModal;
const isInIframe = (window.location !== window.parent.location);
if (isInIframe) {
top.require(['TYPO3/CMS/Install/chosen.jquery.min'], (): void => {
topLevelModuleImport('TYPO3/CMS/Install/chosen.jquery.min.js').then((): void => {
this.getContent();
});
} else {
......
......@@ -119,6 +119,7 @@ class BackendController
$this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/InfoWindow.js');
$this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/Viewport/ResizableNavigation.js');
$this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/DebugConsole.js');
$this->pageRenderer->loadJavaScriptModule('TYPO3/CMS/Backend/JavaScriptModuleImportEventHandler.js');
$this->pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_core.xlf');
$this->pageRenderer->addInlineLanguageLabelFile('EXT:core/Resources/Private/Language/locallang_misc.xlf');
......
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
"use strict";document.addEventListener("typo3:import-javascript-module",t=>{t.detail.importPromise=import(t.detail.specifier)});
\ No newline at end of file
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
export function topLevelModuleImport(e){const o=new CustomEvent("typo3:import-javascript-module",{detail:{specifier:e,importPromise:null}});return top.document.dispatchEvent(o),o.detail.importPromise?o.detail.importPromise:Promise.reject(new Error("Top level did not respond with a promise."))}
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
const FLAG_USE_REQUIRE_JS=1,FLAG_USE_IMPORTMAP=2,FLAG_USE_TOP_WINDOW=16,deniedProperties=["__proto__","prototype","constructor"],allowedJavaScriptItemTypes=["assign","invoke","instance"];let useShim=!1;const moduleImporter=e=>useShim?window.importShim(e):import(e).catch(()=>(useShim=!0,moduleImporter(e)));function loadModule(e){if(!e.name)throw new Error("JavaScript module name is required");if(2==(2&e.flags)){if(16&e.flags)throw new Error("FLAG_USE_TOP_WINDOW is not yet supported for JavaScript modules");return moduleImporter(e.name)}if(1==(1&e.flags))return new Promise((t,o)=>{(16==(16&e.flags)?top.window:window).require([e.name],e=>t(e),e=>o(e))});throw new Error("Unknown JavaScript module type")}function executeJavaScriptModuleInstruction(e){if(!e.name)throw new Error("JavaScript module name is required");if(!e.items)return void loadModule(e);const t=e.exportName,o=o=>"string"==typeof t?o[t]:1==(1&e.flags)?o:o.default,r=e.items.filter(e=>allowedJavaScriptItemTypes.includes(e.type)).map(e=>"assign"===e.type?t=>{mergeRecursive(o(t),e.assignments)}:"invoke"===e.type?t=>{const r=o(t);r[e.method].apply(r,e.args)}:"instance"===e.type?t=>{const r=[null].concat(e.args),n=o(t);new(n.bind.apply(n,r))}:e=>{});loadModule(e).then(e=>r.forEach(t=>t.call(null,e)))}function isObjectInstance(e){return e instanceof Object&&!(e instanceof Array)}function mergeRecursive(e,t){Object.keys(t).forEach(o=>{if(-1!==deniedProperties.indexOf(o))throw new Error("Property "+o+" is not allowed");isObjectInstance(t[o])&&void 0!==e[o]?mergeRecursive(e[o],t[o]):Object.assign(e,{[o]:t[o]})})}export class JavaScriptItemProcessor{constructor(){this.invokableNames=["globalAssignment","javaScriptModuleInstruction"]}processItems(e){e.forEach(e=>this.invoke(e.type,e.payload))}invoke(e,t){if(!this.invokableNames.includes(e)||"function"!=typeof this[e])throw new Error('Unknown handler name "'+e+'"');this[e].call(this,t)}globalAssignment(e){mergeRecursive(window,e)}javaScriptModuleInstruction(e){executeJavaScriptModuleInstruction(e)}}
\ No newline at end of file
const FLAG_USE_REQUIRE_JS=1,FLAG_USE_IMPORTMAP=2,FLAG_USE_TOP_WINDOW=16,deniedProperties=["__proto__","prototype","constructor"],allowedJavaScriptItemTypes=["assign","invoke","instance"];let useShim=!1;const moduleImporter=e=>useShim?window.importShim(e):import(e).catch(()=>(useShim=!0,moduleImporter(e)));function loadModule(e){if(!e.name)throw new Error("JavaScript module name is required");if(2==(2&e.flags)){if(16&e.flags){const t=new CustomEvent("typo3:import-javascript-module",{detail:{specifier:e.name,importPromise:null}});return top.document.dispatchEvent(t),t.detail.importPromise||Promise.reject(new Error("Top-level import failed"))}return moduleImporter(e.name)}if(1==(1&e.flags))return new Promise((t,o)=>{(16==(16&e.flags)?top.window:window).require([e.name],e=>t(e),e=>o(e))});throw new Error("Unknown JavaScript module type")}function executeJavaScriptModuleInstruction(e){if(!e.name)throw new Error("JavaScript module name is required");if(!e.items)return void loadModule(e);const t=e.exportName,o=o=>"string"==typeof t?o[t]:1==(1&e.flags)?o:o.default,r=e.items.filter(e=>allowedJavaScriptItemTypes.includes(e.type)).map(e=>"assign"===e.type?t=>{mergeRecursive(o(t),e.assignments)}:"invoke"===e.type?t=>{const r=o(t);r[e.method].apply(r,e.args)}:"instance"===e.type?t=>{const r=[null].concat(e.args),n=o(t);new(n.bind.apply(n,r))}:e=>{});loadModule(e).then(e=>r.forEach(t=>t.call(null,e)))}function isObjectInstance(e){return e instanceof Object&&!(e instanceof Array)}function mergeRecursive(e,t){Object.keys(t).forEach(o=>{if(-1!==deniedProperties.indexOf(o))throw new Error("Property "+o+" is not allowed");isObjectInstance(t[o])&&void 0!==e[o]?mergeRecursive(e[o],t[o]):Object.assign(e,{[o]:t[o]})})}export class JavaScriptItemProcessor{constructor(){this.invokableNames=["globalAssignment","javaScriptModuleInstruction"]}processItems(e){e.forEach(e=>this.invoke(e.type,e.payload))}invoke(e,t){if(!this.invokableNames.includes(e)||"function"!=typeof this[e])throw new Error('Unknown handler name "'+e+'"');this[e].call(this,t)}globalAssignment(e){mergeRecursive(window,e)}javaScriptModuleInstruction(e){executeJavaScriptModuleInstruction(e)}}
\ No newline at end of file
......@@ -10,4 +10,4 @@
*
* 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 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?top.require(["TYPO3/CMS/Install/chosen.jquery.min"],()=>{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
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
......@@ -10,4 +10,4 @@
*
* 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 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?top.require(["TYPO3/CMS/Install/chosen.jquery.min"],()=>{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 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
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
......@@ -10,4 +10,4 @@
*
* 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
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
......@@ -37,7 +37,7 @@ final class DispatchNotificationHook
$javaScriptRenderer = GeneralUtility::makeInstance(PageRenderer::class)->getJavaScriptRenderer();
$javaScriptRenderer->addJavaScriptModuleInstruction(
// Ensures event handler is ready and listening to events
JavaScriptModuleInstruction::forRequireJS('TYPO3/CMS/Redirects/EventHandler')
JavaScriptModuleInstruction::create('TYPO3/CMS/Redirects/EventHandler.js')
->addFlags(JavaScriptModuleInstruction::FLAG_USE_TOP_WINDOW)
->invoke('dispatchCustomEvent', 'typo3:redirects:slugChanged', $params['parameter'])
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment