From: Joshua Rüsweg Date: Mon, 16 Oct 2017 19:54:39 +0000 (+0200) Subject: Add sitemap toggling function X-Git-Tag: 3.1.0_Beta_2~35 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=20ae1f504133ef4f9704f8f9d53fc8708a863bb7;p=GitHub%2FWoltLab%2FWCF.git Add sitemap toggling function Closes #2439 --- diff --git a/wcfsetup/install/files/acp/templates/sitemapList.tpl b/wcfsetup/install/files/acp/templates/sitemapList.tpl index 1ee8f5d821..6ac57b31ae 100755 --- a/wcfsetup/install/files/acp/templates/sitemapList.tpl +++ b/wcfsetup/install/files/acp/templates/sitemapList.tpl @@ -1,5 +1,11 @@ {include file='header' pageTitle='wcf.acp.menu.link.maintenance.sitemap'} + +

{lang}wcf.acp.menu.link.maintenance.sitemap{/lang}

@@ -34,7 +40,7 @@ {foreach from=$sitemapObjectTypes item=object} - objectType}{/link}" title="{lang}wcf.acp.sitemap.{if $object->isDisabled}isDisabled{else}enabled{/if}{/lang}" class="jsTooltip"> + objectType}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"> objectType}{/link}">{lang}wcf.acp.sitemap.objectType.{$object->objectType}{/lang} diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_beta1_to_beta2.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_beta1_to_beta2.php index 6c812ed0ce..fd1c1e9bd1 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_beta1_to_beta2.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_beta1_to_beta2.php @@ -35,4 +35,4 @@ foreach ($conditionList->getObjects() as $condition) { } } -ConditionEditor::resetCache(); \ No newline at end of file +ConditionEditor::resetCache(); diff --git a/wcfsetup/install/files/lib/data/object/type/SitemapObjectTypeAction.class.php b/wcfsetup/install/files/lib/data/object/type/SitemapObjectTypeAction.class.php new file mode 100644 index 0000000000..ee029bfb6f --- /dev/null +++ b/wcfsetup/install/files/lib/data/object/type/SitemapObjectTypeAction.class.php @@ -0,0 +1,58 @@ + + * @package WoltLabSuite\Core\Data\Object\Type + * @since 3.1 + * + * @method ObjectType create() + * @method ObjectTypeEditor[] getObjects() + * @method ObjectTypeEditor getSingleObject() + */ +class SitemapObjectTypeAction extends ObjectTypeAction implements IToggleAction { + /** + * @inheritDoc + */ + protected $className = ObjectTypeEditor::class; + + /** + * @inheritDoc + */ + protected $requireACP = ['toggle']; + + /** + * @inheritdoc + */ + public function toggle() { + foreach ($this->getObjects() as $objectEditor) { + $objectEditor->update([ + 'additionalData' => serialize(array_merge($objectEditor->additionalData, ['isDisabled' => !$objectEditor->isDisabled ? 1 : 0])) + ]); + } + } + + /** + * @inheritdoc + */ + public function validateToggle() { + if (empty($this->objects)) { + $this->readObjects(); + } + + WCF::getSession()->checkPermissions(['admin.management.canRebuildData']); + + foreach ($this->getObjects() as $objectEditor) { + if ($objectEditor->definitionID != ObjectTypeCache::getInstance()->getDefinitionByName('com.woltlab.wcf.sitemap.object')->definitionID) { + throw new IllegalLinkException(); + } + } + } +} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 0ea06f4d78..3d4aa59cbc 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1770,7 +1770,6 @@ Als Benachrichtigungs-URL in der Konfiguration der sofortigen Zahlungsbestätigu - worker wcf\system\worker\SitemapRebuildWorker in einer CLI Session aus.]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 6eb6767cc3..037ec80885 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1712,7 +1712,6 @@ When prompted for the notification URL for the instant payment notifications, pl - worker wcf\system\worker\SitemapRebuildWorker in a CLI session.]]>