From adb88ab5ac7980af3fea4cc035a158d92b1ab1a6 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Wed, 26 Mar 2014 19:54:37 +0100 Subject: Fix #502 (cherry picked from commit e2fb2ab1e2b5925f16d4dd5c3ac514a0e54ee026) Conflicts: framework/Web/Javascripts/source/prado/controls/slider.js --- .../Javascripts/source/prado/controls/slider.js | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'framework/Web/Javascripts/source') diff --git a/framework/Web/Javascripts/source/prado/controls/slider.js b/framework/Web/Javascripts/source/prado/controls/slider.js index 2e26ee51..d612d654 100644 --- a/framework/Web/Javascripts/source/prado/controls/slider.js +++ b/framework/Web/Javascripts/source/prado/controls/slider.js @@ -18,17 +18,9 @@ Prado.WebUI.TSlider = Class.extend(Prado.WebUI.PostBackControl, this.maximum = this.options.maximum || this.range.end; this.minimum = this.options.minimum || this.range.start; this.hiddenField=$(this.options.ID+'_1'); + this.trackInitialized=false; - // Will be used to align the handle onto the track, if necessary - this.alignX = parseInt(this.options.alignX || - this.track.offsetLeft); - this.alignY = parseInt(this.options.alignY || - this.track.offsetTop); - - this.trackLength = this.maximumOffset() - this.minimumOffset(); - this.handleLength = this.isVertical() ? - (this.handle.offsetHeight != 0 ? - this.handle.offsetHeight : this.handles.style.height.replace(/px$/,"")) : - (this.handle.offsetWidth != 0 ? this.handle.offsetWidth : - this.handle.style.width.replace(/px$/,"")); + this.initializeTrack(); this.active = false; this.dragging = false; @@ -64,6 +56,24 @@ Prado.WebUI.TSlider = Class.extend(Prado.WebUI.PostBackControl, if(this.options['AutoPostBack']==true) this.observe(this.hiddenField, "change", Prado.PostBack.bindEvent(this,options)); + initializeTrack : function() + { + if(this.trackInitialized || !$(this.track).is(":visible")) + return; + + // Will be used to align the handle onto the track, if necessary + this.alignX = parseInt(this.options.alignX || - this.track.offsetLeft); + this.alignY = parseInt(this.options.alignY || - this.track.offsetTop); + + this.trackLength = this.maximumOffset() - this.minimumOffset(); + this.handleLength = this.isVertical() ? + (this.handle.offsetHeight != 0 ? + this.handle.offsetHeight : this.handles.style.height.replace(/px$/,"")) : + (this.handle.offsetWidth != 0 ? this.handle.offsetWidth : + this.handle.style.width.replace(/px$/,"")); + this.trackInitialized=true; + }, + }, setDisabled: function(){ @@ -151,6 +161,7 @@ Prado.WebUI.TSlider = Class.extend(Prado.WebUI.PostBackControl, startDrag: function(event) { if(Event.isLeftClick(event)) { + this.initializeTrack(); if(!this.disabled){ this.active = true; var handle = Event.element(event); -- cgit v1.2.3 From b7614a9c62f9e6597ea83bdc6901693efb74e68a Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Mon, 21 Apr 2014 12:09:30 +0200 Subject: Fixed #516 , added test case (cherry picked from commit c66097eac2c2691bf0047829275962ec0bf2b41f) --- .../source/prado/validator/validation3.js | 2 +- .../issues/protected/pages/Issue516.page | 50 +++++++++ .../issues/protected/pages/Issue516.php | 115 +++++++++++++++++++++ .../issues/tests/Issue516TestCase.php | 37 +++++++ 4 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 tests/FunctionalTests/issues/protected/pages/Issue516.page create mode 100644 tests/FunctionalTests/issues/protected/pages/Issue516.php create mode 100644 tests/FunctionalTests/issues/tests/Issue516TestCase.php (limited to 'framework/Web/Javascripts/source') diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js index 0361389f..483c7ec2 100644 --- a/framework/Web/Javascripts/source/prado/validator/validation3.js +++ b/framework/Web/Javascripts/source/prado/validator/validation3.js @@ -979,7 +979,7 @@ Prado.WebUI.TBaseValidator = Class.create(Prado.WebUI.Control, if(!this.control) this.control = $(this.options.ControlToValidate); - if(!this.control || this.control.disabled) + if(!this.control || this.control.disabled || !this.control.descendantOf(document)) { this.isValid = true; return this.isValid; diff --git a/tests/FunctionalTests/issues/protected/pages/Issue516.page b/tests/FunctionalTests/issues/protected/pages/Issue516.page new file mode 100644 index 00000000..c922c6e1 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/pages/Issue516.page @@ -0,0 +1,50 @@ + + +

Issue 516 Test

