From 1f5f5acf9011763a8b72748219f8275db527387e Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 5 Aug 2006 04:59:37 +0000 Subject: Fixed #271 --- .gitattributes | 2 + HISTORY | 1 + framework/Web/UI/TClientScriptManager.php | 6 ++- .../features/protected/pages/FocusControl.page | 46 ++++++++++++++++++++++ .../features/protected/pages/FocusControl.php | 17 ++++++++ 5 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 tests/FunctionalTests/features/protected/pages/FocusControl.page create mode 100644 tests/FunctionalTests/features/protected/pages/FocusControl.php diff --git a/.gitattributes b/.gitattributes index 59fc1a0d..5ae95ff6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1567,6 +1567,8 @@ tests/FunctionalTests/features/protected/controls/Layout.tpl -text tests/FunctionalTests/features/protected/pages/ColorPicker.page -text tests/FunctionalTests/features/protected/pages/FeatureList.page -text tests/FunctionalTests/features/protected/pages/FeatureList.php -text +tests/FunctionalTests/features/protected/pages/FocusControl.page -text +tests/FunctionalTests/features/protected/pages/FocusControl.php -text tests/FunctionalTests/features/protected/pages/I18N/BasicI18N.page -text tests/FunctionalTests/features/protected/pages/I18N/BasicI18N.php -text tests/FunctionalTests/features/protected/pages/I18N/Home.page -text diff --git a/HISTORY b/HISTORY index 8d3aa63f..f0ff2d4b 100644 --- a/HISTORY +++ b/HISTORY @@ -2,6 +2,7 @@ Version 3.0.3 August 6, 2006 ============================ BUG: Ticket#264 - Typos in some exception throw statements (Knut) BUG: Ticket#268 - THttpResponse.redirect() may fail for some browsers (Qiang) +BUG: Ticket#271 - Page method setFocus doesn't work (Wei) BUG: Ticket#285 - NumberFormat Rounding Bug (Wei) BUG: Ticket#297 - THttpRequest::constructUrl() encoding bug about array GET parameters (Qiang) BUG: Ticket#320 - Typo in calling TDataList::setSelectedItemIndex and a bug in inserting wizard steps (Qiang) diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index 9a83c550..75effa50 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -194,10 +194,12 @@ class TClientScriptManager extends TApplicationComponent */ public function registerFocusControl($target) { - $this->registerPradoScript('prado'); + $this->registerPradoScript('effects'); if($target instanceof TControl) $target=$target->getClientID(); - $this->registerEndScript('prado:focus','Prado.Focus.setFocus("'.TJavaScript::quoteString($target).'");'); + $id = TJavaScript::quoteString($target); + $script = 'new Effect.ScrollTo("'.$id.'"); Prado.Element.focus("'.$id.'");'; + $this->registerEndScript('prado:focus',$script); } /** diff --git a/tests/FunctionalTests/features/protected/pages/FocusControl.page b/tests/FunctionalTests/features/protected/pages/FocusControl.page new file mode 100644 index 00000000..af414c3a --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/FocusControl.page @@ -0,0 +1,46 @@ + + + + + + + + + + + + +

+a + +

+ +

+b + +

+ +

+c + +

+ +

+d +

+ +

+e + +

+ +

+f +

+ +

+g + +

+ +
\ No newline at end of file diff --git a/tests/FunctionalTests/features/protected/pages/FocusControl.php b/tests/FunctionalTests/features/protected/pages/FocusControl.php new file mode 100644 index 00000000..d78f28c4 --- /dev/null +++ b/tests/FunctionalTests/features/protected/pages/FocusControl.php @@ -0,0 +1,17 @@ +list->SelectedIndex; + if($selected >= 0) + { + $id = "button".($selected+1); + $controlID = $this->{$id}->ClientID; + $this->ClientScript->registerFocusControl($controlID); + } + } +} + +?> \ No newline at end of file -- cgit v1.2.3