diff options
author | Christophe.Boulain <> | 2010-02-04 08:08:26 +0000 |
---|---|---|
committer | Christophe.Boulain <> | 2010-02-04 08:08:26 +0000 |
commit | 249e3ef66ffd9e10d34b0ab5b4f3efaec6fd507a (patch) | |
tree | 067c7fc6f5fe566cc2a0acf4ae9b9a5df4eca2cb | |
parent | b8aed6893e0e00197a02fd782415e4f0ce2360da (diff) |
Fixed TActiveDatePicker bug
5 files changed, 32 insertions, 11 deletions
@@ -19,6 +19,7 @@ BUG: Issue#208 - TDbConnection.Charset not working properly (googlenew at pcforu BUG: Issue#212 - Mistaken query executed by TMysqlMetaData (pbenny, Christophe) BUG: Issue#216 - TTabPanel doesn't preserve active tab on callback request (googlenew at pcforum.hu,Christophe) BUG: Typo in TBoundColumn (Robin) +BUG: TActiveDatePicker js error when date format does not have the 3 elements (Christophe) ENH: Add property ClientScriptManagerClass to TPageService and releated changes in TPage.getClientScript() (Yves) ENH: Always render clientside counterparts of validation control even if not enabled, but pass-through Enabled property, to allow Enabled/Disable of validator on callback. (Yves) EHN: Add property TValidationSummary.ScrollToSummary to server-side control since property exists on client-side. (Yves) diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js index 3aacda21..e96b63ec 100755 --- a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js @@ -46,9 +46,9 @@ Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker, var day = Prado.WebUI.TDatePicker.getDayListControl(this.control); var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control); var year = Prado.WebUI.TDatePicker.getYearListControl(this.control); - Event.observe (day, "change", this.onDateChanged.bindEvent(this)); - Event.observe (month, "change", this.onDateChanged.bindEvent(this)); - Event.observe (year, "change", this.onDateChanged.bindEvent(this)); + if (day) Event.observe (day, "change", this.onDateChanged.bindEvent(this)); + if (month) Event.observe (month, "change", this.onDateChanged.bindEvent(this)); + if (year) Event.observe (year, "change", this.onDateChanged.bindEvent(this)); } @@ -66,9 +66,12 @@ Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker, } else { - var day = Prado.WebUI.TDatePicker.getDayListControl(this.control).selectedIndex+1; - var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control).selectedIndex; - var year = Prado.WebUI.TDatePicker.getYearListControl(this.control).value; + var day = Prado.WebUI.TDatePicker.getDayListControl(this.control); + if (day) day=day.selectedIndex+1; + var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control); + if (month) month=month.selectedIndex; + var year = Prado.WebUI.TDatePicker.getYearListControl(this.control); + if (year) year=year.value; date=new Date(year, month, day, 0,0,0).SimpleFormat(this.Format, this); } if (typeof(this.options.OnDateChanged) == "function") this.options.OnDateChanged(this, date); diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page index 64f37867..88117744 100755 --- a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page +++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.page @@ -1,10 +1,10 @@ <html> <com:THead/> <body> -<com:TForm>
+<com:TForm> <h1>TActiveDatePicker test</h1> -<p>
-<com:TActiveDatePicker ID="datepicker" DateFormat="MM-dd-yyyy" OnCallback="testDatePicker"/>
+<p> +<com:TActiveDatePicker ID="datepicker" DateFormat="MM-dd-yyyy" OnCallback="testDatePicker"/> <com:TActiveLabel ID="status" /><br/> <com:TActiveButton ID="decreaseButton" OnClick="decrease" Text="-1" OnCallback="testDatePicker"/> <com:TActiveButton ID="todayButton" OnClick="today" Text="Today" OnCallback="testDatePicker"/> @@ -18,8 +18,11 @@ ShowCalendar=false <com:TActiveDatePicker ID="datepicker2" DateFormat="MM-dd-yyyy" OnCallback="testDatePicker2" InputMode="DropDownList" ShowCalendar="false"/> <com:TActiveLabel ID="status2" /><br/> </p> +<p>Partial Calendar</p> +<p> +<com:TActiveDatePicker ID="datepicker3" DateFormat="MMMM/yyyy" OnCallback="testDatePicker3" InputMode="DropDownList" ShowCalendar="true"/> +<com:TActiveLabel ID="status3" /><br/> -
</com:TForm> </body> </html>
\ No newline at end of file diff --git a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php index 4897a146..300574aa 100755 --- a/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php +++ b/tests/FunctionalTests/active-controls/protected/pages/ActiveDatePicker.php @@ -17,7 +17,11 @@ class ActiveDatePicker extends TPage { public function testDatePicker2($sender, $param){ $this->status2->Text = $this->datepicker2->getText(); } - + + public function testDatePicker3($sender, $param){ + $this->status3->Text = $this->datepicker3->getText(); + } + public function today ($sender, $param) { $this->datepicker->setTimestamp(time()); diff --git a/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php b/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php index 5faee611..c3b47934 100755 --- a/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php +++ b/tests/FunctionalTests/active-controls/tests/ActiveDatePickerTestCase.php @@ -104,6 +104,16 @@ class ActiveDatePickerTestCase extends SeleniumTestCase $this->pause(800); $dateToCheck=mktime(0,0,0,(int)date('m'),(int)date('d'), 2005); $this->verifyText("status2", date('m-d-Y', $dateToCheck)); + + + $this->verifyText("status3", ""); + $dateToCheck=time(); + $this->verifySelected("datepicker3_month", date('F', $dateToCheck)); + $this->verifySelected("datepicker3_year", date('Y', $dateToCheck)); + $this->select("datepicker3_year", 2005); + $this->pause(800); + $dateToCheck=mktime(0,0,0,(int)date('m'),(int)date('d'), 2005); + $this->verifyText("status3", date('m/Y', $dateToCheck)); } } |