From c3dbc4d210cfb9d96961a990aa74c55560f2b4b4 Mon Sep 17 00:00:00 2001 From: "Christophe.Boulain" <> Date: Thu, 18 Feb 2010 10:36:50 +0000 Subject: Update TDraggable::revert property to accept "failure" value --- framework/Web/UI/ActiveControls/TDraggable.php | 32 ++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'framework/Web') diff --git a/framework/Web/UI/ActiveControls/TDraggable.php b/framework/Web/UI/ActiveControls/TDraggable.php index e26f13b5..8bf9243b 100755 --- a/framework/Web/UI/ActiveControls/TDraggable.php +++ b/framework/Web/UI/ActiveControls/TDraggable.php @@ -51,21 +51,33 @@ class TDraggable extends TPanel /** * Determine if draggable element should revert to it orginal position * upon release in an non-droppable container. - * @return boolean true to revert + * Since 3.2, Revert property can be set to one of the value of {@link TDraggableRevertOption} enumeration. + * o 'True' or 'Revert' : The draggable will revert to it's original position + * o 'False' or 'None' : The draggable won't revert to it's original position + * o 'Failure' : The draggable will only revert if it's dropped on a non droppable area + * @return TDraggableRevertOption true to revert */ public function getRevert() { - return $this->getViewState('Revert', true); + return $this->getViewState('Revert', TDraggableRevertOptions::Revert); } /** * Sets whether the draggable element should revert to it orginal position * upon release in an non-droppable container. + * Since 3.2, Revert property can be set to one of the value of {@link TDraggableRevertOption} enumeration. + * o 'True' or 'Revert' : The draggable will revert to it's original position + * o 'False' or 'None' : The draggable won't revert to it's original position + * o 'Failure' : The draggable will only revert if it's dropped on a non droppable area * @param boolean true to revert */ public function setRevert($value) { - $this->setViewState('Revert', TPropertyValue::ensureBoolean($value), true); + if (strcasecmp($value,'true')==0 || $value===true) + $value=TDraggableRevertOptions::Revert; + elseif (strcasecmp($value,'false')==0 || $value===false) + $value=TDraggableRevertOptions::None; + $this->setViewState('Revert', TPropertyValue::ensureEnum($value, 'TDraggableRevertOptions'), true); } /** @@ -163,7 +175,12 @@ class TDraggable extends TPanel $options['ID'] = $this->getClientID(); if (($handle=$this->getHandle())!== null) $options['handle']=$handle; - $options['revert']=$this->getRevert(); + if (($revert=$this->getRevert())===TDraggableRevertOptions::None) + $options['revert']=false; + elseif ($revert==TDraggableRevertOptions::Revert) + $options['revert']=true; + else + $options['revert']=strtolower($revert); if (($constraint=$this->getConstraint())!==TDraggableConstraint::None) $options['constraint']=strtolower($constraint); switch ($this->getGhosting()) { @@ -193,4 +210,11 @@ class TDraggableGhostingOptions extends TEnumerable const Ghosting='Ghosting'; const SuperGhosting='SuperGhosting'; } + +class TDraggableRevertOptions extends TEnumerable +{ + const None='None'; + const Revert='Revert'; + const Failure='Failure'; +} ?> -- cgit v1.2.3