--- MapTips.widget.php.cvs Tue Feb 8 11:36:43 2005 +++ MapTips.widget.php.new Tue Feb 8 12:08:35 2005 @@ -27,6 +27,23 @@ * DEALINGS IN THE SOFTWARE. */ +/* +* MODIFICATIONS (C) 2005, Andreas Hocevar +* - bugfix: use tolerance from cwc2 call (and not 3!) +* - bugfix: use correct variable $this->mszOnMouseOut (not $this->onMouseOut) +* for $onmouseout and fix semicolon typo in $onmouseover definiton. +* - bugfix: set default onmouseover and onmouseout to correct names +* (i.e. MapTipContent and MapTip clear instead of MapTipsContent and +* MapTipsClear). +* - add feature: if keyword "LinkUniqueID" (case insensitive) is found in the +* LINKURL attribute, it is replaced by the current link-id. This is useful +* if your LinkURL looks more like "javascript:openURL(12345, 'foo')" that +* "http://www.foo.bar/index.php?id=12345". +* - add feature: new LINKTARGET attribute. If not set, "_blank" is used to +* keep compatibility with previous versions. If LINKTARGET attribute is set +* to "", it will be omitted in the according hfres. +*/ + include_once(dirname(__FILE__)."/../Widget.php"); include_once(dirname(__FILE__)."/../Button.php"); include_once(dirname(__FILE__)."/../Popup.php"); @@ -49,6 +66,7 @@ var $mszLayer = ''; var $maszAttributes = array(); var $mszLinkURL = ''; // URL to go to + var $mszLinkTarget = '_blank'; // Link target var $mszLinkUniqueID = ''; // unique location id to append to url var $mszTitleClass = 'label'; var $mszTitleStyle = ''; @@ -62,8 +80,8 @@ var $mszTransparentMapImage = 'maptips_image'; var $mszPixelGif = ''; - var $mszOnMouseOver = 'MapTipsContent'; - var $mszOnMouseOut = 'MapTipsClear'; + var $mszOnMouseOver = 'MapTipContent'; + var $mszOnMouseOut = 'MapTipClear'; /** * MapTips @@ -98,6 +116,7 @@ $this->maAttributes["TOLERANCE"] = new IntegerAttribute( "TOLERANCE", false ); $this->maAttributes["LINK"] = new BooleanAttribute( "LINK", false ); $this->maAttributes["LINKURL"] = new StringAttribute( "LINKURL", false ); + $this->maAttributes["LINKTARGET"] = new StringAttribute( "LINKTARGET", false ); $this->maAttributes["LINKUNIQUEID"] = new StringAttribute( "LINKUNIQUEID", false ); $this->maAttributes["MAPTIPSDIV"] = new StringAttribute( "MAPTIPSDIV", true ); $this->maAttributes["TITLECLASS"] = new StringAttribute( "TITLECLASS", false ); @@ -142,6 +161,8 @@ $this->mszLink = $this->maParams["LINK"]; if (isset($this->maParams["LINKURL"])) $this->mszLinkURL = $this->maParams["LINKURL"]; + if (isset($this->maParams["LINKTARGET"])) + $this->mszLinkTarget = $this->maParams["LINKTARGET"]; if (isset($this->maParams["LINKUNIQUEID"])) $this->mszLinkUniqueID = $this->maParams["LINKUNIQUEID"]; } @@ -345,12 +366,25 @@ $href = "href=\"".$this->mszLinkURL; if ($this->mszLinkUniqueID != "") { - $href .= "[".$this->mszLinkUniqueID."]"; + if (strpos( strtolower( $this->mszLinkURL ), 'linkuniqueid' ) !== false) + { + $href = preg_replace( '/linkuniqueid/i', "[".$this->mszLinkUniqueID."]", $href ); + } + else + { + $href .= "[".$this->mszLinkUniqueID."]"; + } + } + if ($this->mszLinkTarget) + { + $href .= "\" target=\"".$this->mszLinkTarget."\""; + } + else { + $href .= "\""; } - $href .= "\" target=\"_blank\""; - $onmouseover = 'szMapTipsNavCmd = '.$this->mszHTMLForm.'.NAV_CMD.value; '.$this->mszHTMLForm.'.NAV_CMD.value = \'\'; szMapTipsNavSubmit = '.$this->mszHTMLForm.'.NAV_SUBMIT.value; '.$this->mszHTMLForm.'.NAV_SUBMIT.value = 0.'.$this->mszOnMouseOver.'(\''.$this->mszMapTipsDiv.'\', \''.$szContents.'\', arguments[0])'; - $onmouseout = $this->mszHTMLForm.'.NAV_CMD.value = szMapTipsNavCmd; '.$this->mszHTMLForm.'.NAV_SUBMIT.value = szMapTipsNavSubmit; '.$this->onMouseOut.'(\''.$this->mszMapTipsDiv.'\', \''.$this->mszDefaultText.'\', arguments[0])'; + $onmouseover = 'szMapTipsNavCmd = '.$this->mszHTMLForm.'.NAV_CMD.value; '.$this->mszHTMLForm.'.NAV_CMD.value = \'\'; szMapTipsNavSubmit = '.$this->mszHTMLForm.'.NAV_SUBMIT.value; '.$this->mszHTMLForm.'.NAV_SUBMIT.value = 0;'.$this->mszOnMouseOver.'(\''.$this->mszMapTipsDiv.'\', \''.$szContents.'\', arguments[0])'; + $onmouseout = $this->mszHTMLForm.'.NAV_CMD.value = szMapTipsNavCmd; '.$this->mszHTMLForm.'.NAV_SUBMIT.value = szMapTipsNavSubmit; '.$this->mszOnMouseOut.'(\''.$this->mszMapTipsDiv.'\', \''.$this->mszDefaultText.'\', arguments[0])'; } else { @@ -360,7 +394,7 @@ } if ($oLayer->type == MS_LAYER_POINT) { - $szTemplate = ''; + $szTemplate = 'mnTolerance.'" '.$href.' onmouseover="'.$onmouseover.'" onmouseout="'.$onmouseout.'">'; } elseif ($oLayer->type == MS_LAYER_LINE) {