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 --- HISTORY | 1 + framework/Web/UI/ActiveControls/TDraggable.php | 32 ++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/HISTORY b/HISTORY index 884efe80..a428ba9f 100644 --- a/HISTORY +++ b/HISTORY @@ -12,6 +12,7 @@ NEW: Add TActiveTableCell (LCS Team) ENH: Issue#173 - Add "dragdropextra" (superghosting) patch, mouse coordinates and key status to drag & drop controls (Christophe, DevWorx) NEW: Add TActiveMultiView (LCS Team) NEW: Beta of master/slave senario solution (Yves) +ENH: Update TDraggable::revert property to accept "failure" value (Christophe) Version 3.1.7 To be released ENH: Issue#24 - Specify needed fields on demand (Yves) 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