summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes3
-rw-r--r--HISTORY1
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientScript.php12
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Issue120.page13
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Issue120.php22
-rw-r--r--tests/FunctionalTests/tickets/tests/Issue120TestCase.php21
6 files changed, 72 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
index 6af86f34..9a8c88c2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2961,6 +2961,8 @@ tests/FunctionalTests/tickets/protected/controls/down.gif -text
tests/FunctionalTests/tickets/protected/controls/up.gif -text
tests/FunctionalTests/tickets/protected/messages/en/messages.xml -text
tests/FunctionalTests/tickets/protected/pages/DActiveDropDownList2.php -text
+tests/FunctionalTests/tickets/protected/pages/Issue120.page -text
+tests/FunctionalTests/tickets/protected/pages/Issue120.php -text
tests/FunctionalTests/tickets/protected/pages/Layout.php -text
tests/FunctionalTests/tickets/protected/pages/Layout.tpl -text
tests/FunctionalTests/tickets/protected/pages/TestHtmlArea.php -text
@@ -3134,6 +3136,7 @@ tests/FunctionalTests/tickets/protected700/pages/admin/users/Home2.page -text
tests/FunctionalTests/tickets/protected700/pages/admin/users/config.xml -text
tests/FunctionalTests/tickets/protected700/pages/config.xml -text
tests/FunctionalTests/tickets/protected700/pages/content/Home.page -text
+tests/FunctionalTests/tickets/tests/Issue120TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket121TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket163TestCase.php -text
tests/FunctionalTests/tickets/tests/Ticket169TestCase.php -text
diff --git a/HISTORY b/HISTORY
index 17ef4fda..e7d3496a 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1,5 +1,6 @@
Version 3.1.5 (to be released)
BUG: URL wildcard patterns didn't work with subfolders
+BUG: Issue#120 - TActiveDropDownList PromptText and PromptValue got lost during callback and data rebind (Yves)
BUG: Issue#68 - TSqlMapConfig::createSqlMapGateway(): assign current connection to cached TSqlMapManager to avoid loosing active transaction (Yves)
BUG: Issue#108 - clientscripts.php: prepending set_time_limit(0) call with an "@" to suppress PHP warning in safe mode (Yves)
BUG: Issue#87 - TinyMCE : empty string disapears after encoding JS, that's a problem! (Christophe)
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientScript.php b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
index 1b9f1ca6..062f63dc 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientScript.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
@@ -177,6 +177,18 @@ class TCallbackClientScript extends TApplicationComponent
public function setListItems($control, $items)
{
$options = array();
+ if($control instanceof TListControl)
+ {
+ $promptText = $control->getPromptText();
+ $promptValue = $control->getPromptValue();
+
+ if($promptValue==='')
+ $promptValue = $promptText;
+
+ if($promptValue!=='')
+ $options[] = array($promptText, $promptValue);
+ }
+
foreach($items as $item)
{
if($item->getHasAttributes())
diff --git a/tests/FunctionalTests/tickets/protected/pages/Issue120.page b/tests/FunctionalTests/tickets/protected/pages/Issue120.page
new file mode 100644
index 00000000..0b504849
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Issue120.page
@@ -0,0 +1,13 @@
+<com:TContent ID="Content">
+ <h1>TActiveDropDownList PromptValue Test</h1>
+
+ <com:TActiveDropDownList id="ddl1" PromptValue="PromptValue" PromptText="PromptText">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+ </com:TActiveDropDownList>
+
+ <com:TActiveButton id="btn1" OnCallback="buttonClickCallback" />
+
+</com:TContent> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/protected/pages/Issue120.php b/tests/FunctionalTests/tickets/protected/pages/Issue120.php
new file mode 100644
index 00000000..c04ae93d
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Issue120.php
@@ -0,0 +1,22 @@
+<?php
+Prado::using('System.Web.UI.ActiveControls.*');
+
+class Issue120 extends TPage
+{
+ public function buttonClickCallback($sender, $param)
+ {
+
+ $this -> ddl1 -> setDataSource(
+ array(
+ 'callback value 1' => 'callback item 1',
+ 'callback value 2' => 'callback item 2',
+ 'callback value 3' => 'callback item 3',
+ 'callback value 4' => 'callback item 4'
+ )
+ );
+ $this -> ddl1 -> dataBind();
+
+ }
+}
+
+?> \ No newline at end of file
diff --git a/tests/FunctionalTests/tickets/tests/Issue120TestCase.php b/tests/FunctionalTests/tickets/tests/Issue120TestCase.php
new file mode 100644
index 00000000..a2823c9d
--- /dev/null
+++ b/tests/FunctionalTests/tickets/tests/Issue120TestCase.php
@@ -0,0 +1,21 @@
+<?php
+
+class Issue120TestCase extends SeleniumTestCase
+{
+ function test()
+ {
+ $this->open('tickets/index.php?page=Issue120');
+ $this->assertTextPresent('TActiveDropDownList PromptValue Test');
+
+ $this->assertSelectedIndex("ctl0_Content_ddl1", 0);
+ $this->assertSelectedValue("ctl0_Content_ddl1", 'PromptValue');
+
+ $this->click("ctl0_Content_btn1");
+ $this->pause(800);
+
+ $this->assertSelectedIndex("ctl0_Content_ddl1", 0);
+ $this->assertSelectedValue("ctl0_Content_ddl1", 'PromptValue');
+ }
+}
+
+?> \ No newline at end of file