OpenLayers.Control.SypAttribution = OpenLayers.Class (OpenLayers.Control.Attribution, {
updateAttribution: function() {
- var attributions = [SypStrings.propulsedByLink];
+ var attributions = [SypStrings.poweredByLink];
if (this.map && this.map.layers) {
for(var i=0, len=this.map.layers.length; i<len; i++) {
var layer = this.map.layers[i];
}
var map = this.map;
- if (map.getControlsByClass("OpenLayers.Control.ArgParser")[0].lat
- == undefined) { // map center was not set in ArgParser control.
+ if (map.getControlsByClass("OpenLayers.Control.ArgParser")[0].center
+ == null) { // map center was not set in ArgParser control.
var orig = this.Utils.mbr (this.dataLayer);
var centerBounds = new OpenLayers.Bounds();
}
var contentHTML;
if (feature.cluster[0].attributes.name) {
+ // escaping name is necessary because it's not enclosed in another html tag.
contentHTML = "<h2>" +
- feature.cluster[0].attributes.name +
+ SYP.Utils.escapeHTML(feature.cluster[0].attributes.name) +
"</h2>" +
feature.cluster[0].attributes.description;
} else {
},
showBigImage: function (href) {
- try {
- document.getElementById('bigimg_container').style.display = "table";
- } catch(e) {
+ if (OpenLayers.Util.getBrowserName() == "msie") {
document.getElementById('bigimg_container').style.display = "block";
+ } else {
+ document.getElementById('bigimg_container').style.display = "table";
}
+
var maxHeight = document.body.clientHeight * 0.9;
var maxWidth = document.body.clientWidth * 0.9;
document.getElementById('bigimg').style.height = "";
}
div.style.display = "block";
div.appendChild(textNode);
+ },
+
+ escapeHTML: function (str) {
+ if (!str) {
+ return "";
+ }
+ return str.
+ replace(/&/gm, '&').
+ replace(/'/gm, ''').
+ replace(/"/gm, '"').
+ replace(/>/gm, '>').
+ replace(/</gm, '<');
}
}
};
// least as big as content. To achieve that, we need to override
// OpenLayers.Popup.Anchored.prototype.updateSize to modify it slightly.
OpenLayers.Popup.Anchored.prototype.updateSize = function() {
- // determine actual render dimensions of the contents by putting its
- // contents into a fake contentDiv (for the CSS) and then measuring it
- var preparedHTML = "<div class='" + this.contentDisplayClass+ "'>" +
- this.contentDiv.innerHTML +
- "</div>";
-
- var containerElement = (this.map) ? this.map.layerContainerDiv
- : document.body;
- var realSize = OpenLayers.Util.getRenderedDimensions(
- preparedHTML, null, {
- displayClass: this.displayClass,
- containerElement: containerElement
+ var self = this;
+
+ window.setTimeout(function() { // timeout added by SYP
+
+ // determine actual render dimensions of the contents by putting its
+ // contents into a fake contentDiv (for the CSS) and then measuring it
+ var preparedHTML = "<div class='" + self.contentDisplayClass+ "'>" +
+ self.contentDiv.innerHTML +
+ "</div>";
+
+ var containerElement = (self.map) ? self.map.layerContainerDiv
+ : document.body;
+ var realSize = OpenLayers.Util.getRenderedDimensions(
+ preparedHTML, null, {
+ displayClass: self.displayClass,
+ containerElement: containerElement
+ }
+ );
+
+ /*
+ * XXX: next four lines are added by SYP!
+ */
+ if (self.contentDiv) {
+ realSize.w = Math.max (realSize.w, self.contentDiv.scrollWidth);
+ realSize.h = Math.max (realSize.h, self.contentDiv.scrollHeight);
}
- );
-
- /*
- * XXX: next four lines are added by SYP!
- */
- if (this.contentDiv) {
- realSize.w = Math.max (realSize.w, this.contentDiv.scrollWidth);
- realSize.h = Math.max (realSize.h, this.contentDiv.scrollHeight);
- }
- // is the "real" size of the div is safe to display in our map?
- var safeSize = this.getSafeContentSize(realSize);
+ // is the "real" size of the div is safe to display in our map?
+ var safeSize = self.getSafeContentSize(realSize);
- var newSize = null;
- if (safeSize.equals(realSize)) {
- //real size of content is small enough to fit on the map,
- // so we use real size.
- newSize = realSize;
+ var newSize = null;
+ if (safeSize.equals(realSize)) {
+ //real size of content is small enough to fit on the map,
+ // so we use real size.
+ newSize = realSize;
- } else {
+ } else {
- //make a new OL.Size object with the clipped dimensions
- // set or null if not clipped.
- var fixedSize = new OpenLayers.Size();
- fixedSize.w = (safeSize.w < realSize.w) ? safeSize.w : null;
- fixedSize.h = (safeSize.h < realSize.h) ? safeSize.h : null;
+ //make a new OL.Size object with the clipped dimensions
+ // set or null if not clipped.
+ var fixedSize = new OpenLayers.Size();
+ fixedSize.w = (safeSize.w < realSize.w) ? safeSize.w : null;
+ fixedSize.h = (safeSize.h < realSize.h) ? safeSize.h : null;
if (fixedSize.w && fixedSize.h) {
//content is too big in both directions, so we will use
// run getRenderedDimensions() again with a fixed dimension
var clippedSize = OpenLayers.Util.getRenderedDimensions(
preparedHTML, fixedSize, {
- displayClass: this.contentDisplayClass,
+ displayClass: self.contentDisplayClass,
containerElement: containerElement
}
);
// adjust for that.
//
var currentOverflow = OpenLayers.Element.getStyle(
- this.contentDiv, "overflow"
+ self.contentDiv, "overflow"
);
if ( (currentOverflow != "hidden") &&
(clippedSize.equals(safeSize)) ) {
}
}
- newSize = this.getSafeContentSize(clippedSize);
+ newSize = self.getSafeContentSize(clippedSize);
}
}
- this.setSize(newSize);
+ self.setSize(newSize);
+ }, 0);
}