From 57f097e8ca8c127fcecbc3fa78f85e824deb7096 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 24 Mar 2014 19:20:47 +0100 Subject: [PATCH] Adds user inline editor Also adds separate permissions for disabling avatar and signature. --- com.woltlab.wcf/templates/headInclude.tpl | 1 + com.woltlab.wcf/templates/user.tpl | 53 +++- com.woltlab.wcf/userGroupOption.xml | 14 + .../install/files/acp/templates/header.tpl | 1 + .../install/files/acp/templates/userAdd.tpl | 111 ++++---- wcfsetup/install/files/js/WCF.User.js | 269 ++++++++++++++++++ .../files/lib/acp/form/UserAddForm.class.php | 17 +- .../files/lib/acp/form/UserEditForm.class.php | 27 +- .../files/lib/data/user/UserAction.class.php | 142 ++++++++- .../install/files/lib/page/UserPage.class.php | 4 +- wcfsetup/install/lang/de.xml | 15 + wcfsetup/install/lang/en.xml | 15 + 12 files changed, 598 insertions(+), 71 deletions(-) diff --git a/com.woltlab.wcf/templates/headInclude.tpl b/com.woltlab.wcf/templates/headInclude.tpl index 5474143cc7..0432e531a8 100644 --- a/com.woltlab.wcf/templates/headInclude.tpl +++ b/com.woltlab.wcf/templates/headInclude.tpl @@ -124,6 +124,7 @@ 'wcf.global.page.next': '{capture assign=pageNext}{lang}wcf.global.page.next{/lang}{/capture}{@$pageNext|encodeJS}', 'wcf.global.page.previous': '{capture assign=pagePrevious}{lang}wcf.global.page.previous{/lang}{/capture}{@$pagePrevious|encodeJS}', 'wcf.global.pageDirection': '{lang}wcf.global.pageDirection{/lang}', + 'wcf.global.reason': '{lang}wcf.global.reason{/lang}', 'wcf.global.sidebar.hideLeftSidebar': '{lang}wcf.global.sidebar.hideLeftSidebar{/lang}', 'wcf.global.sidebar.hideRightSidebar': '{lang}wcf.global.sidebar.hideRightSidebar{/lang}', 'wcf.global.sidebar.showLeftSidebar': '{lang}wcf.global.sidebar.showLeftSidebar{/lang}', diff --git a/com.woltlab.wcf/templates/user.tpl b/com.woltlab.wcf/templates/user.tpl index 2592ad8e94..a06771db0f 100644 --- a/com.woltlab.wcf/templates/user.tpl +++ b/com.woltlab.wcf/templates/user.tpl @@ -79,6 +79,30 @@ }); {/if} + {if $isAccessible} + WCF.Language.addObject({ + 'wcf.user.ban': '{lang}wcf.user.ban{/lang}', + 'wcf.user.ban.confirmMessage': '{lang}wcf.user.ban.confirmMessage{/lang}', + 'wcf.user.ban.reason.description': '{lang}wcf.user.ban.reason.description{/lang}', + 'wcf.user.unban': '{lang}wcf.user.unban{/lang}', + 'wcf.user.disableAvatar': '{lang}wcf.user.disableAvatar{/lang}', + 'wcf.user.disableAvatar.confirmMessage': '{lang}wcf.user.disableAvatar.confirmMessage{/lang}', + 'wcf.user.disableSignature': '{lang}wcf.user.disableSignature{/lang}', + 'wcf.user.disableSignature.confirmMessage': '{lang}wcf.user.disableSignature.confirmMessage{/lang}', + 'wcf.user.edit': '{lang}wcf.user.edit{/lang}', + 'wcf.user.enableAvatar': '{lang}wcf.user.enableAvatar{/lang}', + 'wcf.user.enableSignature': '{lang}wcf.user.enableSignature{/lang}' + }); + + var $userInlineEditor = new WCF.User.InlineEditor('.userHeadline'); + $userInlineEditor.setPermissions({ + canBanUser: {if $__wcf->session->getPermission('admin.user.canBanUser')}true{else}false{/if}, + canDisableAvatar: {if $__wcf->session->getPermission('admin.user.canDisableAvatar')}true{else}false{/if}, + canDisableSignature: {if $__wcf->session->getPermission('admin.user.canDisableSignature')}true{else}false{/if}, + canEditUser: {if $__wcf->session->getPermission('admin.general.canUseAcp') && $__wcf->session->getPermission('admin.user.canEditUser')}true{else}false{/if} + }); + {/if} + {event name='javascriptInit'} }); //]]> @@ -103,7 +127,20 @@ {include file='header' sidebarOrientation='left'} -
+
session->getPermission('admin.user.canBanUser')} + data-banned="{@$user->banned}" + {/if} + {if $__wcf->session->getPermission('admin.user.canDisableAvatar')} + data-disable-avatar="{@$user->disableAvatar}" + {/if} + {if $__wcf->session->getPermission('admin.user.canDisableSignature')} + data-disable-signature="{@$user->disableSignature}" + {/if} + {/if} +>

{$user->username}{if MODULE_USER_RANK && $user->getUserTitle()} {$user->getUserTitle()}{/if}

@@ -135,8 +172,20 @@ {/hascontent} - {if $user->userID != $__wcf->user->userID}{if $user->isAccessible('canViewEmailAddress')}
  • {elseif $user->isAccessible('canMail') && $__wcf->session->getPermission('user.profile.canMail')}
  • {/if}{/if} + + {if $user->userID != $__wcf->user->userID && $user->isAccessible('canViewEmailAddress')} +
  • {elseif $user->isAccessible('canMail') && $__wcf->session->getPermission('user.profile.canMail')}
  • + {/if} + {event name='buttons'} + + {if $__wcf->session->getPermission('admin.user.canBanUser') || $__wcf->session->getPermission('admin.user.canDisableAvatar') || $__wcf->session->getPermission('admin.user.canDisableSignature') || ($__wcf->session->getPermission('admin.general.canUseAcp') && $__wcf->session->getPermission('admin.user.canEditUser'))} + + {/if}
    diff --git a/com.woltlab.wcf/userGroupOption.xml b/com.woltlab.wcf/userGroupOption.xml index 6f3cd2c05e..e8867ec71d 100644 --- a/com.woltlab.wcf/userGroupOption.xml +++ b/com.woltlab.wcf/userGroupOption.xml @@ -224,12 +224,25 @@ 0 1 + + + +