From: Marcel Werk Date: Sat, 24 May 2014 11:11:50 +0000 (+0200) Subject: Moderator/Super-Moderator overhaul X-Git-Tag: 2.1.0_Alpha_1~799 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c3ab3fe06ddfa2e6ec3b4169de47948288bb9ed6;p=GitHub%2FWoltLab%2FWCF.git Moderator/Super-Moderator overhaul --- diff --git a/com.woltlab.wcf/userGroupOption.xml b/com.woltlab.wcf/userGroupOption.xml index 6c107425e2..38a1126a0d 100644 --- a/com.woltlab.wcf/userGroupOption.xml +++ b/com.woltlab.wcf/userGroupOption.xml @@ -553,7 +553,7 @@ png]]> mod.general boolean 0 - 1 + 1 diff --git a/wcfsetup/install/files/acp/post_install.php b/wcfsetup/install/files/acp/post_install.php index 4b30119c53..442713fdd2 100644 --- a/wcfsetup/install/files/acp/post_install.php +++ b/wcfsetup/install/files/acp/post_install.php @@ -24,19 +24,3 @@ $action = new UserProfileAction(array($editor), 'updateUserRank'); $action->executeAction(); $action = new UserProfileAction(array($editor), 'updateUserOnlineMarking'); $action->executeAction(); - -// set default mod permissions -$sql = "INSERT IGNORE INTO wcf".WCF_N."_user_group_option_value - (groupID, optionID, optionValue) - SELECT 5, optionID, 1 - FROM wcf".WCF_N."_user_group_option - WHERE optionName LIKE 'mod.%'"; -$statement = WCF::getDB()->prepareStatement($sql); -$statement->execute(); -$sql = "INSERT IGNORE INTO wcf".WCF_N."_user_group_option_value - (groupID, optionID, optionValue) - SELECT 6, optionID, 1 - FROM wcf".WCF_N."_user_group_option - WHERE optionName LIKE 'mod.%'"; -$statement = WCF::getDB()->prepareStatement($sql); -$statement->execute(); 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 65d4a73cfb..1646868175 100644 --- a/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php +++ b/wcfsetup/install/files/lib/data/user/group/UserGroup.class.php @@ -214,6 +214,18 @@ class UserGroup extends DatabaseObject { return count(array_diff($groupIDs, $accessibleGroupIDs)) == 0 ? true : false; } + /** + * Returns true if the current group is a moderator-group. + * + * @reutn boolean + */ + public function isModGroup() { + // workaround for WCF-Setup + if (!PACKAGE_ID && $this->groupID == 5) return true; + + return $this->getGroupOption('mod.general.canUseModeration'); + } + /** * Loads the group cache. */ diff --git a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php index 81139ec6b8..87385de3d9 100644 --- a/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php +++ b/wcfsetup/install/files/lib/system/package/plugin/UserGroupOptionPackageInstallationPlugin.class.php @@ -38,7 +38,7 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst */ protected function saveOption($option, $categoryName, $existingOptionID = 0) { // default values - $optionName = $optionType = $defaultValue = $adminDefaultValue = $userDefaultValue = $validationPattern = $enableOptions = $permissions = $options = ''; + $optionName = $optionType = $defaultValue = $adminDefaultValue = $modDefaultValue = $userDefaultValue = $validationPattern = $enableOptions = $permissions = $options = ''; $showOrder = null; // get values @@ -46,6 +46,7 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst if (isset($option['optiontype'])) $optionType = $option['optiontype']; if (isset($option['defaultvalue'])) $defaultValue = $option['defaultvalue']; if (isset($option['admindefaultvalue'])) $adminDefaultValue = $option['admindefaultvalue']; + if (isset($option['moddefaultvalue'])) $modDefaultValue = $option['moddefaultvalue']; if (isset($option['userdefaultvalue'])) $userDefaultValue = $option['userdefaultvalue']; if (isset($option['validationpattern'])) $validationPattern = $option['validationpattern']; if (!empty($option['showorder'])) $showOrder = intval($option['showorder']); @@ -97,16 +98,25 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst $groupOptionEditor = UserGroupOptionEditor::create($data); $optionID = $groupOptionEditor->optionID; - $groupIDs = $this->getGroupIDs(); + $this->getGroupIDs(); $values = array(); - foreach ($this->groupIDs['admin'] as $groupID) { - $values[$groupID] = ((isset($option['admindefaultvalue']) && $defaultValue != $adminDefaultValue) ? $adminDefaultValue : $defaultValue); + foreach ($this->groupIDs['all'] as $groupID) { + $values[$groupID] = $defaultValue; } - foreach ($this->groupIDs['registered'] as $groupID) { - $values[$groupID] = ((isset($option['userdefaultvalue']) && $defaultValue != $userDefaultValue) ? $userDefaultValue : $defaultValue); + if (isset($option['userdefaultvalue'])) { + foreach ($this->groupIDs['registered'] as $groupID) { + $values[$groupID] = $userDefaultValue; + } } - foreach ($this->groupIDs['other'] as $groupID) { - $values[$groupID] = $defaultValue; + if (isset($option['moddefaultvalue'])) { + foreach ($this->groupIDs['mod'] as $groupID) { + $values[$groupID] = $modDefaultValue; + } + } + if (isset($option['admindefaultvalue'])) { + foreach ($this->groupIDs['admin'] as $groupID) { + $values[$groupID] = $adminDefaultValue; + } } // save values @@ -135,7 +145,8 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst if ($this->groupIDs === null) { $this->groupIDs = array( 'admin' => array(), - 'other' => array(), + 'mod' => array(), + 'all' => array(), 'registered' => array() ); @@ -145,16 +156,17 @@ class UserGroupOptionPackageInstallationPlugin extends AbstractOptionPackageInst $statement->execute(); while ($row = $statement->fetchArray()) { $group = new UserGroup(null, $row); - if ($group->groupType == UserGroup::EVERYONE || $group->groupType == UserGroup::GUESTS) { - $this->groupIDs['other'][] = $group->groupID; - } - else { + $this->groupIDs['all'][] = $group->groupID; + + if ($group->groupType != UserGroup::EVERYONE && $group->groupType != UserGroup::GUESTS) { + $this->groupIDs['registered'][] = $group->groupID; + + if ($group->isModGroup()) { + $this->groupIDs['mod'][] = $group->groupID; + } if ($group->isAdminGroup()) { $this->groupIDs['admin'][] = $group->groupID; } - else { - $this->groupIDs['registered'][] = $group->groupID; - } } } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 6672c72d4d..189562bdd6 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -236,7 +236,6 @@ - @@ -2805,7 +2804,6 @@ Möchten Sie diese E-Mail-Benachrichtigung in Zukunft nicht mehr erhalten, könn - diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 2666ee3d3c..754e533aa7 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -235,7 +235,6 @@ Examples for medium ID detection: - @@ -2689,7 +2688,6 @@ If you do not want to receive further email notifications for this event, you ca - diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 0745050ef6..62dcdaa39a 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -1599,7 +1599,6 @@ INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (2, 'wcf.acp. INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (3, 'wcf.acp.group.group3', 3); -- Registered Users INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (4, 'wcf.acp.group.group4', 4); -- Administrators INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (5, 'wcf.acp.group.group5', 4); -- Moderators -INSERT INTO wcf1_user_group (groupID, groupName, groupType) VALUES (6, 'wcf.acp.group.group6', 4); -- Super-Moderators -- default user group options INSERT INTO wcf1_user_group_option (optionID, optionName, categoryName, optionType, defaultValue, showOrder) VALUES (1, 'admin.general.canUseAcp', 'admin.general', 'boolean', '0', 1); @@ -1741,17 +1740,15 @@ INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('messageSid -- default priorities UPDATE wcf1_user_group SET priority = 10 WHERE groupID = 3; UPDATE wcf1_user_group SET priority = 1000 WHERE groupID = 4; -UPDATE wcf1_user_group SET priority = 50 WHERE groupID = 5; -UPDATE wcf1_user_group SET priority = 100 WHERE groupID = 6; +UPDATE wcf1_user_group SET priority = 100 WHERE groupID = 5; -- default 'showOnTeamPage' setting -UPDATE wcf1_user_group SET showOnTeamPage = 1 WHERE groupID IN (4, 5, 6); +UPDATE wcf1_user_group SET showOnTeamPage = 1 WHERE groupID IN (4, 5); -- default ranks INSERT INTO wcf1_user_rank (groupID, requiredPoints, rankTitle, cssClassName) VALUES (4, 0, 'wcf.user.rank.administrator', 'blue'), (5, 0, 'wcf.user.rank.moderator', 'blue'), - (6, 0, 'wcf.user.rank.superModerator', 'blue'), (3, 0, 'wcf.user.rank.user0', ''), (3, 300, 'wcf.user.rank.user1', ''), (3, 900, 'wcf.user.rank.user2', ''),