Skip to content

Commit 41fb10b

Browse files
committed
1.2.3 Dev 1
- Modified `fromversion` in package.xml to support upgrading from every version - Removed unused update script - Fixed/Removed references to VieCode Shop in Upload.ts - Removed non-functional/obsolete MCRecurringElementsFormDataProcessor - Added dedicated Attachment.ts Signed-off-by: Sascha Greuel <github@1-2.dev>
1 parent c38d91d commit 41fb10b

7 files changed

Lines changed: 56 additions & 173 deletions

File tree

files/acp/update_de.mysterycode.wcf.formBuilder.extension.php

Lines changed: 0 additions & 95 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* Data handler for a wysiwyg attachment form builder field that stores the temporary hash.
3+
*
4+
* @author Matthias Schmidt
5+
* @copyright 2001-2020 WoltLab GmbH
6+
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
7+
* @module MysteryCode/Form/Builder/Field/Field/Wysiwyg/Attachment
8+
* @since 5.2
9+
*/
10+
define(["require", "exports", "tslib", "WoltLabSuite/Core/Form/Builder/Field/Value", "WoltLabSuite/Core/Core"], function (require, exports, tslib_1, Value_1, Core) {
11+
"use strict";
12+
Value_1 = tslib_1.__importDefault(Value_1);
13+
Core = tslib_1.__importStar(Core);
14+
class Attachment extends Value_1.default {
15+
constructor(fieldId) {
16+
super(fieldId + "_tmpHash");
17+
}
18+
}
19+
Core.enableLegacyInheritance(Attachment);
20+
return Attachment;
21+
});

