TYPO3 v15 dev-main snapshot ()
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import{MessageUtility as u}from"@typo3/backend/utility/message-utility.js";import f from"@typo3/backend/element-browser.js";import a from"@typo3/core/event/regular-event.js";import m from"@typo3/backend/icons.js";import{FileListActionSelector as g,FileListActionUtility as h,FileListActionEvent as r}from"@typo3/filelist/file-list-actions.js";import y from"@typo3/backend/info-window.js";import w from"@typo3/core/ajax/ajax-request.js";class l{constructor(){this.importSelection=e=>{e.preventDefault();const t=e.target,n=e.detail.checkboxes;if(!n.length)return;const o=[];n.forEach(i=>{if(i.checked){const s=i.closest(g.elementSelector),c=h.getResourceForElement(s);c.type==="file"&&c.uid&&o.unshift(c)}}),o.length&&(m.getIcon("spinner-circle",m.sizes.small,null,null,m.markupIdentifiers.inline).then(i=>{t.classList.add("disabled"),t.innerHTML=i}),l.handleNext(o),new a("message",i=>{if(!u.verifyOrigin(i.origin))throw"Denied message sent by "+i.origin;i.data.actionName==="typo3:foreignRelation:inserted"&&(o.length>0?l.handleNext(o):f.focusOpenerAndClose())}).bindTo(window))},new a(r.primary,e=>{e.preventDefault();const t=e.detail;t.originalAction=r.primary,t.action=r.select,document.dispatchEvent(new CustomEvent(r.select,{detail:t}))}).bindTo(document),new a(r.select,e=>{e.preventDefault();const t=e.detail,n=t.resources[0];n.type==="file"&&l.insertElement(n.name,n.uid,t.originalAction===r.primary),n.type==="folder"&&this.loadContent(n)}).bindTo(document),new a(r.show,e=>{e.preventDefault();const n=e.detail.resources[0];y.showItem("_"+n.type.toUpperCase(),n.identifier)}).bindTo(document),new a("multiRecordSelection:action:import",this.importSelection).bindTo(document)}static insertElement(e,t,n){return f.insertElement("sys_file",String(t),e,String(t),n)}static handleNext(e){if(e.length>0){const t=e.pop();l.insertElement(t.name,Number(t.uid))}}async loadContent(e){if(e.type!=="folder")return;const t=document.location.href+"&contentOnly=1&expandFolder="+e.identifier,o=await(await new w(t).get()).resolve(),i=document.querySelector(".element-browser-main-content .element-browser-body");i.innerHTML=o;const s=document.querySelector("typo3-backend-component-filestorage-browser-tree");if(s){const c=encodeURIComponent(e.identifier),d=s.nodes.find(p=>p.identifier===c);d&&(await s.expandNodeParents(d),s.selectNode(d,!1))}}}var b=new l;export{b as default};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import l from"@typo3/backend/element-browser.js";import r from"@typo3/core/event/regular-event.js";import{FileListActionSelector as a,FileListActionUtility as d,FileListActionEvent as o}from"@typo3/filelist/file-list-actions.js";import u from"@typo3/backend/info-window.js";class c{constructor(){this.importSelection=e=>{e.preventDefault();const t=e.detail.checkboxes;if(!t.length)return;const i=[];t.forEach(n=>{if(n.checked){const m=n.closest(a.elementSelector),s=d.getResourceForElement(m);s.type==="folder"&&s.identifier&&i.unshift(s)}}),i.length&&(i.forEach(function(n){c.insertElement(n.identifier)}),l.focusOpenerAndClose())},new r(o.primary,e=>{e.preventDefault();const t=e.detail;t.originalAction=o.primary,t.action=o.select,document.dispatchEvent(new CustomEvent(o.select,{detail:t}))}).bindTo(document),new r(o.select,e=>{e.preventDefault();const t=e.detail,i=t.resources[0];i.type==="folder"&&c.insertElement(i.identifier,t.originalAction===o.primary)}).bindTo(document),new r(o.show,e=>{e.preventDefault();const i=e.detail.resources[0];u.showItem("_"+i.type.toUpperCase(),i.identifier)}).bindTo(document),new r("multiRecordSelection:action:import",this.importSelection).bindTo(document)}static insertElement(e,t){return l.insertElement("",e,e,e,t)}}var f=new c;export{f as default};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import{SeverityEnum as c}from"@typo3/backend/enum/severity.js";import m from"@typo3/core/event/regular-event.js";import f from"@typo3/core/document-service.js";import p from"@typo3/backend/modal.js";import o from"~labels/backend.alt_doc";class u{constructor(){f.ready().then(()=>{new m("click",(i,e)=>{i.preventDefault();let t=e.dataset.redirectUrl;t=encodeURIComponent(t||top.list_frame.document.location.pathname+top.list_frame.document.location.search);const d=e.dataset.filelistDeleteIdentifier,r=e.dataset.filelistDeleteType,n=e.dataset.filelistDeleteUrl+"&data[delete][0][data]="+encodeURIComponent(d)+"&data[delete][0][redirect]="+t;if(e.dataset.filelistDeleteCheck){const l=p.confirm(e.dataset.title,e.dataset.content,c.warning,[{text:o.get("buttons.confirm.delete_file.no"),active:!0,btnClass:"btn-default",name:"no"},{text:r==="delete_folder"?o.get("buttons.confirm.delete_folder.yes"):o.get("buttons.confirm.delete_file.yes"),btnClass:"btn-warning",name:"yes"}]);l.addEventListener("button.clicked",s=>{const a=s.target.name;a==="no"?l.hideModal():a==="yes"&&(l.hideModal(),top.list_frame.location.href=n)})}else top.list_frame.location.href=n}).delegateTo(document,'[data-filelist-delete="true"]')})}}var b=new u;export{b as default};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import r from"@typo3/core/event/regular-event.js";var a;(function(t){t.primary="typo3:filelist:resource:action:primary",t.primaryContextmenu="typo3:filelist:resource:action:primaryContextmenu",t.show="typo3:filelist:resource:action:show",t.rename="typo3:filelist:resource:action:rename",t.replace="typo3:filelist:resource:action:replace",t.select="typo3:filelist:resource:action:select",t.download="typo3:filelist:resource:action:download",t.updateOnlineMedia="typo3:filelist:resource:action:updateOnlineMedia"})(a||(a={}));var n;(function(t){t.elementSelector="[data-filelist-element]",t.actionSelector="[data-filelist-action]"})(n||(n={}));class o{static createResourceFromContextDataset(e){return{type:e.filecontextType,identifier:e.filecontextIdentifier,name:e.filecontextName,hasPreview:!1,uid:e.filecontextUid?parseInt(e.filecontextUid,10):null,metaUid:e.filecontextMetaUid?parseInt(e.filecontextMetaUid,10):null,url:e.filecontextUid?e.url:null,createdAt:e.filecontextCreatedAt?parseInt(e.filecontextCreatedAt,10):null,size:e.filecontextSize?parseInt(e.filecontextSize,10):null}}static getResourceForElement(e){return{type:e.dataset.filelistType,identifier:e.dataset.filelistIdentifier,name:e.dataset.filelistName,hasPreview:"filelistPreview"in e.dataset&&e.dataset.filelistPreview.trim()==="true",uid:e.dataset.filelistUid?parseInt(e.dataset.filelistUid,10):null,metaUid:e.dataset.filelistMetaUid?parseInt(e.dataset.filelistMetaUid,10):null,url:e.dataset.filelistUrl?e.dataset.filelistUrl:null,createdAt:e.dataset.filelistCreatedAt?parseInt(e.dataset.filelistCreatedAt,10):null,size:e.dataset.filelistSize?parseInt(e.dataset.filelistSize,10):null}}}class d{constructor(){new r("contextmenu",(e,l)=>{e.preventDefault(),e.stopImmediatePropagation();const i=this.getActionDetail(e,l);switch(i.action){case"primary":document.dispatchEvent(new CustomEvent(a.primaryContextmenu,{detail:i}));break;default:break}}).delegateTo(document,n.actionSelector),new r("click",(e,l)=>{e.preventDefault();const i=this.getActionDetail(e,l);switch(i.action){case"primary":document.dispatchEvent(new CustomEvent(a.primary,{detail:i}));break;case"show":document.dispatchEvent(new CustomEvent(a.show,{detail:i}));break;case"select":document.dispatchEvent(new CustomEvent(a.select,{detail:i}));break;case"rename":document.dispatchEvent(new CustomEvent(a.rename,{detail:i}));break;case"replace":document.dispatchEvent(new CustomEvent(a.replace,{detail:i}));break;case"download":document.dispatchEvent(new CustomEvent(a.download,{detail:i}));break;case"updateOnlineMedia":document.dispatchEvent(new CustomEvent(a.updateOnlineMedia,{detail:i}));break;default:break}}).delegateTo(document,n.actionSelector)}getActionDetail(e,l){const i=l.dataset.filelistAction,s=l.closest(n.elementSelector),c=o.getResourceForElement(s);return{event:e,trigger:l,action:i,resources:[c],url:l.dataset.filelistActionUrl??null,originalAction:null}}}var u=new d;export{a as FileListActionEvent,n as FileListActionSelector,o as FileListActionUtility,u as default};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import i from"@typo3/core/event/regular-event.js";import{MultiRecordSelectionSelectors as v}from"@typo3/backend/multi-record-selection.js";import{FileListActionSelector as l,FileListActionUtility as n}from"@typo3/filelist/file-list-actions.js";import{DataTransferTypes as f}from"@typo3/backend/enum/data-transfer-types.js";var c;(function(m){m.transfer="typo3:filelist:resource:dragdrop:transfer"})(c||(c={}));class w{constructor(){this.previewSize=32;const t=l.elementSelector+'[draggable="true"]';new i("dragstart",(e,r)=>{const s=[];let d="",u="";const g=document.querySelectorAll(v.checkboxSelector+":checked");if(g.length)g.forEach(a=>{if(a.checked){const o=a.closest(l.elementSelector);o.dataset.filelistDragdropTransferItem="true";const h=n.getResourceForElement(o);s.push(h),u=o.dataset.filelistName,d=o.dataset.filelistIcon}});else{const a=r.closest(l.elementSelector);a.dataset.filelistDragdropTransferItem="true";const o=n.getResourceForElement(a);s.push(o),u=a.dataset.filelistName,d=a.dataset.filelistIcon}e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(f.falResources,JSON.stringify(s));const p={tooltipIconIdentifier:s.length>1?"apps-clipboard-images":d,tooltipLabel:s.length>1?this.getPreviewLabel(s):u,thumbnails:this.getPreviewItems(s)};e.dataTransfer.setData(f.dragTooltip,JSON.stringify(p))}).delegateTo(document,t),new i("dragover",(e,r)=>{const s=n.getResourceForElement(r);this.isDropAllowedOnResoruce(s)&&(e.dataTransfer.dropEffect="move",e.preventDefault(),r.classList.add("success"))},{capture:!0}).delegateTo(document,t),new i("drop",(e,r)=>{const s={action:"transfer",resources:JSON.parse(e.dataTransfer.getData(f.falResources)??"{}"),target:n.getResourceForElement(r)};top.document.dispatchEvent(new CustomEvent(c.transfer,{detail:s}))},{capture:!0,passive:!0}).delegateTo(document,t),new i("dragend",()=>{this.reset()},{capture:!0,passive:!0}).delegateTo(document,t),new i("dragleave",(e,r)=>{r.classList.remove("success")},{capture:!0,passive:!0}).delegateTo(document,t)}getPreviewItems(t){return t.filter(e=>e.hasPreview).map(e=>{const r=new URL(top.TYPO3.settings.Resource.thumbnailUrl,window.origin);return r.searchParams.set("identifier",e.uid.toString(10)),{src:r.toString(),width:this.previewSize,height:this.previewSize}})}getPreviewLabel(t){const e=t.filter(s=>s.hasPreview),r=t.length-e.length;return r>0?(e.length>0?"+":"")+r.toString():""}reset(){document.querySelectorAll(l.elementSelector).forEach(t=>{delete t.dataset.filelistDragdropTransferItem,t.classList.remove("success")})}isDropAllowedOnResoruce(t){return!("filelistDragdropTransferItem"in document.querySelector(l.elementSelector+'[data-filelist-identifier="'+t.identifier+'"]').dataset)&&t.type==="folder"}}var S=new w;export{c as FileListDragDropEvent,S as default};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import g from"@typo3/core/event/regular-event.js";import{html as h}from"lit";import{FileListActionEvent as w}from"@typo3/filelist/file-list-actions.js";import l from"@typo3/backend/modal.js";import y from"@typo3/core/ajax/ajax-request.js";import d from"@typo3/backend/notification.js";import s from"@typo3/backend/viewport.js";import n from"~labels/core.core";class C{constructor(){new g(w.rename,o=>{const a=o.detail.resources[0],c=l.advanced({title:n.get("file_rename.title"),type:l.types.default,size:l.sizes.small,content:this.composeEditForm(a),buttons:[{text:n.get("file_rename.button.cancel"),btnClass:"btn-default",name:"cancel",trigger:()=>{c.hideModal()}},{text:n.get("file_rename.button.rename"),btnClass:"btn-primary",name:"rename",trigger:()=>{c.querySelector("form")?.requestSubmit()}}],callback:function(i){const f=i.querySelector("form");f.addEventListener("submit",t=>{t.preventDefault();const p=new FormData(t.target),u=Object.fromEntries(p).name.toString();a.name!==u&&new y(TYPO3.settings.ajaxUrls.resource_rename).post({identifier:a.identifier,resourceName:u}).then(async b=>{const r=await b.resolve();if(r.status.length>0&&r.status.forEach(e=>{r.success?d.success(e.title,e.message):d.error(e.title,e.message)}),r.resource?.type==="folder"){const e=s.ContentContainer.getUrl();new URL(e,window.location.origin).searchParams.get("id")===r.origin.identifier?s.ContentContainer.setUrl(e+"&id="+r.resource.identifier):s.ContentContainer.refresh()}else s.ContentContainer.refresh();top.document.dispatchEvent(new CustomEvent("typo3:filestoragetree:refresh")),i.hideModal()})}),i.addEventListener("typo3-modal-shown",()=>{const t=f.querySelector("input");t!==null&&(t.focus(),t.setSelectionRange(0,a.name.lastIndexOf(".")))})}})}).bindTo(document)}composeEditForm(o){const m=o?.type==="folder"?n.get("folder_rename.label"):n.get("file_rename.label");return h`<form><label class=form-label for=rename_target>${m}</label> <input id=rename_target name=name class=form-control value=${o.name} required></form>`}}var v=new C;export{v as default};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import{html as l,nothing as h}from"lit";import{until as v}from"lit/directives/until.js";import p from"@typo3/core/event/regular-event.js";import{FileListActionEvent as y}from"@typo3/filelist/file-list-actions.js";import n from"@typo3/backend/modal.js";import f from"@typo3/core/ajax/ajax-request.js";import"@typo3/core/ajax/ajax-response.js";import u from"@typo3/backend/notification.js";import k from"@typo3/backend/viewport.js";import{FormatUtility as w}from"@typo3/backend/utility/format-utility.js";import{ThumbnailSize as _}from"@typo3/backend/element/thumbnail-element.js";import{topLevelModuleImport as $}from"@typo3/backend/utility/top-level-module-import.js";import a from"~labels/filelist.messages";import F from"~labels/core.common";import L from"~labels/core.core";import b from"~labels/filelist.mod_file_list";class q{constructor(){new p(y.replace,e=>{const t=e.detail.resources[0],m=n.advanced({title:a.get("file_replace.title",[t.name]),type:n.types.default,size:n.sizes.small,content:l`${v(this.loadEditor(t.identifier),l`<typo3-backend-spinner></typo3-backend-spinner>`)}`,buttons:[{text:F.get("cancel"),btnClass:"btn-default",name:"cancel",trigger:()=>{m.hideModal()}},{text:a.get("file_replace.button.replace"),btnClass:"btn-primary",name:"rename",trigger:()=>{m.querySelector("form")?.requestSubmit()}}],callback:function(o){new p("submit",c=>{c.preventDefault();const d=new FormData(c.target);d.set("uid",t.uid.toString()),new f(TYPO3.settings.ajaxUrls.resource_replace).post(d).then(async g=>{const s=await g.resolve();s.status.length>0&&s.status.forEach(r=>{s.success?u.success(r.title,r.message):u.error(r.title,r.message)}),k.ContentContainer.refresh(),o.hideModal()})}).delegateTo(o,"form")}})}).bindTo(document)}async loadEditor(e){const t=await(await new f(TYPO3.settings.ajaxUrls.resource_gather).withQueryArguments({identifier:e}).get()).resolve();return await $("@typo3/backend/element/datetime-element.js"),this.composeEditForm(t)}composeEditForm(e){const i=new URL(top.TYPO3.settings.Resource.thumbnailUrl,window.origin);return i.searchParams.set("identifier",e.uid.toString(10)),l`<div class=file-replace-dialog>${a.get("file_replace.intro",[e.name])}<div class=file-replace-dialog-summary>${e.hasPreview?l`<div class=file-replace-dialog-summary-thumbnail><typo3-backend-thumbnail url=${i} size=${_.large} width=96 keepaspectratio></typo3-backend-thumbnail></div>`:h}<div class=file-replace-dialog-summary-info><dl><dt>${b.get("c_name")}</dt><dd>${e.name}</dd><dt>${b.get("c_size")}</dt><dd>${w.fileSizeAsString(e.size)}</dd><dt>${L.get("labels.crdate")}</dt><dd><typo3-backend-datetime format=datetime datetime=${e.createdAt}></typo3-backend-datetime></dd></dl></div></div><form><div class=form-group><label class=form-label for=file_replace>${a.get("file_replace.new_file.label")}</label> <input id=file_replace type=file class=form-control name=replace_1></div><div class=form-check><input type=checkbox value=1 id=keepFilename name=keepFilename class=form-check-input checked> <label class=form-check-label for=keepFilename>${a.get("file_replace.keepFilename.label",[e.name])}</label></div></form></div>`}}var x=new q;export{x as default};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import{SeverityEnum as g}from"@typo3/backend/enum/severity.js";import d from"@typo3/backend/modal.js";import p from"@typo3/core/ajax/ajax-request.js";import u from"@typo3/core/event/regular-event.js";import h from"@typo3/backend/notification.js";import l from"@typo3/backend/viewport.js";import r from"~labels/filelist.transfer_handler";import{FileListDragDropEvent as v}from"@typo3/filelist/file-list-dragdrop.js";var c;(function(m){m.move="move",m.copy="copy"})(c||(c={}));class y{constructor(){new u(v.transfer,n=>{const e=n.detail,a=e.target,o=e.resources;let i,t;if(e.resources.length===1){const f=e.resources[0];i=r.get("message.transfer_resource.title"),t=r.get("message.transfer_resource.text",[f.name,a.name])}else i=r.get("message.transfer_resources.title"),t=r.get("message.transfer_resources.text",[o.length,a.name]);const s=d.confirm(i,t,g.notice,[{text:r.get("message.button.cancel"),active:!0,btnClass:"btn-default",name:"cancel",trigger:()=>{s.hideModal()}},{text:r.get("message.button.copy"),btnClass:"btn-primary",name:"copy",trigger:()=>{this.transfer(c.copy,o,a),s.hideModal()}},{text:r.get("message.button.move"),btnClass:"btn-primary",name:"move",trigger:()=>{this.transfer(c.move,o,a),s.hideModal()}}])}).bindTo(top.document)}transfer(n,e,a){const o=[];e.forEach(t=>{const s={data:t.identifier,target:a.identifier};o.push(s)});const i={data:{[n]:o}};new p(top.TYPO3.settings.ajaxUrls.file_process).post(i).then(async t=>{const s=await t.resolve();this.handleMessages(s.messages??[]),l.ContentContainer.refresh(),top.document.dispatchEvent(new CustomEvent("typo3:filestoragetree:refresh"))}).catch(async t=>{const s=await t.resolve();this.handleMessages(s.messages??[]),l.ContentContainer.refresh(),top.document.dispatchEvent(new CustomEvent("typo3:filestoragetree:refresh"))})}handleMessages(n){n.forEach(e=>{h.showMessage(e.title||"",e.message||"",e.severity)})}}var b=new y;export{b as default};
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import m from"@typo3/backend/link-browser.js";import c from"@typo3/core/event/regular-event.js";import{FileListActionEvent as r}from"@typo3/filelist/file-list-actions.js";import d from"@typo3/core/ajax/ajax-request.js";import p from"@typo3/backend/info-window.js";import u from"@typo3/backend/notification.js";class w{constructor(){new c(r.primary,e=>{e.preventDefault();const n=e.detail;n.action=r.select,document.dispatchEvent(new CustomEvent(r.select,{detail:n}))}).bindTo(document),new c(r.select,e=>{e.preventDefault();const t=e.detail.resources[0];t.type==="file"&&this.insertLink(t),t.type==="folder"&&this.loadContent(t)}).bindTo(document),new c(r.show,e=>{e.preventDefault();const t=e.detail.resources[0];p.showItem("_"+t.type.toUpperCase(),t.identifier)}).bindTo(document)}insertLink(e){new d(TYPO3.settings.ajaxUrls.link_resource).post({identifier:e.identifier}).then(async t=>{const o=await t.resolve();o.status.forEach(i=>{u.showMessage(i.title,i.message,i.severity)}),o.success&&m.finalizeFunction(o.link)})}async loadContent(e){if(e.type!=="folder")return;const n=document.location.href+"&contentOnly=1&expandFolder="+e.identifier,o=await(await new d(n).get()).resolve(),i=document.querySelector(".element-browser-main-content .element-browser-body");i.innerHTML=o;const s=document.querySelector("typo3-backend-component-filestorage-browser-tree");if(s){const l=encodeURIComponent(e.identifier),a=s.nodes.find(f=>f.identifier===l);a&&(await s.expandNodeParents(a),s.selectNode(a,!1))}}}var y=new w;export{y as default};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import a from"@typo3/backend/link-browser.js";import o from"@typo3/core/event/regular-event.js";import{FileListActionEvent as n}from"@typo3/filelist/file-list-actions.js";import l from"@typo3/backend/info-window.js";import c from"@typo3/core/ajax/ajax-request.js";import d from"@typo3/backend/notification.js";class u{constructor(){new o("click",(e,t)=>{e.preventDefault(),a.finalizeFunction(t.dataset.linkbrowserLink)}).delegateTo(document,"[data-linkbrowser-link]"),new o(n.primary,e=>{e.preventDefault();const t=e.detail;t.action=n.select,document.dispatchEvent(new CustomEvent(n.select,{detail:t}))}).bindTo(document),new o(n.select,e=>{e.preventDefault();const i=e.detail.resources[0];i.type==="folder"&&this.insertLink(i)}).bindTo(document),new o(n.show,e=>{e.preventDefault();const i=e.detail.resources[0];l.showItem("_"+i.type.toUpperCase(),i.identifier)}).bindTo(document)}insertLink(e){new c(TYPO3.settings.ajaxUrls.link_resource).post({identifier:e.identifier}).then(async i=>{const r=await i.resolve();r.status.forEach(s=>{d.showMessage(s.title,s.message,s.severity)}),r.success&&a.finalizeFunction(r.link)})}}var f=new u;export{f as default};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import{SeverityEnum as g}from"@typo3/backend/enum/severity.js";import v from"@typo3/core/ajax/ajax-request.js";import b from"@typo3/backend/modal.js";import h from"@typo3/core/document-service.js";import n from"~labels/filelist.messages";class x{constructor(){h.ready().then(()=>{this.initialize()})}initialize(){const e=document.querySelector(".t3js-submit-file-rename");e!==null&&e.addEventListener("click",this.checkForDuplicate)}checkForDuplicate(e){e.preventDefault();const t=e.currentTarget.form,a=t.querySelector('input[name="data[rename][0][target]"]'),i=t.querySelector('input[name="data[rename][0][destination]"]'),r=t.querySelector('input[name="data[rename][0][conflictMode]"]'),l={fileName:a.value};i!==null&&(l.fileTarget=i.value),new v(TYPO3.settings.ajaxUrls.file_exists).withQueryArguments(l).get({cache:"no-cache"}).then(async u=>{const d=typeof(await u.resolve()).uid<"u",o=a.dataset.original,s=a.value;if(d&&o!==s){const f=n.get("file_rename.exists.description",{0:o,1:s}),c=b.confirm(n.get("file_rename.exists.title"),f,g.warning,[{active:!0,btnClass:"btn-default",name:"cancel",text:n.get("file_rename.actions.cancel")},{btnClass:"btn-primary",name:"rename",text:n.get("file_rename.actions.rename")},{btnClass:"btn-default",name:"replace",text:n.get("file_rename.actions.override")}]);c.addEventListener("button.clicked",p=>{const m=p.target;m.name!=="cancel"&&(r!==null&&(r.value=m.name),t.submit()),c.hideModal()})}else t.submit()})}}var y=new x;export{y as default};
|
||||
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is part of the TYPO3 CMS project.
|
||||
*
|
||||
* It is free software; you can redistribute it and/or modify it under
|
||||
* the terms of the GNU General Public License, either version 2
|
||||
* of the License, or any later version.
|
||||
*
|
||||
* For the full copyright and license information, please read the
|
||||
* LICENSE.txt file that was distributed with this source code.
|
||||
*
|
||||
* The TYPO3 project - inspiring people to share!
|
||||
*/
|
||||
import s from"@typo3/core/event/regular-event.js";import f from"@typo3/core/ajax/ajax-request.js";import{FileListActionEvent as n}from"@typo3/filelist/file-list-actions.js";import m from"@typo3/backend/info-window.js";class p{constructor(){new s(n.primary,e=>{e.preventDefault();const t=e.detail;t.action=n.select,document.dispatchEvent(new CustomEvent(n.select,{detail:t}))}).bindTo(document),new s(n.select,e=>{e.preventDefault();const o=e.detail.resources[0];o.type==="folder"&&this.loadContent(o)}).bindTo(document),new s(n.show,e=>{e.preventDefault();const o=e.detail.resources[0];m.showItem("_"+o.type.toUpperCase(),o.identifier)}).bindTo(document)}async loadContent(e){if(e.type!=="folder")return;const t=document.location.href+"&contentOnly=1&expandFolder="+e.identifier,c=await(await new f(t).get()).resolve(),d=document.querySelector(".element-browser-main-content .element-browser-body");d.innerHTML=c;const r=document.querySelector("typo3-backend-component-filestorage-browser-tree");if(r){const a=encodeURIComponent(e.identifier),i=r.nodes.find(l=>l.identifier===a);i&&(await r.expandNodeParents(i),r.selectNode(i,!1))}}}var u=new p;export{u as default};
|
||||
Reference in New Issue
Block a user