From 78c9053751facddad5b9a44d6ebc8f7bb890b51a Mon Sep 17 00:00:00 2001 From: Marcel Werk Date: Sun, 14 Jul 2013 23:38:20 +0200 Subject: [PATCH] Fixed page menu form --- .../files/acp/templates/pageMenuItemAdd.tpl | 21 +++++++++++++++++++ .../acp/form/PageMenuItemAddForm.class.php | 12 +++++++++-- .../acp/form/PageMenuItemEditForm.class.php | 9 ++++++-- wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 5 files changed, 40 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl b/wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl index e8f3877f26..3a91ab27a7 100644 --- a/wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl +++ b/wcfsetup/install/files/acp/templates/pageMenuItemAdd.tpl @@ -8,6 +8,7 @@ var $isInternalLink = $('input[name=isInternalLink]').filter('[value=1]'); var $menuItemControllerContainer = $('#menuItemControllerContainer'); var $menuItemLinkContainer = $('#menuItemLinkContainer'); + var $menuItemParametersContainer = $('#menuItemParametersContainer'); function handleMenuPosition() { if ($menuPosition.val() === 'header') { @@ -21,10 +22,12 @@ function handleIsInternalLink() { if ($isInternalLink.is(':checked')) { $menuItemControllerContainer.show(); + $menuItemParametersContainer.show(); $menuItemLinkContainer.hide(); } else { $menuItemControllerContainer.hide(); + $menuItemParametersContainer.hide(); $menuItemLinkContainer.show(); } } @@ -130,6 +133,7 @@ {lang}wcf.acp.pageMenu.link{/lang}
+
@@ -153,6 +157,22 @@
+ +
+
diff --git a/wcfsetup/install/files/lib/acp/form/PageMenuItemAddForm.class.php b/wcfsetup/install/files/lib/acp/form/PageMenuItemAddForm.class.php index 1fcdd774a9..57f4c1e4f8 100644 --- a/wcfsetup/install/files/lib/acp/form/PageMenuItemAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PageMenuItemAddForm.class.php @@ -49,6 +49,12 @@ class PageMenuItemAddForm extends AbstractForm { */ public $menuItemController = ''; + /** + * menu item parameters + * @var string + */ + public $menuItemParameters = ''; + /** * menu item link * @var string @@ -127,6 +133,7 @@ class PageMenuItemAddForm extends AbstractForm { if (isset($_POST['isDisabled'])) $this->isDisabled = true; if (isset($_POST['isInternalLink'])) $this->isInternalLink = (bool) $_POST['isInternalLink']; if (isset($_POST['menuItemController'])) $this->menuItemController = StringUtil::trim($_POST['menuItemController']); + if (isset($_POST['menuItemParameters'])) $this->menuItemParameters = StringUtil::trim($_POST['menuItemParameters']); if (isset($_POST['menuPosition'])) $this->menuPosition = StringUtil::trim($_POST['menuPosition']); if (isset($_POST['parentMenuItem'])) $this->parentMenuItem = StringUtil::trim($_POST['parentMenuItem']); if (isset($_POST['showOrder'])) $this->showOrder = intval($_POST['showOrder']); @@ -204,7 +211,7 @@ class PageMenuItemAddForm extends AbstractForm { 'isDisabled' => ($this->isDisabled) ? 1 : 0, 'menuItem' => $this->pageMenuItem, 'menuItemController' => $this->menuItemController, - 'menuItemLink' => $this->menuItemLink, + 'menuItemLink' => ($this->menuItemController ? $this->menuItemParameters : $this->menuItemLink), 'menuPosition' => $this->menuPosition, 'parentMenuItem' => $this->parentMenuItem, 'showOrder' => $this->showOrder @@ -236,7 +243,7 @@ class PageMenuItemAddForm extends AbstractForm { // reset variables $this->isDisabled = $this->isInternalLink = false; $this->menuPosition = 'header'; - $this->menuItemController = $this->menuItemLink = $this->pageMenuItem = $this->parentMenuItem = ''; + $this->menuItemController = $this->menuItemLink = $this->pageMenuItem = $this->parentMenuItem = $this->menuItemParameters = ''; $this->showOrder = 0; I18nHandler::getInstance()->reset(); @@ -261,6 +268,7 @@ class PageMenuItemAddForm extends AbstractForm { 'isDisabled' => $this->isDisabled, 'isInternalLink' => $this->isInternalLink, 'menuItemController' => $this->menuItemController, + 'menuItemParameters' => $this->menuItemParameters, 'menuItemLink' => $this->menuItemLink, 'menuPosition' => $this->menuPosition, 'pageMenuItem' => $this->pageMenuItem, diff --git a/wcfsetup/install/files/lib/acp/form/PageMenuItemEditForm.class.php b/wcfsetup/install/files/lib/acp/form/PageMenuItemEditForm.class.php index fc7bca4896..da2054713c 100644 --- a/wcfsetup/install/files/lib/acp/form/PageMenuItemEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/PageMenuItemEditForm.class.php @@ -71,7 +71,12 @@ class PageMenuItemEditForm extends PageMenuItemAddForm { $this->isDisabled = ($this->menuItem->isDisabled) ? true : false; $this->isInternalLink = ($this->menuItem->menuItemController) ? true : false; $this->menuItemController = $this->menuItem->menuItemController; - $this->menuItemLink = $this->menuItem->menuItemLink; + if ($this->isInternalLink) { + $this->menuItemParameters = $this->menuItem->menuItemLink; + } + else { + $this->menuItemLink = $this->menuItem->menuItemLink; + } $this->menuPosition = $this->menuItem->menuPosition; $this->pageMenuItem = $this->menuItem->menuItem; $this->parentMenuItem = $this->menuItem->parentMenuItem; @@ -102,7 +107,7 @@ class PageMenuItemEditForm extends PageMenuItemAddForm { $this->objectAction = new PageMenuItemAction(array($this->menuItem), 'update', array('data' => array( 'isDisabled' => ($this->isDisabled) ? 1 : 0, 'menuItemController' => $this->menuItemController, - 'menuItemLink' => $this->menuItemLink, + 'menuItemLink' => ($this->menuItemController ? $this->menuItemParameters : $this->menuItemLink), 'parentMenuItem' => ($this->menuPosition == 'header' ? $this->parentMenuItem : ''), 'menuPosition' => $this->menuPosition, 'showOrder' => $this->showOrder diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 616962ef8a..1c91912644 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -949,6 +949,7 @@ + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 0ff102e000..f116304cf3 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -948,6 +948,7 @@ Examples for medium ID detection: + -- 2.20.1