<nav id="mainMenu" class="mainMenu">
<ul>
{foreach from=$__wcf->getPageMenu()->getMenuItems('header') item=menuItem}
- <li{if $__wcf->getPageMenu()->getActiveMenuItem() == $menuItem->menuItem} class="active"{/if}><a href="{$menuItem->getProcessor()->getLink()}">{lang}{$menuItem->menuItem}{/lang}{if $menuItem->getProcessor()->getNotifications()} <span class="badge badgeUpdate">{#$menuItem->getProcessor()->getNotifications()}</span>{/if}</a></li>
+ <li{if $__wcf->getPageMenu()->getActiveMenuItem() == $menuItem->menuItem} class="active"{/if}><a href="{$menuItem->getProcessor()->getLink()}"{if $menuItem->newWindow} target="_blank"{/if}>{lang}{$menuItem->menuItem}{/lang}{if $menuItem->getProcessor()->getNotifications()} <span class="badge badgeUpdate">{#$menuItem->getProcessor()->getNotifications()}</span>{/if}</a></li>
{/foreach}
</ul>
</nav>
{if $__wcf->getPageMenu()->getMenuItems($menuItem->menuItem)|count > 0 && $__wcf->getPageMenu()->getActiveMenuItem() == $menuItem->menuItem}
<ul class="navigationMenuItems">
{foreach from=$__wcf->getPageMenu()->getMenuItems($menuItem->menuItem) item=subMenuItem}
- <li><a href="{$subMenuItem->getProcessor()->getLink()}"><span>{lang}{$subMenuItem->menuItem}{/lang}</span></a>{if $subMenuItem->getProcessor()->getNotifications()} <span class="badge badgeUpdate">{#$subMenuItem->getProcessor()->getNotifications()}</span>{/if}</li>
+ <li><a href="{$subMenuItem->getProcessor()->getLink()}"{if $menuItem->newWindow} target="_blank"{/if}><span>{lang}{$subMenuItem->menuItem}{/lang}</span></a>{if $subMenuItem->getProcessor()->getNotifications()} <span class="badge badgeUpdate">{#$subMenuItem->getProcessor()->getNotifications()}</span>{/if}</li>
{/foreach}
</ul>
{/if}
var $isLandingPageContainer = $('#isLandingPageContainer');
var $menuPosition = $('#menuPosition');
var $parentMenuItemContainer = $('#parentMenuItemContainer');
+ var $isInternalLink = $('input[name=isInternalLink]').filter('[value=1]');
+ var $menuItemControllerContainer = $('#menuItemControllerContainer');
function handleMenuPosition() {
if ($menuPosition.val() === 'header') {
}
}
+ function handleIsInternalLink() {
+ if ($isInternalLink.is(':checked')) {
+ $menuItemControllerContainer.show();
+ }
+ else {
+ $menuItemControllerContainer.hide();
+ }
+ }
+
function handleIsDisabled() {
if ($isDisabled.is(':checked')) {
$isLandingPageContainer.hide();
$isDisabled.change(handleIsDisabled);
$menuPosition.change(handleMenuPosition);
+ $('input[name=isInternalLink]').change(handleIsInternalLink);
handleIsDisabled();
handleMenuPosition();
+ handleIsInternalLink();
});
//]]>
</script>
{include file='multipleLanguageInputJavascript' elementIdentifier='pageMenuItem' forceSelection=true}
</dd>
</dl>
+ </fieldset>
+
+ <fieldset>
+ <legend>{lang}wcf.acp.pageMenu.link{/lang}</legend>
+
+ <dl>
+ <dd class="floated">
+ <label><input type="radio" name="isInternalLink" value="1"{if $isInternalLink} checked="checked"{/if} /> {lang}wcf.acp.pageMenu.link.internal{/lang}</label>
+ <label><input type="radio" name="isInternalLink" value="0"{if !$isInternalLink} checked="checked"{/if} /> {lang}wcf.acp.pageMenu.link.external{/lang}</label>
+ </dd>
+ </dl>
+
+ <dl id="menuItemControllerContainer"{if $errorField == 'menuItemController'} class="formError"{/if}>
+ <dt><label for="menuItemController">{lang}wcf.acp.pageMenu.menuItemController{/lang}</label></dt>
+ <dd>
+ <input type="text" name="menuItemController" id="menuItemController" value="{$menuItemController}" class="medium" />
+ {if $errorField == 'menuItemController'}
+ <small class="innerError">
+ {if $errorType == 'empty'}
+ {lang}wcf.global.form.error.empty{/lang}
+ {else}
+ {lang}wcf.acp.pageMenu.menuItemController.error.{$errorType}{/lang}
+ {/if}
+ </small>
+ {/if}
+ <small>{lang}wcf.acp.pageMenu.menuItemController.description{/lang}</small>
+ </dd>
+ </dl>
<dl{if $errorField == 'menuItemLink'} class="formError"{/if}>
<dt><label for="menuItemLink">{lang}wcf.acp.pageMenu.menuItemLink{/lang}</label></dt>
<dd>
- <input type="text" name="menuItemLink" id="menuItemLink" value="{$menuItemLink}" class="long" required="required" />
+ <input type="text" name="menuItemLink" id="menuItemLink" value="{$menuItemLink}" class="long" />
{if $errorField == 'menuItemLink'}
<small class="innerError">
{if $errorType == 'empty'}
<dl>
<dt><label for="showOrder">{lang}wcf.acp.pageMenu.showOrder{/lang}</label></dt>
<dd>
- <input type="number" name="showOrder" id="showOrder" value="{@$showOrder}" class="long" min="0" />
+ <input type="number" name="showOrder" id="showOrder" value="{@$showOrder}" class="tiny" min="0" />
</dd>
</dl>
*/
public $isDisabled = false;
+ /**
+ * internal link
+ * @var boolean
+ */
+ public $isInternalLink = false;
+
/**
* true, if menu item is landing page
* @var boolean
*/
public $isLandingPage = false;
+ /**
+ * menu item controller
+ * @var string
+ */
+ public $menuItemController = '';
+
/**
* menu item link
* @var string
if (I18nHandler::getInstance()->isPlainValue('pageMenuItem')) $this->pageMenuItem = I18nHandler::getInstance()->getValue('pageMenuItem');
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['newWindow'])) $this->newWindow = true;
if (isset($_POST['parentMenuItem'])) $this->parentMenuItem = StringUtil::trim($_POST['parentMenuItem']);
throw new UserInputException('menuPosition', 'notValid');
}
- // validate menu item link
- if (!I18nHandler::getInstance()->validateValue('menuItemLink')) {
- throw new UserInputException('menuItemLink');
+ // validate menu item controller
+ if ($this->isInternalLink) {
+ if (empty($this->menuItemController)) {
+ throw new UserInputException('menuItemController');
+ }
+
+ if (!class_exists($this->menuItemController)) {
+ throw new UserInputException('menuItemController', 'notValid');
+ }
+
+ // validate menu item link
+ if (!I18nHandler::getInstance()->validateValue('menuItemLink', false, true)) {
+ throw new UserInputException('menuItemLink');
+ }
+ }
+ else {
+ $this->menuItemController = '';
+
+ // validate menu item link
+ if (!I18nHandler::getInstance()->validateValue('menuItemLink')) {
+ throw new UserInputException('menuItemLink');
+ }
}
// validate page menu item name
'isDisabled' => ($this->isDisabled) ? 1 : 0,
'isLandingPage' => ($this->isLandingPage) ? 1 : 0,
'menuItem' => $this->pageMenuItem,
+ 'menuItemController' => $this->menuItemController,
'menuItemLink' => $this->menuItemLink,
'menuPosition' => $this->menuPosition,
'newWindow' => ($this->newWindow) ? 1 : 0,
WCF::getTPL()->assign('success', true);
// reset variables
- $this->isDisabled = $this->isLandingPage = $this->newWindow = false;
+ $this->isDisabled = $this->isInternalLink = $this->isLandingPage = $this->newWindow = false;
$this->menuPosition = 'header';
- $this->menuItemLink = $this->pageMenuItem = $this->parentMenuItem = '';
+ $this->menuItemController = $this->menuItemLink = $this->pageMenuItem = $this->parentMenuItem = '';
$this->showOrder = 0;
// reload parent menu items
'action' => 'add',
'availableParentMenuItems' => $this->availableParentMenuItems,
'isDisabled' => $this->isDisabled,
+ 'isInternalLink' => $this->isInternalLink,
'isLandingPage' => $this->isLandingPage,
+ 'menuItemController' => $this->menuItemController,
'menuItemLink' => $this->menuItemLink,
'menuPosition' => $this->menuPosition,
'newWindow' => $this->newWindow,
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;
$this->newWindow = ($this->menuItem->newWindow) ? true : false;
$this->pageMenuItem = $this->menuItem->menuItem;
$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,
'newWindow' => ($this->newWindow) ? 1 : 0,
'parentMenuItem' => ($this->menuItem->menuPosition == 'header' ? $this->parentMenuItem : ''),
*/
public function getLink() {
// external link
- if ($this->menuItemController === null) {
+ if (!$this->menuItemController) {
return WCF::getLanguage()->get($this->menuItemLink);
}
<item name="wcf.acp.pageMenu.advanced"><![CDATA[Erweitert]]></item>
<item name="wcf.acp.pageMenu.data"><![CDATA[Allgemein]]></item>
<item name="wcf.acp.pageMenu.delete.sure"><![CDATA[Möchten Sie den Menüpunkt „{$__menuItem}“ und alle Untermenüpunkte wirklich löschen?]]></item>
+ <item name="wcf.acp.pageMenu.edit"><![CDATA[Menüpunkt bearbeiten]]></item>
<item name="wcf.acp.pageMenu.footer"><![CDATA[Fußzeile]]></item>
<item name="wcf.acp.pageMenu.header"><![CDATA[Hauptmenü]]></item>
<item name="wcf.acp.pageMenu.isDisabled"><![CDATA[Menüpunkt deaktivieren]]></item>
<item name="wcf.acp.pageMenu.isLandingPage"><![CDATA[Startseite Ihrer Website]]></item>
<item name="wcf.acp.pageMenu.isLandingPage.description"><![CDATA[Beim direkten Aufruf Ihrer Website wird diese Menüpunkt aufgerufen.]]></item>
+ <item name="wcf.acp.pageMenu.link"><![CDATA[Link]]></item>
+ <item name="wcf.acp.pageMenu.link.external"><![CDATA[Externer Link]]></item>
+ <item name="wcf.acp.pageMenu.link.internal"><![CDATA[Interner Link]]></item>
<item name="wcf.acp.pageMenu.list"><![CDATA[Menüpunkte auflisten]]></item>
+ <item name="wcf.acp.pageMenu.menuItemController"><![CDATA[Controller]]></item>
+ <item name="wcf.acp.pageMenu.menuItemController.description"><![CDATA[Bitte geben Sie den vollständigen Klassennamen inklusive Namespace an, zum Beispiel „wcf\page\DashboardPage“.]]></item>
+ <item name="wcf.acp.pageMenu.menuItemController.error.notValid"><![CDATA[Die angegebene Klasse konnte nicht gefunden werden]]></item>
<item name="wcf.acp.pageMenu.menuItemLink"><![CDATA[Link]]></item>
<item name="wcf.acp.pageMenu.menuPosition"><![CDATA[Position]]></item>
<item name="wcf.acp.pageMenu.menuPosition.footer"><![CDATA[Fußzeile]]></item>