+ + + + + + + + + + + + + + +
+ diff --git a/tests/FunctionalTests/issues/protected/pages/Issue516.php b/tests/FunctionalTests/issues/protected/pages/Issue516.php new file mode 100644 index 00000000..bd3e7a72 --- /dev/null +++ b/tests/FunctionalTests/issues/protected/pages/Issue516.php @@ -0,0 +1,115 @@ +_data===null) + $this->loadData(); + return $this->_data; + } + + protected function loadData() + { + // We use viewstate keep track of data. + // In real applications, data should come from database using an SQL SELECT statement. + // In the following tabular data, field 'ISBN' is the primary key. + // All update and delete operations should come with an 'id' value in order to go through. + if(($this->_data=$this->getViewState('Data',null))===null) + { + $this->_data=array( + array( + 'ISBN'=>'0596007124', + 'title'=>'', + ), + array( + 'ISBN'=>'0201633612', + 'title'=>'Design Patterns: Elements of Reusable Object-Oriented Software', + ), + array( + 'ISBN'=>'0321247140', + 'title'=>'Design Patterns Explained : A New Perspective on Object-Oriented Design', + ), + array( + 'ISBN'=>'0201485672', + 'title'=>'Refactoring: Improving the Design of Existing Code', + ), + array( + 'ISBN'=>'0321213351', + 'title'=>'Refactoring to Patterns', + ), + array( + 'ISBN'=>'0735619670', + 'title'=>'Code Complete', + ), + array( + 'ISBN'=>'0321278658 ', + 'title'=>'Extreme Programming Explained : Embrace Change', + ), + ); + $this->saveData(); + } + } + + protected function saveData() + { + $this->setViewState('Data',$this->_data); + } + + protected function updateBook($isbn,$title) + { + // In real applications, data should be saved to database using an SQL UPDATE statement + if($this->_data===null) + $this->loadData(); + $updateRow=null; + foreach($this->_data as $index=>$row) + if($row['ISBN']===$isbn) + $updateRow=&$this->_data[$index]; + if($updateRow!==null) + { + $updateRow['title']=$title; + $this->saveData(); + } + } + + public function onLoad($param) + { + parent::onLoad($param); + if(!$this->IsPostBack && !$this->IsCallBack) + { + $this->DataGrid->DataSource=$this->Data; + $this->DataGrid->dataBind(); + } + } + + public function editItem($sender,$param) + { + $this->DataGrid->EditItemIndex=$param->Item->ItemIndex; + $this->DataGrid->DataSource=$this->Data; + $this->DataGrid->dataBind(); + } + + public function saveItem($sender,$param) + { + $item=$param->Item; + $this->updateBook( + $this->DataGrid->DataKeys[$item->ItemIndex], // ISBN + $item->BookTitleColumn->TextBox->Text // title + ); + $this->DataGrid->EditItemIndex=-1; + $this->DataGrid->DataSource=$this->Data; + $this->DataGrid->dataBind(); + } + + public function cancelItem($sender,$param) + { + $this->DataGrid->EditItemIndex=-1; + $this->DataGrid->DataSource=$this->Data; + $this->DataGrid->dataBind(); + } + +} diff --git a/tests/FunctionalTests/issues/tests/Issue516TestCase.php b/tests/FunctionalTests/issues/tests/Issue516TestCase.php new file mode 100644 index 00000000..363e9f84 --- /dev/null +++ b/tests/FunctionalTests/issues/tests/Issue516TestCase.php @@ -0,0 +1,37 @@ +url('issues/index.php?page=Issue516'); + $this->assertContains('Issue 516 Test', $this->source()); + $base='ctl0_Content_'; + $row1='DataGrid_ctl1_'; + $row2='DataGrid_ctl2_'; + + // click "edit" and check for textbox + $this->byID("{$base}{$row1}ctl3")->click(); + $this->pause(800); + $this->assertElementPresent("{$base}{$row1}TextBox"); + // click "save" and check for validator + $this->byID("{$base}{$row1}ctl3")->click(); + $this->pause(800); + $this->assertEquals('Please provide a title.', $this->getElement("{$base}{$row1}ctl1")->text()); + // click "cancel" and ensure validator has disappeared + $this->byID("{$base}{$row1}ctl4")->click(); + $this->pause(800); + $this->assertElementNotPresent("{$base}{$row1}ctl1"); + + // click "edit" and check for textbox on the second row + $this->byID("{$base}{$row2}ctl3")->click(); + $this->pause(800); + $this->assertTrue($this->getElement("{$base}{$row2}TextBox")!==null); + // click "save" and ensure bvalidation has been successfull + $this->byID("{$base}{$row2}ctl3")->click(); + $this->pause(800); + $this->assertElementNotPresent("{$base}{$row2}ctl1"); + $this->assertElementNotPresent("{$base}{$row2}TextBox"); + $this->assertEquals('Edit', $this->getElement("{$base}{$row2}ctl3")->text()); + } +} -- cgit v1.2.3 From bb486d4e6fc271107ee3d708269f01661ac4de0d Mon Sep 17 00:00:00 2001 From: David Date: Fri, 25 Apr 2014 14:59:40 +0200 Subject: IE7+IE8 compatibility (fixes #520) (cherry picked from commit 5cd010cb008b6e28988de5a5b7e9e769eea80907) Conflicts: framework/Web/Javascripts/source/prado/activecontrols/ajax3.js --- framework/Web/Javascripts/source/prado/activecontrols/ajax3.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'framework/Web/Javascripts/source') diff --git a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js index e19f5d49..648f3e76 100644 --- a/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js +++ b/framework/Web/Javascripts/source/prado/activecontrols/ajax3.js @@ -1154,7 +1154,13 @@ if (typeof(Prado.AssetManagerClass)=="undefined") { createStyleSheetCode: function(code) { var asset = document.createElement('style'); asset.setAttribute('type', 'text/css'); - asset.innerText = code; + + if(asset.styleSheet) + asset.styleSheet.cssText = code; // IE7+IE8 + else { + var cssCodeNode = document.createTextNode(code); + asset.appendChild(cssCodeNode); + } var head = document.getElementsByTagName('head')[0]; head.appendChild(asset); -- cgit v1.2.3 From 0f44c9bfdf9258dc9feb61613f46b438d7ff0027 Mon Sep 17 00:00:00 2001 From: David Date: Fri, 22 Aug 2014 14:07:06 +0200 Subject: Fixed slider.js syntax error --- framework/Web/Javascripts/source/prado/controls/slider.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'framework/Web/Javascripts/source') diff --git a/framework/Web/Javascripts/source/prado/controls/slider.js b/framework/Web/Javascripts/source/prado/controls/slider.js index d612d654..ba65de3b 100644 --- a/framework/Web/Javascripts/source/prado/controls/slider.js +++ b/framework/Web/Javascripts/source/prado/controls/slider.js @@ -55,7 +55,8 @@ Prado.WebUI.TSlider = Class.extend(Prado.WebUI.PostBackControl, if(this.options['AutoPostBack']==true) this.observe(this.hiddenField, "change", Prado.PostBack.bindEvent(this,options)); - + }, + initializeTrack : function() { if(this.trackInitialized || !$(this.track).is(":visible")) @@ -74,7 +75,6 @@ Prado.WebUI.TSlider = Class.extend(Prado.WebUI.PostBackControl, this.trackInitialized=true; }, - }, setDisabled: function(){ this.disabled = true; @@ -234,4 +234,4 @@ Prado.WebUI.TSlider = Class.extend(Prado.WebUI.PostBackControl, } } -}); \ No newline at end of file +}); -- cgit v1.2.3 From 57987c93c15da02d6e39ab238f0abc40fe11dc4a Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sat, 23 Aug 2014 13:44:48 +0200 Subject: Updated version number and changes log --- HISTORY | 28 ++++++++++++++++++++++ UPGRADE | 4 ++-- buildscripts/texbuilder/quickstart/quickstart.tex | 2 +- composer.json | 12 +++++++++- .../pages/Controls/Samples/TConditional/Home.page | 4 ++-- .../pages/GettingStarted/NewFeatures.page | 7 ++++++ framework/PradoBase.php | 2 +- framework/Web/Javascripts/source/prado/prado.js | 2 +- index.html | 2 +- 9 files changed, 54 insertions(+), 9 deletions(-) (limited to 'framework/Web/Javascripts/source') diff --git a/HISTORY b/HISTORY index ef7b7d60..d6eec406 100644 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,31 @@ +Version 3.2.4 Aug XX, 2014 + +BUG: Issue #492 - Prado generates json_error when encoding an exception with non UTF-8 data (david0) +ENH: Issue #494 - Adding toArray() and toJSON() to TActiveRecord (dmarko484) +BUG: Issue #498 - Typo in TActiveFileUpload (Jens-mB) +BUG: Issue #499 - Avoid scrolling when calling TControl::focus() (david0) +BUG: Issue #502 - TSlider behaves strangely in TTabView (ctrlaltca) +BUG: Issue #504 - Default Button cannot be referenced by . (ctrlaltca) +BUG: Issue #506 - Unused lines of code in TLiteralColumn::initializeCell (cross) +BUG: Issue #511 - TActivePager's ButtonCssClass property is not rendered in buttons (ctrlaltca) +BUG: Issue #515 - THtmlArea should override Readonly property (ctrlaltca) +BUG: Issue #516 - Check Validators in TActiveEditCommandColumn (ctrlaltca) +BUG: Issue #517 - TXmlDocument adjustment (gnit) +BUG: Issue #518 - Runtime Notice in Gettext::factory() (ctrlaltca) +BUG: Issue #519 - For MySQL in case PDO::CASE_LOWER creating table info does not work (ganiuszka) +BUG: Issue #246 - Refix: User date() instead of gmdate() in TLogRoute (drigolin) +BUG: Issue #520 - Unknown runtime error with Internet Explorer 8 (david0) +BUG: Issue #524 - JSON error (5): Malformed UTF-8 characters when encoding callback response (david0) +BUG: Issue #526 - TJsonRpcProtocol::callMethod, requested method is called twice (jojoinside) +BUG: Issue #527 - TJsonRpcProtocol::callMethod, semicolon must be removed (jojoinside) +ENH: Ported tests to Selenium2 +ENH: avoid duplicate creation of T*CheckBoxList, T*RadioButtonList js items (ctraltca) +BUG: Avoid an exception loop on callback error when headers have already been sent (ctrlaltca) +BUG: Avoid rendering