{/if}
<form method="post" action="{if $action == 'add'}{link controller='MenuAdd'}{/link}{else}{link controller='MenuEdit' id=$menuID}{/link}{/if}">
- <div class="section">
- <dl{if $errorField == 'title'} class="formError"{/if}>
- <dt><label for="title">{lang}wcf.global.title{/lang}</label></dt>
- <dd>
- <input type="text" id="title" name="title" value="{$i18nPlainValues['title']}" autofocus class="long">
- {if $errorField == 'title'}
- <small class="innerError">
- {if $errorType == 'empty' || $errorType == 'multilingual'}
- {lang}wcf.global.form.error.{@$errorType}{/lang}
- {else}
- {lang}wcf.acp.menu.title.error.{@$errorType}{/lang}
- {/if}
- </small>
- {/if}
- {include file='multipleLanguageInputJavascript' elementIdentifier='title' forceSelection=false}
- </dd>
- </dl>
-
- {if $action == 'add' || $menu->identifier != 'com.woltlab.wcf.MainMenu'}
- <dl{if $errorField == 'position'} class="formError"{/if}>
- <dt><label for="position">{lang}wcf.acp.box.position{/lang}</label></dt>
+ {if $action == 'edit' && $menu->identifier == 'com.woltlab.wcf.MainMenu'}
+ {* editing the main menu *}
+ <div class="section">
+ <dl{if $errorField == 'title'} class="formError"{/if}>
+ <dt><label for="title">{lang}wcf.global.title{/lang}</label></dt>
<dd>
- <select name="position" id="position">
- {foreach from=$availablePositions item=availablePosition}
- <option value="{@$availablePosition}"{if $availablePosition == $position} selected{/if}>{lang}wcf.acp.box.position.{@$availablePosition}{/lang}</option>
- {/foreach}
- </select>
-
- {if $errorField == 'position'}
+ <input type="text" id="title" name="title" value="{$i18nPlainValues['title']}" autofocus class="long">
+ {if $errorField == 'title'}
<small class="innerError">
- {if $errorType == 'empty'}
- {lang}wcf.global.form.error.empty{/lang}
+ {if $errorType == 'empty' || $errorType == 'multilingual'}
+ {lang}wcf.global.form.error.{@$errorType}{/lang}
{else}
- {lang}wcf.acp.box.position.error.{@$errorType}{/lang}
+ {lang}wcf.acp.menu.title.error.{@$errorType}{/lang}
{/if}
</small>
{/if}
+ {include file='multipleLanguageInputJavascript' elementIdentifier='title' forceSelection=false}
</dd>
</dl>
+ </div>
+ {else}
+ {* anything, but the main menu *}
+ <div class="section tabMenuContainer" data-active="{$activeTabMenuItem}" data-store="activeTabMenuItem" id="pageTabMenuContainer">
+ <nav class="tabMenu">
+ <ul>
+ <li><a href="{@$__wcf->getAnchor('general')}">{lang}wcf.global.form.data{/lang}</a></li>
+ <li><a href="{@$__wcf->getAnchor('pages')}">{lang}wcf.acp.page.list{/lang}</a></li>
+ <li><a href="{@$__wcf->getAnchor('acl')}">{lang}wcf.acl.access{/lang}</a></li>
+
+ {event name='tabMenuTabs'}
+ </ul>
+ </nav>
- <dl>
- <dt><label for="showOrder">{lang}wcf.global.showOrder{/lang}</label></dt>
- <dd>
- <input type="number" id="showOrder" name="showOrder" value="{@$showOrder}" class="tiny" min="0">
- </dd>
- </dl>
-
- <dl{if $errorField == 'cssClassName'} class="formError"{/if}>
- <dt><label for="cssClassName">{lang}wcf.acp.box.cssClassName{/lang}</label></dt>
- <dd>
- <input type="text" id="cssClassName" name="cssClassName" value="{$cssClassName}" class="long">
- {if $errorField == 'cssClassName'}
- <small class="innerError">
- {if $errorType == 'empty'}
- {lang}wcf.global.form.error.empty{/lang}
- {else}
- {lang}wcf.acp.box.cssClassName.error.{@$errorType}{/lang}
+ <div id="general" class="tabMenuContent">
+ <div class="section">
+ <dl{if $errorField == 'title'} class="formError"{/if}>
+ <dt><label for="title">{lang}wcf.global.title{/lang}</label></dt>
+ <dd>
+ <input type="text" id="title" name="title" value="{$i18nPlainValues['title']}" autofocus class="long">
+ {if $errorField == 'title'}
+ <small class="innerError">
+ {if $errorType == 'empty' || $errorType == 'multilingual'}
+ {lang}wcf.global.form.error.{@$errorType}{/lang}
+ {else}
+ {lang}wcf.acp.menu.title.error.{@$errorType}{/lang}
+ {/if}
+ </small>
{/if}
- </small>
- {/if}
- </dd>
- </dl>
+ {include file='multipleLanguageInputJavascript' elementIdentifier='title' forceSelection=false}
+ </dd>
+ </dl>
+
+ <dl{if $errorField == 'position'} class="formError"{/if}>
+ <dt><label for="position">{lang}wcf.acp.box.position{/lang}</label></dt>
+ <dd>
+ <select name="position" id="position">
+ {foreach from=$availablePositions item=availablePosition}
+ <option value="{@$availablePosition}"{if $availablePosition == $position} selected{/if}>{lang}wcf.acp.box.position.{@$availablePosition}{/lang}</option>
+ {/foreach}
+ </select>
+
+ {if $errorField == 'position'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.box.position.error.{@$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+
+ <dl>
+ <dt><label for="showOrder">{lang}wcf.global.showOrder{/lang}</label></dt>
+ <dd>
+ <input type="number" id="showOrder" name="showOrder" value="{@$showOrder}" class="tiny" min="0">
+ </dd>
+ </dl>
+
+ <dl{if $errorField == 'cssClassName'} class="formError"{/if}>
+ <dt><label for="cssClassName">{lang}wcf.acp.box.cssClassName{/lang}</label></dt>
+ <dd>
+ <input type="text" id="cssClassName" name="cssClassName" value="{$cssClassName}" class="long">
+ {if $errorField == 'cssClassName'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.box.cssClassName.error.{@$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ </dd>
+ </dl>
+
+ <dl>
+ <dt></dt>
+ <dd>
+ <label><input type="checkbox" id="showHeader" name="showHeader" value="1"{if $showHeader} checked{/if}> {lang}wcf.acp.box.showHeader{/lang}</label>
+ </dd>
+ </dl>
+ </div>
+ </div>
- <dl>
- <dt></dt>
- <dd>
- <label><input type="checkbox" id="showHeader" name="showHeader" value="1"{if $showHeader} checked{/if}> {lang}wcf.acp.box.showHeader{/lang}</label>
- </dd>
- </dl>
- <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">
- elById('visibleEverywhere').addEventListener('change', function() {
- if (this.checked) {
- elShow(elById('visibilityExceptionHidden'));
- elHide(elById('visibilityExceptionVisible'));
- }
- else {
- elHide(elById('visibilityExceptionHidden'));
- elShow(elById('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>
- <ul class="scrollableCheckboxList">
- {foreach from=$pageNodeList item=pageNode}
- <li{if $pageNode->getDepth() > 1} style="padding-left: {$pageNode->getDepth()*20-20}px"{/if}>
- <label><input type="checkbox" name="pageIDs[]" value="{@$pageNode->pageID}"{if $pageNode->pageID|in_array:$pageIDs} checked{/if}> {$pageNode->name}</label>
- </li>
- {/foreach}
- </ul>
- </dd>
- </dl>
- {/if}
-
- {event name='dataFields'}
- </div>
+ <div id="pages" class="tabMenuContent">
+ <div class="section">
+ <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">
+ elById('visibleEverywhere').addEventListener('change', function() {
+ if (this.checked) {
+ elShow(elById('visibilityExceptionHidden'));
+ elHide(elById('visibilityExceptionVisible'));
+ }
+ else {
+ elHide(elById('visibilityExceptionHidden'));
+ elShow(elById('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>
+ <ul class="scrollableCheckboxList">
+ {foreach from=$pageNodeList item=pageNode}
+ <li{if $pageNode->getDepth() > 1} style="padding-left: {$pageNode->getDepth()*20-20}px"{/if}>
+ <label><input type="checkbox" name="pageIDs[]" value="{@$pageNode->pageID}"{if $pageNode->pageID|in_array:$pageIDs} checked{/if}> {$pageNode->name}</label>
+ </li>
+ {/foreach}
+ </ul>
+ </dd>
+ </dl>
+
+ {event name='dataFields'}
+ </div>
+ </div>
+
+ <div id="acl" class="tabMenuContent">
+ {include file='aclSimple'}
+ </div>
+ </div>
+ {/if}
{event name='sections'}
use wcf\data\menu\MenuEditor;
use wcf\data\page\PageNodeTree;
use wcf\form\AbstractForm;
+use wcf\system\acl\simple\SimpleAclHandler;
use wcf\system\database\util\PreparedStatementConditionBuilder;
use wcf\system\exception\UserInputException;
use wcf\system\language\I18nHandler;
*/
public $pageIDs = [];
+ /**
+ * acl values
+ * @var array
+ */
+ public $aclValues = [];
+
/**
* @inheritDoc
*/
if (isset($_POST['cssClassName'])) $this->cssClassName = StringUtil::trim($_POST['cssClassName']);
if (isset($_POST['showHeader'])) $this->showHeader = intval($_POST['showHeader']);
if (isset($_POST['pageIDs']) && is_array($_POST['pageIDs'])) $this->pageIDs = ArrayUtil::toIntegerArray($_POST['pageIDs']);
+ if (isset($_POST['aclValues']) && is_array($_POST['aclValues'])) $this->aclValues = $_POST['aclValues'];
}
/**
'title' => 'wcf.menu.com.woltlab.wcf.genericMenu'.$menuEditor->menuID
]);
}
+
+ // save acl
+ SimpleAclHandler::getInstance()->setValues('com.woltlab.wcf.box', $menuEditor->getDecoratedObject()->getBox()->boxID, $this->aclValues);
+
$this->saved();
// reset values
- $this->title = '';
+ $this->cssClassName = $this->title = '';
+ $this->position = 'contentTop';
+ $this->showOrder = 0;
+ $this->visibleEverywhere = $this->showHeader = 1;
+ $this->pageIDs = $this->aclValues = [];
// show success message
WCF::getTPL()->assign('success', true);
'showHeader' => $this->showHeader,
'pageIDs' => $this->pageIDs,
'availablePositions' => Box::$availableMenuPositions,
- 'pageNodeList' => (new PageNodeTree())->getNodeList()
+ 'pageNodeList' => (new PageNodeTree())->getNodeList(),
+ 'aclValues' => SimpleAclHandler::getInstance()->getOutputValues($this->aclValues)
]);
}
}