From 18c05238e7e792dec7163a782ee68d9a935a1bb2 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 2 Mar 2012 23:18:17 +0100 Subject: [PATCH] Implements full i18n user group names --- wcfsetup/install/files/acp/install.php | 18 ------------------ .../files/lib/data/user/UserAction.class.php | 2 +- .../lib/data/user/group/UserGroup.class.php | 11 +++++++++-- .../builder/UserGroupCacheBuilder.class.php | 1 - .../UserGroupsUserGroupOptionType.class.php | 2 +- wcfsetup/install/lang/de.xml | 12 ++++++------ wcfsetup/install/lang/en.xml | 12 ++++++------ wcfsetup/setup/db/install.sql | 12 ++++++------ 8 files changed, 29 insertions(+), 41 deletions(-) diff --git a/wcfsetup/install/files/acp/install.php b/wcfsetup/install/files/acp/install.php index 1706119b77..c65a57f6f5 100644 --- a/wcfsetup/install/files/acp/install.php +++ b/wcfsetup/install/files/acp/install.php @@ -13,24 +13,6 @@ use wcf\system\WCF; * @package com.woltlab.wcf * @category Community Framework */ -// make group names to language variables -$groupNames = array( - 'Everyone' => WCF::getLanguage()->get('wcf.acp.group.everyone'), - 'Guests' => WCF::getLanguage()->get('wcf.acp.group.guests'), - 'Users' => WCF::getLanguage()->get('wcf.acp.group.users'), - 'Administrators' => WCF::getLanguage()->get('wcf.acp.group.administrators'), - 'Moderators' => WCF::getLanguage()->get('wcf.acp.group.moderators'), - 'Super Moderators' => WCF::getLanguage()->get('wcf.acp.group.superModerators') -); - -$sql = "UPDATE wcf".WCF_N."_user_group - SET groupName = ? - WHERE groupName = ?"; -$statement = WCF::getDB()->prepareStatement($sql); -foreach ($groupNames as $oldValue => $newValue) { - $statement->execute(array($newValue, $oldValue)); -} - // change the priority of the PIP's to "1" $sql = "UPDATE wcf".WCF_N."_package_installation_plugin SET priority = ?"; diff --git a/wcfsetup/install/files/lib/data/user/UserAction.class.php b/wcfsetup/install/files/lib/data/user/UserAction.class.php index b05576f74b..2e0f64cde4 100644 --- a/wcfsetup/install/files/lib/data/user/UserAction.class.php +++ b/wcfsetup/install/files/lib/data/user/UserAction.class.php @@ -181,7 +181,7 @@ class UserAction extends AbstractDatabaseObjectAction { if ($this->parameters['data']['includeUserGroups']) { $accessibleGroups = UserGroup::getAccessibleGroups(); foreach ($accessibleGroups as $group) { - $groupName = WCF::getLanguage()->get($group->groupName); + $groupName = $group->getName(); if (!in_array($groupName, $excludedSearchValues)) { $pos = StringUtil::indexOfIgnoreCase($groupName, $searchString); if ($pos !== false && $pos == 0) { diff --git a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php index feebfd5e8c..82cbca74d3 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php @@ -211,13 +211,20 @@ class UserGroup extends DatabaseObject { return self::isAccessibleGroup(array($this->groupID)); } + /** + * @see wcf\data\user\group\UserGroup::getName() + */ + public function __toString() { + return $this->getName(); + } + /** * Returns the name of this user group. * * @return string */ - public function __tostring() { - return $this->groupName; + public function getName() { + return WCF::getLanguage()->get('wcf.acp.group.group'.$this->groupID); } /** diff --git a/wcfsetup/install/files/lib/system/cache/builder/UserGroupCacheBuilder.class.php b/wcfsetup/install/files/lib/system/cache/builder/UserGroupCacheBuilder.class.php index deae158b70..04fb8b5025 100644 --- a/wcfsetup/install/files/lib/system/cache/builder/UserGroupCacheBuilder.class.php +++ b/wcfsetup/install/files/lib/system/cache/builder/UserGroupCacheBuilder.class.php @@ -21,7 +21,6 @@ class UserGroupCacheBuilder implements ICacheBuilder { // get all user groups $groupList = new UserGroupList(); - $groupList->sqlOrderBy = "user_group.groupName"; $groupList->sqlLimit = 0; $groupList->readObjects(); $groups = $groupList->getObjects(); diff --git a/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php b/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php index 8ef035e35a..ab6bf112e6 100644 --- a/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/user/group/UserGroupsUserGroupOptionType.class.php @@ -31,7 +31,7 @@ class UserGroupsUserGroupOptionType extends AbstractOptionType implements IUserG // generate html $html = '
'; foreach ($groups as $group) { - $html .= ''; + $html .= ''; } return $html.'
'; diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 55417f4854..e24303a46c 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -39,17 +39,17 @@ - - - - - - groupName}“ wirklich löschen?]]> + + + + + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index e62960294d..447dcb856c 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -39,17 +39,17 @@ - - - - - - groupName}"?]]> + + + + + + diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index e8394cafe2..a78f3c67d0 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -859,12 +859,12 @@ ALTER TABLE wcf1_user_to_language ADD FOREIGN KEY (languageID) REFERENCES wcf1_l /**** default inserts ****/ -- default user groups -INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('Everyone', 1); -INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('Guests', 2); -INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('Users', 3); -INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('Administrators', 4); -INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('Moderators', 4); -INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('Super Moderators', 4); +INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('wcf.acp.group.group1', 1); +INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('wcf.acp.group.group2', 2); +INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('wcf.acp.group.group3', 3); +INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('wcf.acp.group.group4', 4); +INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('wcf.acp.group.group5', 4); +INSERT INTO wcf1_user_group (groupName, groupType) VALUES ('wcf.acp.group.group6', 4); -- default user group options INSERT INTO wcf1_user_group_option (optionName, categoryName, optionType, defaultValue, adminDefaultValue, showOrder) VALUES ('admin.general.canUseAcp', 'admin.general', 'boolean', '0', '1', 1); -- 2.20.1