From: Alexander Ebert Date: Sat, 18 Aug 2012 10:57:53 +0000 (+0200) Subject: Added highlighting for selected option X-Git-Tag: 2.0.0_Beta_1~959^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6d5d2aa48b7faa0df8db950d806701ed146db9e0;p=GitHub%2FWoltLab%2FWCF.git Added highlighting for selected option --- diff --git a/wcfsetup/install/files/acp/templates/option.tpl b/wcfsetup/install/files/acp/templates/option.tpl index 91b9945332..b6ebc883cf 100644 --- a/wcfsetup/install/files/acp/templates/option.tpl +++ b/wcfsetup/install/files/acp/templates/option.tpl @@ -5,6 +5,17 @@ $(function() { WCF.TabMenu.init(); new WCF.ACP.Options(); + + {if $optionName} + var $option = $('#' + $.wcfEscapeID('{$optionName}')); + new WCF.PeriodicalExecuter(function(pe) { + pe.stop(); + + var $scrollHandler = new WCF.Effect.Scroll(); + $scrollHandler.scrollTo($option, true); + $option.focus(); + }, 200); + {/if} }); //]]> diff --git a/wcfsetup/install/files/lib/acp/form/OptionForm.class.php b/wcfsetup/install/files/lib/acp/form/OptionForm.class.php index e64797b1a3..7c6728ac8b 100644 --- a/wcfsetup/install/files/lib/acp/form/OptionForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/OptionForm.class.php @@ -6,6 +6,7 @@ use wcf\system\exception\IllegalLinkException; use wcf\system\menu\acp\ACPMenu; use wcf\system\WCF; use wcf\system\WCFACP; +use wcf\util\StringUtil; /** * Shows the option edit form. @@ -36,6 +37,12 @@ class OptionForm extends AbstractOptionListForm { */ public $activeTabMenuItem = ''; + /** + * option name for highlighting + * @var string + */ + public $optionName = ''; + /** * the option tree * @var array @@ -58,6 +65,8 @@ class OptionForm extends AbstractOptionListForm { } $this->categoryName = $this->category->categoryName; + if (isset($_GET['optionName'])) $this->optionName = StringUtil::trim($_GET['optionName']); + parent::readParameters(); } @@ -96,6 +105,11 @@ class OptionForm extends AbstractOptionListForm { $this->optionTree = $this->optionHandler->getOptionTree($this->category->categoryName); if (!count($_POST)) { + // not a valid top (level 1 or 2) category + if (!isset($this->optionTree[0])) { + throw new IllegalLinkException(); + } + $this->activeTabMenuItem = $this->optionTree[0]['object']->categoryName; } } @@ -107,9 +121,10 @@ class OptionForm extends AbstractOptionListForm { parent::assignVariables(); WCF::getTPL()->assign(array( + 'activeTabMenuItem' => $this->activeTabMenuItem, 'category' => $this->category, - 'optionTree' => $this->optionTree, - 'activeTabMenuItem' => $this->activeTabMenuItem + 'optionName' => $this->optionName, + 'optionTree' => $this->optionTree )); }