<script type="text/javascript">
//<![CDATA[
$(function() {
- var $isDisabled = $('#isDisabled');
- var $isLandingPageContainer = $('#isLandingPageContainer');
var $menuPosition = $('#menuPosition');
var $parentMenuItemContainer = $('#parentMenuItemContainer');
var $isInternalLink = $('input[name=isInternalLink]').filter('[value=1]');
function handleMenuPosition() {
if ($menuPosition.val() === 'header') {
$parentMenuItemContainer.show();
-
- if (!$isDisabled.is(':checked')) {
- $isLandingPageContainer.show();
- }
}
else {
$parentMenuItemContainer.hide();
- $isLandingPageContainer.hide();
}
}
}
}
- function handleIsDisabled() {
- if ($isDisabled.is(':checked')) {
- $isLandingPageContainer.hide();
- }
- else {
- $isLandingPageContainer.show();
- }
- }
-
- $isDisabled.change(handleIsDisabled);
$menuPosition.change(handleMenuPosition);
$('input[name=isInternalLink]').change(handleIsInternalLink);
- handleIsDisabled();
handleMenuPosition();
handleIsInternalLink();
});
<label><input type="checkbox" name="isDisabled" id="isDisabled" value="1"{if $isDisabled} checked="checked"{/if} /> <span>{lang}wcf.acp.pageMenu.isDisabled{/lang}</span></label>
</dd>
</dl>
-
- <dl id="isLandingPageContainer">
- <dd>
- <label><input type="checkbox" name="isLandingPage" id="isLandingPage" value="1"{if $isLandingPage} checked="checked"{/if} /> <span>{lang}wcf.acp.pageMenu.isLandingPage{/lang}</span></label>
- <small>{lang}wcf.acp.pageMenu.isLandingPage.description{/lang}</small>
- </dd>
- </dl>
</fieldset>
<div class="formSubmit">
*/
public $isInternalLink = false;
- /**
- * true, if menu item is landing page
- * @var boolean
- */
- public $isLandingPage = false;
-
/**
* menu item controller
* @var string
if (isset($_POST['isDisabled'])) $this->isDisabled = true;
if (isset($_POST['isInternalLink'])) $this->isInternalLink = (bool) $_POST['isInternalLink'];
- if (isset($_POST['isLandingPage'])) $this->isLandingPage = true;
if (isset($_POST['menuItemController'])) $this->menuItemController = StringUtil::trim($_POST['menuItemController']);
if (isset($_POST['menuPosition'])) $this->menuPosition = StringUtil::trim($_POST['menuPosition']);
if (isset($_POST['parentMenuItem'])) $this->parentMenuItem = StringUtil::trim($_POST['parentMenuItem']);
throw new UserInputException('parentMenuItem', 'notValid');
}
}
-
- // validate landing page
- if ($this->isDisabled) {
- $this->isLandingPage = false;
- }
- else if ($this->menuPosition == 'footer' || !empty($this->parentMenuItem)) {
- $this->isLandingPage = false;
- }
}
/**
$this->objectAction = new PageMenuItemAction(array(), 'create', array('data' => array(
'isDisabled' => ($this->isDisabled) ? 1 : 0,
- 'isLandingPage' => ($this->isLandingPage) ? 1 : 0,
'menuItem' => $this->pageMenuItem,
'menuItemController' => $this->menuItemController,
'menuItemLink' => $this->menuItemLink,
WCF::getTPL()->assign('success', true);
// reset variables
- $this->isDisabled = $this->isInternalLink = $this->isLandingPage = false;
+ $this->isDisabled = $this->isInternalLink = false;
$this->menuPosition = 'header';
$this->menuItemController = $this->menuItemLink = $this->pageMenuItem = $this->parentMenuItem = '';
$this->showOrder = 0;
'availableParentMenuItems' => $this->availableParentMenuItems,
'isDisabled' => $this->isDisabled,
'isInternalLink' => $this->isInternalLink,
- 'isLandingPage' => $this->isLandingPage,
'menuItemController' => $this->menuItemController,
'menuItemLink' => $this->menuItemLink,
'menuPosition' => $this->menuPosition,
if (empty($_POST)) {
$this->isDisabled = ($this->menuItem->isDisabled) ? true : false;
$this->isInternalLink = ($this->menuItem->menuItemController) ? true : false;
- $this->isLandingPage = ($this->menuItem->isLandingPage) ? true : false;
$this->menuItemController = $this->menuItem->menuItemController;
$this->menuItemLink = $this->menuItem->menuItemLink;
$this->menuPosition = $this->menuItem->menuPosition;
// save menu item
$this->objectAction = new PageMenuItemAction(array($this->menuItem), 'update', array('data' => array(
'isDisabled' => ($this->isDisabled) ? 1 : 0,
- 'isLandingPage' => ($this->isLandingPage) ? 1 : 0,
'menuItemController' => $this->menuItemController,
'menuItemLink' => $this->menuItemLink,
'parentMenuItem' => ($this->menuItem->menuPosition == 'header' ? $this->parentMenuItem : ''),