files/js/MysteryCode/Ui/Attachment/Upload.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Ajax", "WoltLabSuite/C
2222
constructor(buttonContainerId, targetId, objectType, objectID, tmpHash, parentObjectID, maxUploads, editorId, options) {
2323
super(buttonContainerId, targetId, Core.extend({
2424
multiple: true,
25-
className: "wcf\\data\\attachment\\VieCodeShopAttachmentAction",
25+
className: "wcf\\data\\attachment\\AttachmentAction",
2626
maxUploads: maxUploads,
2727
singleFileRequests: true,
2828
objectType: objectType,
@@ -216,14 +216,14 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Ajax", "WoltLabSuite/C
216216
})
217217
.then((resizedFile) => {
218218
if (resizedFile.size > file.size) {
219-
console.debug(`[VieCode/Shop/Ui/Attachment/Upload] File size of "${file.name}" increased, uploading untouched image.`);
219+
console.debug(`[MysteryCode/Ui/Attachment/Upload] File size of "${file.name}" increased, uploading untouched image.`);
220220
return file;
221221
}
222222
return resizedFile;
223223
});
224224
})
225225
.catch((error) => {
226-
console.debug(`[VieCode/Shop/Ui/Attachment/Upload] Failed to resize image "${file.name}":`, error);
226+
console.debug(`[MysteryCode/Ui/Attachment/Upload] Failed to resize image "${file.name}":`, error);
227227
return file;
228228
})
229229
.then((file) => {
@@ -318,7 +318,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Ajax", "WoltLabSuite/C
318318
Ajax.apiOnce({
319319
data: {
320320
actionName: "updatePosition",
321-
className: "wcf\\data\\attachment\\VieCodeShopAttachmentAction",
321+
className: "wcf\\data\\attachment\\AttachmentAction",
322322
parameters: {
323323
attachmentIDs: attachmentIDs,
324324
objectID: this._objectID,
@@ -467,8 +467,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Ajax", "WoltLabSuite/C
467467
if (innerError) {
468468
innerError.remove();
469469
}
470-
const result = super._upload(event, file, blob);
471-
return result;
470+
return super._upload(event, file, blob);
472471
}
473472
_createFileElement(file) {
474473
DomUtil.show(this._target);

files/lib/system/form/builder/data/processor/MCRecurringElementsFormDataProcessor.class.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

package.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<packagename language="de"><![CDATA[Form Builder: Erweiterung]]></packagename>
66
<packagedescription><![CDATA[Extension for the form builder API.]]></packagedescription>
77
<packagedescription language="de"><![CDATA[Erweiterung für die Form Builder-API.]]></packagedescription>
8-
<version>1.2.2</version>
9-
<date><![CDATA[2022-07-26]]></date>
8+
<version>1.2.3 Dev 1</version>
9+
<date><![CDATA[2022-07-27]]></date>
1010
<license><![CDATA[Lesser General Public License (LGPL)]]></license>
1111
</packageinformation>
1212

@@ -29,7 +29,7 @@
2929
<instruction type="template" />
3030
</instructions>
3131

32-
<instructions type="update" fromversion="1.*">
32+
<instructions type="update" fromversion="*">
3333
<instruction type="file" />
3434
<instruction type="acpTemplate" />
3535
<instruction type="template" />
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Data handler for a wysiwyg attachment form builder field that stores the temporary hash.
3+
*
4+
* @author Matthias Schmidt
5+
* @copyright 2001-2020 WoltLab GmbH
6+
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
7+
* @module MysteryCode/Form/Builder/Field/Field/Wysiwyg/Attachment
8+
* @since 5.2
9+
*/
10+
11+
import Value from "WoltLabSuite/Core/Form/Builder/Field/Value";
12+
import * as Core from "WoltLabSuite/Core/Core";
13+
14+
class Attachment extends Value {
15+
constructor(fieldId: string) {
16+
super(fieldId + "_tmpHash");
17+
}
18+
}
19+
20+
Core.enableLegacyInheritance(Attachment);
21+
22+
export = Attachment;

ts/MysteryCode/Ui/Attachment/Upload.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class AttachmentUpload extends Upload<AttachmentUploadOptions> implements
5959
Core.extend(
6060
{
6161
multiple: true,
62-
className: "wcf\\data\\attachment\\VieCodeShopAttachmentAction",
62+
className: "wcf\\data\\attachment\\AttachmentAction",
6363
maxUploads: maxUploads,
6464
singleFileRequests: true,
6565
objectType: objectType,
@@ -311,9 +311,7 @@ export class AttachmentUpload extends Upload<AttachmentUploadOptions> implements
311311
.then((resizedFile: File) => {
312312
if (resizedFile.size > file!.size) {
313313
console.debug(
314-
`[VieCode/Shop/Ui/Attachment/Upload] File size of "${
315-
file!.name
316-
}" increased, uploading untouched image.`,
314+
`[MysteryCode/Ui/Attachment/Upload] File size of "${file!.name}" increased, uploading untouched image.`,
317315
);
318316
return file;
319317
}
@@ -322,7 +320,7 @@ export class AttachmentUpload extends Upload<AttachmentUploadOptions> implements
322320
});
323321
})
324322
.catch((error) => {
325-
console.debug(`[VieCode/Shop/Ui/Attachment/Upload] Failed to resize image "${file!.name}":`, error);
323+
console.debug(`[MysteryCode/Ui/Attachment/Upload] Failed to resize image "${file!.name}":`, error);
326324
return file;
327325
})
328326
.then((file) => {
@@ -436,7 +434,7 @@ export class AttachmentUpload extends Upload<AttachmentUploadOptions> implements
436434
Ajax.apiOnce({
437435
data: {
438436
actionName: "updatePosition",
439-
className: "wcf\\data\\attachment\\VieCodeShopAttachmentAction",
437+
className: "wcf\\data\\attachment\\AttachmentAction",
440438
parameters: {
441439
attachmentIDs: attachmentIDs,
442440
objectID: this._objectID,
@@ -622,9 +620,7 @@ export class AttachmentUpload extends Upload<AttachmentUploadOptions> implements
622620
innerError.remove();
623621
}
624622

625-
const result = super._upload(event, file, blob);
626-
627-
return result;
623+
return super._upload(event, file, blob);
628624
}
629625

630626
protected _createFileElement(file: File | FileLikeObject): HTMLElement {

0 commit comments

Comments
 (0)