From 46038831a3c362a964afa521b26972213f3d1d24 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 13 Jun 2012 23:25:43 +0200 Subject: [PATCH] Fixed user options not entirely displayed in ACP --- .../install/files/acp/templates/userAdd.tpl | 10 ++++++++-- .../files/lib/acp/form/UserAddForm.class.php | 9 +++++++++ .../files/lib/data/option/Option.class.php | 3 ++- .../lib/data/user/option/UserOption.class.php | 9 +++++++-- .../lib/system/option/OptionHandler.class.php | 17 +++++++++++++++-- .../option/user/UserOptionHandler.class.php | 2 +- 6 files changed, 42 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/userAdd.tpl b/wcfsetup/install/files/acp/templates/userAdd.tpl index 8ae042c6cc..a4d9d01466 100644 --- a/wcfsetup/install/files/acp/templates/userAdd.tpl +++ b/wcfsetup/install/files/acp/templates/userAdd.tpl @@ -157,7 +157,7 @@ {foreach from=$categoryLevel1[categories] item=categoryLevel2}
{lang}wcf.user.option.category.{@$categoryLevel2[object]->categoryName}{/lang} - + {if $categoryLevel2[object]->categoryName == 'settings.general' && $availableLanguages|count > 1}
@@ -186,8 +186,14 @@
{/if} {/if} - + {include file='optionFieldList' options=$categoryLevel2[options] langPrefix='wcf.user.option.'} + + {if $categoryLevel2[categories]|count} + {foreach from=$categoryLevel2[categories] item=categoryLevel3} + {include file='optionFieldList' options=$categoryLevel3[options] langPrefix='wcf.user.option.'} + {/foreach} + {/if}
{/foreach} diff --git a/wcfsetup/install/files/lib/acp/form/UserAddForm.class.php b/wcfsetup/install/files/lib/acp/form/UserAddForm.class.php index eac4470fd1..1d48b08141 100644 --- a/wcfsetup/install/files/lib/acp/form/UserAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserAddForm.class.php @@ -94,6 +94,15 @@ class UserAddForm extends UserOptionListForm { */ public $additionalFields = array(); + /** + * @see wcf\page\IPage::readParameters() + */ + public function readParameters() { + parent::readParameters(); + + $this->optionHandler->overrideVisibility(); + } + /** * @see wcf\form\IForm::readFormParameters() */ diff --git a/wcfsetup/install/files/lib/data/option/Option.class.php b/wcfsetup/install/files/lib/data/option/Option.class.php index 87dbb4cafc..4d15413521 100644 --- a/wcfsetup/install/files/lib/data/option/Option.class.php +++ b/wcfsetup/install/files/lib/data/option/Option.class.php @@ -171,9 +171,10 @@ class Option extends DatabaseObject { /** * Returns true, if option is visible * + * @param boolean $overrideVisibility * @return boolean */ - public function isVisible() { + public function isVisible($overrideVisibility = false) { return !$this->hidden; } } diff --git a/wcfsetup/install/files/lib/data/user/option/UserOption.class.php b/wcfsetup/install/files/lib/data/user/option/UserOption.class.php index cbb507d357..d64431001d 100644 --- a/wcfsetup/install/files/lib/data/user/option/UserOption.class.php +++ b/wcfsetup/install/files/lib/data/user/option/UserOption.class.php @@ -56,12 +56,17 @@ class UserOption extends Option { /** * @see wcf\data\option\Option::isVisible() */ - public function isVisible() { + public function isVisible($overrideVisibility = false) { // check if option is hidden - if (!$this->visible) { + if (!$this->visible || $this->disabled) { return false; } + // ACP visibility override + if ($overrideVisibility) { + return true; + } + // proceed if option is visible for all if ($this->visible & Option::VISIBILITY_GUEST) { $visible = true; diff --git a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php index 96ce23c2e5..a8b725b341 100644 --- a/wcfsetup/install/files/lib/system/option/OptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/OptionHandler.class.php @@ -87,6 +87,12 @@ class OptionHandler implements IOptionHandler { */ public $optionValues = array(); + /** + * visibility override + * @var boolean + */ + public $overrideVisibility = false; + /** * raw option values * @var array @@ -455,7 +461,7 @@ class OptionHandler implements IOptionHandler { * @return boolean */ protected function checkOption(Option $option) { - if ($option->permissions) { + if ($option->permissions && !$this->overrideVisibility) { $hasPermission = false; $permissions = explode(',', $option->permissions); foreach ($permissions as $permission) { @@ -496,6 +502,13 @@ class OptionHandler implements IOptionHandler { * @return boolean */ protected function checkVisibility(Option $option) { - return $option->isVisible(); + return $option->isVisible($this->overrideVisibility); + } + + /** + * Overrides option visibility for administrative purposes. + */ + public function overrideVisibility() { + $this->overrideVisibility = true; } } diff --git a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php index a6fda43f96..c4ffa72a23 100644 --- a/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php +++ b/wcfsetup/install/files/lib/system/option/user/UserOptionHandler.class.php @@ -133,7 +133,7 @@ class UserOptionHandler extends OptionHandler { return false; } - return $option->isVisible(); + return $option->isVisible($this->overrideVisibility); } /** -- 2.20.1