From 8fbcc7c69e7607406eae938dec20d72538745934 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Sat, 8 Jul 2017 15:37:11 +0200 Subject: [PATCH] Add trophy image upload See #2315 --- com.woltlab.wcf/templates/trophyImage.tpl | 7 + .../install/files/acp/templates/trophyAdd.tpl | 40 ++++- .../files/acp/templates/trophyImage.tpl | 7 + .../files/acp/templates/trophyList.tpl | 6 +- .../WoltLabSuite/Core/Acp/Ui/Trophy/Upload.js | 78 ++++++++++ .../lib/acp/form/TrophyAddForm.class.php | 55 +++++-- .../files/lib/data/trophy/Trophy.class.php | 6 +- .../lib/data/trophy/TrophyAction.class.php | 137 +++++++++++++++++- ...mageUploadFileValidationStrategy.class.php | 52 +++++++ wcfsetup/install/lang/de.xml | 8 +- wcfsetup/install/lang/en.xml | 6 +- 11 files changed, 376 insertions(+), 26 deletions(-) create mode 100644 com.woltlab.wcf/templates/trophyImage.tpl create mode 100644 wcfsetup/install/files/acp/templates/trophyImage.tpl create mode 100644 wcfsetup/install/files/js/WoltLabSuite/Core/Acp/Ui/Trophy/Upload.js create mode 100644 wcfsetup/install/files/lib/system/upload/TrophyImageUploadFileValidationStrategy.class.php diff --git a/com.woltlab.wcf/templates/trophyImage.tpl b/com.woltlab.wcf/templates/trophyImage.tpl new file mode 100644 index 0000000000..38bc00fccb --- /dev/null +++ b/com.woltlab.wcf/templates/trophyImage.tpl @@ -0,0 +1,7 @@ + diff --git a/wcfsetup/install/files/acp/templates/trophyAdd.tpl b/wcfsetup/install/files/acp/templates/trophyAdd.tpl index f5d2604e3d..a0d39ede1f 100644 --- a/wcfsetup/install/files/acp/templates/trophyAdd.tpl +++ b/wcfsetup/install/files/acp/templates/trophyAdd.tpl @@ -11,7 +11,10 @@ 'wcf.style.colorPicker.current': '{lang}wcf.style.colorPicker.current{/lang}', 'wcf.style.colorPicker.button.apply': '{lang}wcf.style.colorPicker.button.apply{/lang}', 'wcf.acp.style.image.error.invalidExtension': '{lang}wcf.acp.style.image.error.invalidExtension{/lang}', - 'wcf.acp.trophy.badge.edit': '{lang}wcf.acp.trophy.badge.edit{/lang}' + 'wcf.acp.trophy.badge.edit': '{lang}wcf.acp.trophy.badge.edit{/lang}', + 'wcf.acp.trophy.imageUpload.error.notSquared': '{lang}wcf.acp.trophy.imageUpload.error.notSquared{/lang}', + 'wcf.acp.trophy.imageUpload.error.tooSmall': '{lang}wcf.acp.trophy.imageUpload.error.tooSmall{/lang}', + 'wcf.acp.trophy.imageUpload.error.noImage': '{lang}wcf.acp.trophy.imageUpload.error.noImage{/lang}' }); elBySel('select[name=type]').addEventListener('change', function () { @@ -129,7 +132,7 @@
-
{lang}wcf.acp.trophy.type{/lang}
+
+
+
+
+ {if $errorField == 'imageUpload'} + + {if $errorType == 'empty'} + {lang}wcf.global.form.error.empty{/lang} + {/if} + + {/if} + {lang}wcf.acp.trophy.type.imageUpload.description{/lang} +
+
+
{if $action == 'add'}{if !$uploadedImageURL|empty}{/if}{else}{if $trophy->type == 2}{/if}{/if}
+
+
+ + +
+