From e26331e12ba8eff0e49d85d34b367d438506dd35 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 28 Nov 2017 20:37:26 +0100 Subject: [PATCH] Implemented cover photo upload and deletion See #2484 --- com.woltlab.wcf/templates/user.tpl | 50 +++++++- com.woltlab.wcf/userGroupOption.xml | 7 ++ .../Core/Ui/User/CoverPhoto/Delete.js | 61 +++++++++ .../Core/Ui/User/CoverPhoto/Upload.js | 46 +++++++ .../lib/data/user/UserProfileAction.class.php | 118 +++++++++++++++++- .../photo/DefaultUserCoverPhoto.class.php | 7 ++ .../cover/photo/IUserCoverPhoto.class.php | 4 + .../user/cover/photo/UserCoverPhoto.class.php | 9 ++ ...hotoUploadFileValidationStrategy.class.php | 101 +++++++++++++++ .../install/files/style/ui/userProfile.scss | 2 +- wcfsetup/install/lang/de.xml | 11 ++ wcfsetup/install/lang/en.xml | 11 ++ wcfsetup/setup/db/install.sql | 4 + 13 files changed, 428 insertions(+), 3 deletions(-) create mode 100644 wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/CoverPhoto/Delete.js create mode 100644 wcfsetup/install/files/js/WoltLabSuite/Core/Ui/User/CoverPhoto/Upload.js create mode 100644 wcfsetup/install/files/lib/system/upload/UserCoverPhotoUploadFileValidationStrategy.class.php diff --git a/com.woltlab.wcf/templates/user.tpl b/com.woltlab.wcf/templates/user.tpl index df335ebee2..91ddf303f1 100644 --- a/com.woltlab.wcf/templates/user.tpl +++ b/com.woltlab.wcf/templates/user.tpl @@ -150,7 +150,17 @@ {/if}> {if MODULE_USER_COVER_PHOTO}
- {if $user->userID == $__wcf->user->userID} {lang}wcf.user.coverPhoto.edit{/lang}{/if} + {if $user->userID == $__wcf->user->userID && ($__wcf->getSession()->getPermission('user.profile.coverPhoto.canUploadCoverPhoto') || $user->coverPhotoHash)} + + {/if}
{/if}
@@ -332,4 +342,42 @@

{lang}wcf.user.profile.protected{/lang}

{/if} +{if MODULE_USER_COVER_PHOTO && $user->userID == $__wcf->user->userID} + {if $__wcf->getSession()->getPermission('user.profile.coverPhoto.canUploadCoverPhoto')} +
+ {lang}wcf.user.coverPhoto.description{/lang} + + {if $__wcf->user->disableCoverPhoto} +

{lang}wcf.user.coverPhoto.error.disabled{/lang}

+ {else} +
+ + {* placeholder for the upload button *} +
+ {/if} +
+ + {/if} + +{/if} + {include file='footer'} diff --git a/com.woltlab.wcf/userGroupOption.xml b/com.woltlab.wcf/userGroupOption.xml index d36f53aaa9..f695d11524 100644 --- a/com.woltlab.wcf/userGroupOption.xml +++ b/com.woltlab.wcf/userGroupOption.xml @@ -749,6 +749,13 @@ png 1 1 +