From: Marcel Werk Date: Mon, 3 Jun 2013 18:22:24 +0000 (+0200) Subject: Message sidebar improvements X-Git-Tag: 2.0.0_Beta_3~16 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0f8df25403bbf54180dc11a97e3711076c307d9f;p=GitHub%2FWoltLab%2FWCF.git Message sidebar improvements --- diff --git a/com.woltlab.wcf/template/messageSidebar.tpl b/com.woltlab.wcf/template/messageSidebar.tpl index 2192df9c38..475f48fd70 100644 --- a/com.woltlab.wcf/template/messageSidebar.tpl +++ b/com.woltlab.wcf/template/messageSidebar.tpl @@ -85,7 +85,7 @@ {foreach from=$__sidebarUserOptions item='__sidebarUserOption'} {if $userProfile->getUserOption($__sidebarUserOption)}
{lang}wcf.user.option.{$__sidebarUserOption}{/lang}
- {$userProfile->getUserOption($__sidebarUserOption)} + {@$userProfile->getFormattedUserOption($__sidebarUserOption)} {/if} {/foreach} {/if} diff --git a/wcfsetup/install/files/lib/data/user/UserProfile.class.php b/wcfsetup/install/files/lib/data/user/UserProfile.class.php index da7b8acea5..9fb2b8c9f2 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfile.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfile.class.php @@ -3,6 +3,7 @@ namespace wcf\data\user; use wcf\data\user\avatar\DefaultAvatar; use wcf\data\user\avatar\Gravatar; use wcf\data\user\avatar\UserAvatar; +use wcf\data\user\option\ViewableUserOption; use wcf\data\user\online\UserOnline; use wcf\data\user\rank\UserRank; use wcf\data\DatabaseObjectDecorator; @@ -694,4 +695,20 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider public function getSignature() { return SignatureCache::getInstance()->getSignature($this->getDecoratedObject()); } + + /** + * Returns the formatted value of the user option with the given name. + * + * @param string $name + * @return mixed + */ + public function getFormattedUserOption($name) { + // get value + $value = $this->getUserOption($name); + if (!$value) return ''; + + $option = ViewableUserOption::getUserOption($name); + $option->setOptionValue($this->getDecoratedObject()); + return $option->optionValue; + } } diff --git a/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php b/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php index bed564e892..e2f0e09258 100644 --- a/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php +++ b/wcfsetup/install/files/lib/data/user/option/ViewableUserOption.class.php @@ -2,6 +2,7 @@ namespace wcf\data\user\option; use wcf\data\user\User; use wcf\data\DatabaseObjectDecorator; +use wcf\system\cache\builder\UserOptionCacheBuilder; use wcf\system\exception\SystemException; use wcf\util\ClassUtil; use wcf\util\StringUtil; @@ -28,6 +29,12 @@ class ViewableUserOption extends DatabaseObjectDecorator { */ public static $outputObjects = array(); + /** + * cached user options + * @var array + */ + public static $userOptions = array(); + /** * user option value * @var string @@ -75,4 +82,19 @@ class ViewableUserOption extends DatabaseObjectDecorator { return self::$outputObjects[$this->outputClass]; } + + /** + * Gets user option by name + * + * @param string $name + * @return wcf\data\user\option\ViewableUserOption + */ + public static function getUserOption($name) { + if (!isset(self::$userOptions[$name])) { + $options = UserOptionCacheBuilder::getInstance()->getData(array(), 'options'); + self::$userOptions[$name] = new ViewableUserOption($options[$name]); + } + + return self::$userOptions[$name]; + } } diff --git a/wcfsetup/install/files/lib/system/option/UseroptionsOptionType.class.php b/wcfsetup/install/files/lib/system/option/UseroptionsOptionType.class.php index 3324044661..00416274be 100644 --- a/wcfsetup/install/files/lib/system/option/UseroptionsOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/UseroptionsOptionType.class.php @@ -67,8 +67,7 @@ class UseroptionsOptionType extends AbstractOptionType { $sql = "SELECT optionName FROM wcf".WCF_N."_user_option WHERE categoryName LIKE 'profile%' - AND optionType <> 'boolean' - AND outputClass = ''"; + AND optionType <> 'boolean'"; $statement = WCF::getDB()->prepareStatement($sql); $statement->execute(); while ($row = $statement->fetchArray()) { diff --git a/wcfsetup/install/files/style/message.less b/wcfsetup/install/files/style/message.less index 8e6636525d..2e021c3185 100644 --- a/wcfsetup/install/files/style/message.less +++ b/wcfsetup/install/files/style/message.less @@ -604,11 +604,12 @@ .dataList { > dt { - width: 50%; + width: 45%; } > dd { - margin-left: 53%; + margin-left: 48%; + word-wrap: break-word; } } }