<conditiongroup>general</conditiongroup>
</type>
<!-- /notice conditions -->
- <!-- box conditions -->
- <type>
- <name>com.woltlab.wcf.page</name>
- <definitionname>com.woltlab.wcf.condition.box</definitionname>
- <classname>wcf\system\condition\page\MultiPageCondition</classname>
- <conditionobject>com.woltlab.wcf.page</conditionobject>
- </type>
- <!-- /box conditions -->
<!-- ad locations -->
<type>
<name>com.woltlab.wcf.logo</name>
<type name="com.woltlab.wcf.searchEngineConvertInnoDb">
<definitionname>com.woltlab.wcf.rebuildData</definitionname>
</type>
+ <type name="com.woltlab.wcf.page">
+ <definitionname>com.woltlab.wcf.condition.box</definitionname>
+ </type>
</delete>
</data>
<h2 class="sectionTitle">{lang}wcf.acp.box.conditions.page{/lang}</h2>
</header>
+ <dl>
+ <dt></dt>
+ <dd>
+ <label><input type="checkbox" id="visibleEverywhere" name="visibleEverywhere" value="1"{if $visibleEverywhere} checked{/if}> {lang}wcf.acp.box.visibleEverywhere{/lang}</label>
+ <script data-relocate="true">
+ require([], function() {
+ // visibility toggle
+ var visibilityExceptionHidden = elById('visibilityExceptionHidden');
+ var visibilityExceptionVisible = elById('visibilityExceptionVisible');
+ elById('visibleEverywhere').addEventListener('change', function() {
+ window[this.checked ? 'elShow' : 'elHide'](visibilityExceptionHidden);
+ window[this.checked ? 'elHide' : 'elShow'](visibilityExceptionVisible);
+ });
+ });
+ </script>
+ </dd>
+ </dl>
+
+ <dl>
+ <dt>
+ <span id="visibilityExceptionVisible"{if $visibleEverywhere} style="display: none"{/if}>{lang}wcf.acp.box.visibilityException.visible{/lang}</span>
+ <span id="visibilityExceptionHidden"{if !$visibleEverywhere} style="display: none"{/if}>{lang}wcf.acp.box.visibilityException.hidden{/lang}</span>
+ </dt>
+ <dd>
+ {include file='scrollablePageCheckboxList' pageCheckboxListContainerID='boxVisibilitySettings' pageCheckboxID='pageIDs'}
+ </dd>
+ </dl>
+
{foreach from=$groupedConditionObjectTypes['com.woltlab.wcf.page'] item='pageConditionObjectType'}
{@$pageConditionObjectType->getProcessor()->getHtml()}
{/foreach}
use wcf\system\box\IBoxController;
use wcf\system\box\IConditionBoxController;
use wcf\system\condition\ConditionHandler;
-use wcf\system\condition\page\MultiPageCondition;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\IllegalLinkException;
use wcf\system\exception\UserInputException;
if (isset($_POST['showOrder'])) {
$this->showOrder = \intval($_POST['showOrder']);
}
+ if (isset($_POST['visibleEverywhere'])) {
+ $this->visibleEverywhere = \intval($_POST['visibleEverywhere']);
+ }
if (isset($_POST['cssClassName'])) {
$this->cssClassName = StringUtil::trim($_POST['cssClassName']);
}
if (isset($_POST['isDisabled'])) {
$this->isDisabled = 1;
}
+ if (isset($_POST['pageIDs']) && \is_array($_POST['pageIDs'])) {
+ $this->pageIDs = ArrayUtil::toIntegerArray($_POST['pageIDs']);
+ }
if (isset($_POST['linkType'])) {
$this->linkType = $_POST['linkType'];
}
private function readConditions(): void
{
- $pageConditionObjectTypeID = ObjectTypeCache::getInstance()->getObjectTypeIDByName(
- Box::VISIBILITY_CONDITIONS_OBJECT_TYPE_NAME,
- 'com.woltlab.wcf.page'
- );
-
- $this->pageIDs = $this->visibleEverywhere = null;
foreach ($this->toFlatList($this->groupedConditionObjectTypes) as $objectType) {
$objectType->getProcessor()->readFormParameters();
- if ($objectType->objectTypeID == $pageConditionObjectTypeID) {
- \assert($objectType->getProcessor() instanceof MultiPageCondition);
-
- $data = $objectType->getProcessor()->getData();
- if ($data !== null) {
- $this->pageIDs = $data['pageIDs'];
- $this->visibleEverywhere = $data['pageIDs_reverseLogic'] ? 1 : 0;
- } else {
- $this->pageIDs = [];
- $this->visibleEverywhere = 1;
- }
- }
- }
-
- if ($this->pageIDs === null || $this->visibleEverywhere === null) {
- throw new \LogicException(
- \sprintf(
- "The '%s' condition for the definition '%s' is missing.",
- 'com.woltlab.wcf.page',
- Box::VISIBILITY_CONDITIONS_OBJECT_TYPE_NAME
- )
- );
}
}