trackUploadProgress,
} from "WoltLabSuite/Core/Component/File/Helper";
import { clearPreviousErrors } from "WoltLabSuite/Core/Component/File/Upload";
+import { innerError } from "WoltLabSuite/Core/Dom/Util";
type FileId = string;
const fileProcessors = new Map<FileId, FileProcessor>();
deleteButton.classList.add("button", "small");
deleteButton.textContent = getPhrase("wcf.global.button.delete");
deleteButton.addEventListener("click", async () => {
- await deleteFile(element.fileId!);
+ const result = await deleteFile(element.fileId!);
+ if (result.ok) {
+ this.#unregisterFile(element);
+ } else {
+ let container: HTMLElement = element;
+ if (!this.#useBigPreview) {
+ container = container.parentElement!;
+ }
- this.#unregisterFile(element);
+ if (result.error.code === "permission_denied") {
+ innerError(container, getPhrase("wcf.upload.error.delete.permissionDenied"), true);
+ } else {
+ innerError(container, result.error.message ?? getPhrase("wcf.upload.error.delete.unknownError"));
+ }
+ }
});
return deleteButton;
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @since 6.1
*/
-define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSuite/Core/Api/Files/DeleteFile", "WoltLabSuite/Core/Dom/Change/Listener", "WoltLabSuite/Core/Component/File/Helper", "WoltLabSuite/Core/Component/File/Upload"], function (require, exports, tslib_1, Language_1, DeleteFile_1, Listener_1, Helper_1, Upload_1) {
+define(["require", "exports", "tslib", "WoltLabSuite/Core/Language", "WoltLabSuite/Core/Api/Files/DeleteFile", "WoltLabSuite/Core/Dom/Change/Listener", "WoltLabSuite/Core/Component/File/Helper", "WoltLabSuite/Core/Component/File/Upload", "WoltLabSuite/Core/Dom/Util"], function (require, exports, tslib_1, Language_1, DeleteFile_1, Listener_1, Helper_1, Upload_1, Util_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FileProcessor = void 0;
deleteButton.classList.add("button", "small");
deleteButton.textContent = (0, Language_1.getPhrase)("wcf.global.button.delete");
deleteButton.addEventListener("click", async () => {
- await (0, DeleteFile_1.deleteFile)(element.fileId);
- this.#unregisterFile(element);
+ const result = await (0, DeleteFile_1.deleteFile)(element.fileId);
+ if (result.ok) {
+ this.#unregisterFile(element);
+ }
+ else {
+ let container = element;
+ if (!this.#useBigPreview) {
+ container = container.parentElement;
+ }
+ if (result.error.code === "permission_denied") {
+ (0, Util_1.innerError)(container, (0, Language_1.getPhrase)("wcf.upload.error.delete.permissionDenied"), true);
+ }
+ else {
+ (0, Util_1.innerError)(container, result.error.message ?? (0, Language_1.getPhrase)("wcf.upload.error.delete.unknownError"));
+ }
+ }
});
return deleteButton;
}
$event->preload('wcf.upload.error.fileExtensionNotPermitted');
$event->preload('wcf.upload.error.fileSizeTooLarge');
$event->preload('wcf.upload.error.maximumCountReached');
+ $event->preload('wcf.upload.error.delete.permissionDenied');
+ $event->preload('wcf.upload.error.delete.unknownError');
$event->preload('wcf.user.activityPoint');
$event->preload('wcf.user.language');
grid-template-areas:
"file filename"
"file fileSize"
- "file buttons";
+ "file buttons"
+ "file error";
grid-template-columns: 80px auto;
padding: 10px;
}
color: var(--wcfStatusErrorText);
}
+.fileList__item .innerError {
+ grid-area: error;
+}
+
.fileList__item__file {
display: flex;
grid-area: file;
<item name="wcf.upload.error.fileSizeTooLarge"><![CDATA[Die Datei ist zu groß.]]></item>
<item name="wcf.upload.error.maximumCountReached"><![CDATA[Es {plural value=$maximumCount 1='darf nur eine Datei' other='dürfen nur # Dateien'} hochgeladen werden.]]></item>
<item name="wcf.upload.error.adopt"><![CDATA[Die Datei „{$filename}“ kann nicht zugewiesen werden.]]></item>
+ <item name="wcf.upload.error.delete.unknownError"><![CDATA[Beim Löschen der Datei ist ein unbekannter Fehler aufgetreten.]]></item>
+ <item name="wcf.upload.error.delete.permissionDenied"><![CDATA[Die Datei kann nicht gelöscht werden, {if LANGUAGE_USE_INFORMAL_VARIANT}verwende{else}verwenden Sie{/if} stattdessen <b>Ersetzen</b>, um die Datei zu erneuern.]]></item>
</category>
</import>
<delete>
<item name="wcf.upload.error.fileSizeTooLarge"><![CDATA[The file is too large.]]></item>
<item name="wcf.upload.error.maximumCountReached"><![CDATA[{plural value=$maximumCount 1='Only one file' other='Only up to # files'} may be uploaded.]]></item>
<item name="wcf.upload.error.adopt"><![CDATA[The file “{$filename}” cannot be assigned.]]></item>
+ <item name="wcf.upload.error.delete.unknownError"><![CDATA[An unknown error occurred while deleting the file.]]></item>
+ <item name="wcf.upload.error.delete.permissionDenied"><![CDATA[The file cannot be deleted, use <b>Replace</b> instead to renew the file.]]></item>
</category>
</import>
<delete>