{include file='header' pageTitle='wcf.acp.menu.link.maintenance.sitemap'}
+<script data-relocate="true">
+ $(function() {
+ new WCF.Action.Toggle('wcf\\data\\object\\type\\SitemapObjectTypeAction', '.sitemapObjectRow');
+ });
+</script>
+
<header class="contentHeader">
<div class="contentHeaderTitle">
<h1 class="contentTitle">{lang}wcf.acp.menu.link.maintenance.sitemap{/lang}</h1>
{foreach from=$sitemapObjectTypes item=object}
<tr class="sitemapObjectRow">
<td class="columnIcon">
- <a href="{link controller="SitemapEdit"}objectType={$object->objectType}{/link}" title="{lang}wcf.acp.sitemap.{if $object->isDisabled}isDisabled{else}enabled{/if}{/lang}" class="jsTooltip"><span class="icon icon16 fa{if !$object->isDisabled}-check{/if}-square-o"></span></a>
+ <span class="icon icon16 fa-{if !$object->isDisabled}check-{/if}square-o jsToggleButton jsTooltip pointer" title="{lang}wcf.global.button.{if !$object->isDisabled}disable{else}enable{/if}{/lang}" data-object-id="{@$object->objectTypeID}"></span>
<a href="{link controller="SitemapEdit"}objectType={$object->objectType}{/link}" title="{lang}wcf.global.button.edit{/lang}" class="jsTooltip"><span class="icon icon16 fa-pencil"></span></a>
</td>
<td class="columnTitle columnSitemap"><a href="{link controller="SitemapEdit"}objectType={$object->objectType}{/link}">{lang}wcf.acp.sitemap.objectType.{$object->objectType}{/lang}</a></td>
}
}
-ConditionEditor::resetCache();
\ No newline at end of file
+ConditionEditor::resetCache();
--- /dev/null
+<?php
+namespace wcf\data\object\type;
+use wcf\data\IToggleAction;
+use wcf\system\exception\IllegalLinkException;
+use wcf\system\WCF;
+
+/**
+ * Executes sitemap object type-related actions.
+ *
+ * @author Joshua Ruesweg
+ * @copyright 2001-2017 WoltLab GmbH
+ * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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();
+ }
+ }
+ }
+}
<item name="wcf.acp.sitemap.rebuildTime"><![CDATA[Erneuerungszeit]]></item>
<item name="wcf.acp.sitemap.rebuildTime.description"><![CDATA[Die Zeit nachdem die Sitemap erneuert werden soll.]]></item>
<item name="wcf.acp.sitemap.isDisabled"><![CDATA[Sitemap deaktivieren]]></item>
- <item name="wcf.acp.sitemap.enabled"><![CDATA[Sitemap aktiviert]]></item>
<item name="wcf.acp.sitemap.edit"><![CDATA[Sitemap bearbeiten]]></item>
<item name="wcf.acp.sitemap.cliInfo"><![CDATA[Die Sitemap kann auch mittels CLI neu generiert werden. {if LANGUAGE_USE_INFORMAL_VARIANT}Führe{else}Führen Sie{/if} dafür <kbd>worker wcf\system\worker\SitemapRebuildWorker</kbd> in einer CLI Session aus.]]></item>
<item name="wcf.acp.sitemap.objectType.com.woltlab.wcf.sitemap.object.user"><![CDATA[Benutzer]]></item>
<item name="wcf.acp.sitemap.rebuildTime"><![CDATA[Rebuild Time]]></item>
<item name="wcf.acp.sitemap.rebuildTime.description"><![CDATA[The time after the sitemap have to be rebuilt.]]></item>
<item name="wcf.acp.sitemap.isDisabled"><![CDATA[Disable Sitemap]]></item>
- <item name="wcf.acp.sitemap.enabled"><![CDATA[Sitemap enabled]]></item>
<item name="wcf.acp.sitemap.edit"><![CDATA[Edit Sitemap]]></item>
<item name="wcf.acp.sitemap.cliInfo"><![CDATA[You can rebuild the sitemap using CLI. For that, execute <kbd>worker wcf\system\worker\SitemapRebuildWorker</kbd> in a CLI session.]]></item>
<item name="wcf.acp.sitemap.objectType.com.woltlab.wcf.sitemap.object.user"><![CDATA[User]]></item>