From 18fd558413d5dec2bd074030a5c6bf111965c0c0 Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 8 May 2007 15:59:13 +0000 Subject: fixed #601. --- .gitattributes | 1 + HISTORY | 1 + demos/address-book/protected/.htaccess | 1 + framework/Web/UI/WebControls/TImageMap.php | 79 ++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 demos/address-book/protected/.htaccess diff --git a/.gitattributes b/.gitattributes index dfdf47c8..eef497b2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -662,6 +662,7 @@ demos/activeblog/protected/application.xml -text demos/activeblog/protected/urlmaps.xml -text demos/activeblog/themes/Default/style.css -text demos/address-book/index.php -text +demos/address-book/protected/.htaccess -text demos/address-book/protected/application.xml -text demos/address-book/protected/pages/AddressProvider.php -text demos/address-book/protected/pages/AddressRecord.php -text diff --git a/HISTORY b/HISTORY index 996b994d..4cc9469c 100644 --- a/HISTORY +++ b/HISTORY @@ -2,6 +2,7 @@ Version 3.1.0 RC To be released =============================== BUG: Ticket#605 - TDatePicker don't works in 3.1.b on linux server (Wei) BUG: Ticket#606 - TColorPicker bug in Full mode (Wei) +ENH: Ticket#601 - TRectangleHotSpot and javascript onclick handler (Qiang) ENH: Add javascript references for "slider" and "dragdrop" for TClientScript::PradoScripts (Wei) ENH: Added PatternModifiers property to TRegularExpressionValidator (Wei) CHG:
tags are used instead of when TDataList.RepeatLayout is Raw (Qiang) diff --git a/demos/address-book/protected/.htaccess b/demos/address-book/protected/.htaccess new file mode 100644 index 00000000..e0198322 --- /dev/null +++ b/demos/address-book/protected/.htaccess @@ -0,0 +1 @@ +deny from all diff --git a/framework/Web/UI/WebControls/TImageMap.php b/framework/Web/UI/WebControls/TImageMap.php index c5041205..875a8ae0 100644 --- a/framework/Web/UI/WebControls/TImageMap.php +++ b/framework/Web/UI/WebControls/TImageMap.php @@ -488,6 +488,80 @@ abstract class THotSpot extends TComponent $this->setViewState('Target',TPropertyValue::ensureString($value),''); } + /** + * @return boolean whether the hotspot has custom attributes + */ + public function getHasAttributes() + { + if($attributes=$this->getViewState('Attributes',null)) + return $attributes->getCount()>0; + else + return false; + } + + /** + * Returns the list of custom attributes. + * Custom attributes are name-value pairs that may be rendered + * as HTML tags' attributes. + * @return TAttributeCollection the list of custom attributes + */ + public function getAttributes() + { + if($attributes=$this->getViewState('Attributes',null)) + return $attributes; + else + { + $attributes=new TAttributeCollection; + $this->setViewState('Attributes',$attributes,null); + return $attributes; + } + } + + /** + * @return boolean whether the named attribute exists + */ + public function hasAttribute($name) + { + if($attributes=$this->getViewState('Attributes',null)) + return $attributes->contains($name); + else + return false; + } + + /** + * @return string attribute value, null if attribute does not exist + */ + public function getAttribute($name) + { + if($attributes=$this->getViewState('Attributes',null)) + return $attributes->itemAt($name); + else + return null; + } + + /** + * Sets a custom hotspot attribute. + * @param string attribute name + * @param string value of the attribute + */ + public function setAttribute($name,$value) + { + $this->getAttributes()->add($name,$value); + } + + /** + * Removes the named attribute. + * @param string the name of the attribute to be removed. + * @return string attribute value removed, null if attribute does not exist. + */ + public function removeAttribute($name) + { + if($attributes=$this->getViewState('Attributes',null)) + return $attributes->remove($name); + else + return null; + } + /** * Renders this hotspot. * @param THtmlWriter @@ -513,6 +587,11 @@ abstract class THotSpot extends TComponent $writer->addAttribute('accesskey',$accessKey); if(($tabIndex=$this->getTabIndex())!==0) $writer->addAttribute('tabindex',"$tabIndex"); + if($this->getHasAttributes()) + { + foreach($this->getAttributes() as $name=>$value) + $writer->addAttribute($name,$value); + } $writer->renderBeginTag('area'); $writer->renderEndTag(); } -- cgit v1.2.3