diff options
author | xue <> | 2006-09-04 19:15:47 +0000 |
---|---|---|
committer | xue <> | 2006-09-04 19:15:47 +0000 |
commit | 56fee292c37e162c03fab9eeadd6a8b9ab85c251 (patch) | |
tree | 923510b93c707868098ae4e5f404eb3766a59553 /framework/Web/UI/WebControls/TImageMap.php | |
parent | b107cad91733d4a2a80f42cdbaab41a4f7b41c9d (diff) |
merge from 3.0 branch till 1387
Diffstat (limited to 'framework/Web/UI/WebControls/TImageMap.php')
-rw-r--r-- | framework/Web/UI/WebControls/TImageMap.php | 62 |
1 files changed, 42 insertions, 20 deletions
diff --git a/framework/Web/UI/WebControls/TImageMap.php b/framework/Web/UI/WebControls/TImageMap.php index 78216a35..b765ec8c 100644 --- a/framework/Web/UI/WebControls/TImageMap.php +++ b/framework/Web/UI/WebControls/TImageMap.php @@ -88,8 +88,8 @@ class TImageMap extends TImage implements IPostBackEventHandler $writer->addAttribute('name',self::MAP_NAME_PREFIX.$clientID);
$writer->renderBeginTag('map');
$writer->writeLine();
- if(($mode=$this->getHotSpotMode())==='NotSet')
- $mode='Navigate';
+ if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet)
+ $mode=THotSpotMode::Navigate;
$target=$this->getTarget();
$i=0;
$options['EventTarget'] = $this->getUniqueID();
@@ -97,11 +97,11 @@ class TImageMap extends TImage implements IPostBackEventHandler $cs=$this->getPage()->getClientScript();
foreach($hotspots as $hotspot)
{
- if($hotspot->getHotSpotMode()==='NotSet')
+ if($hotspot->getHotSpotMode()===THotSpotMode::NotSet)
$hotspot->setHotSpotMode($mode);
if($target!=='' && $hotspot->getTarget()==='')
$hotspot->setTarget($target);
- if($hotspot->getHotSpotMode()==='PostBack')
+ if($hotspot->getHotSpotMode()===THotSpotMode::PostBack)
{
$id=$clientID.'_'.$i;
$writer->addAttribute('id',$id);
@@ -146,9 +146,9 @@ class TImageMap extends TImage implements IPostBackEventHandler if($index>=0 && $index<$hotspots->getCount())
{
$hotspot=$hotspots->itemAt($index);
- if(($mode=$hotspot->getHotSpotMode())==='NotSet')
+ if(($mode=$hotspot->getHotSpotMode())===THotSpotMode::NotSet)
$mode=$this->getHotSpotMode();
- if($mode==='PostBack')
+ if($mode===THotSpotMode::PostBack)
{
$postBackValue=$hotspot->getPostBackValue();
if($hotspot->getCausesValidation())
@@ -161,23 +161,22 @@ class TImageMap extends TImage implements IPostBackEventHandler }
/**
- * @return string the behavior of hotspot regions in this imagemap when they are clicked. Defaults to 'NotSet'.
+ * @return THotSpotMode the behavior of hotspot regions in this imagemap when they are clicked. Defaults to THotSpotMode::NotSet.
*/
public function getHotSpotMode()
{
- return $this->getViewState('HotSpotMode','NotSet');
+ return $this->getViewState('HotSpotMode',THotSpotMode::NotSet);
}
/**
* Sets the behavior of hotspot regions in this imagemap when they are clicked.
* If an individual hotspot has a mode other than 'NotSet', the mode set in this
* imagemap will be ignored. By default, 'NotSet' is equivalent to 'Navigate'.
- * @param string the behavior of hotspot regions in this imagemap when they are clicked.
- * Valid values include 'NotSet','Navigate','PostBack','Inactive'.
+ * @param THotSpotMode the behavior of hotspot regions in this imagemap when they are clicked.
*/
public function setHotSpotMode($value)
{
- $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'NotSet','Navigate','PostBack','Inactive'),'NotSet');
+ $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'THotSpotMode'),THotSpotMode::NotSet);
}
/**
@@ -376,20 +375,19 @@ abstract class THotSpot extends TComponent }
/**
- * @return string the behavior of a HotSpot object when it is clicked. Defaults to 'NotSet'.
+ * @return THotSpotMode the behavior of a HotSpot object when it is clicked. Defaults to THotSpotMode::NotSet.
*/
public function getHotSpotMode()
{
- return $this->getViewState('HotSpotMode','NotSet');
+ return $this->getViewState('HotSpotMode',THotSpotMode::NotSet);
}
/**
- * @param string the behavior of a HotSpot object when it is clicked.
- * Valid values include 'NotSet','Navigate','PostBack','Inactive'.
+ * @param THotSpotMode the behavior of a HotSpot object when it is clicked.
*/
public function setHotSpotMode($value)
{
- $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'NotSet','Navigate','PostBack','Inactive'),'NotSet');
+ $this->setViewState('HotSpotMode',TPropertyValue::ensureEnum($value,'THotSpotMode'),THotSpotMode::NotSet);
}
/**
@@ -498,15 +496,15 @@ abstract class THotSpot extends TComponent {
$writer->addAttribute('shape',$this->getShape());
$writer->addAttribute('coords',$this->getCoordinates());
- if(($mode=$this->getHotSpotMode())==='NotSet')
- $mode='Navigate';
- if($mode==='Navigate')
+ if(($mode=$this->getHotSpotMode())===THotSpotMode::NotSet)
+ $mode=THotSpotMode::Navigate;
+ if($mode===THotSpotMode::Navigate)
{
$writer->addAttribute('href',$this->getNavigateUrl());
if(($target=$this->getTarget())!=='')
$writer->addAttribute('target',$target);
}
- else if($mode==='Inactive')
+ else if($mode===THotSpotMode::Inactive)
$writer->addAttribute('nohref','true');
$text=$this->getAlternateText();
$writer->addAttribute('title',$text);
@@ -734,4 +732,28 @@ class TPolygonHotSpot extends THotSpot }
}
+
+/**
+ * THotSpotMode class.
+ * THotSpotMode defines the enumerable type for the possible hot spot modes.
+ *
+ * The following enumerable values are defined:
+ * - NotSet: the mode is not specified
+ * - Navigate: clicking on the hotspot will redirect the browser to a different page
+ * - PostBack: clicking on the hotspot will cause a postback
+ * - Inactive: the hotspot is inactive (not clickable)
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Web.UI.WebControls
+ * @since 3.0.4
+ */
+class THotSpotMode extends TEnumerable
+{
+ const NotSet='NotSet';
+ const Navigate='Navigate';
+ const PostBack='PostBack';
+ const Inactive='Inactive';
+}
+
?>
|