[mapguide-commits] r4616 - in sandbox/rfc71: mapviewerjava stdicons
viewerfiles
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Mar 3 03:47:39 EST 2010
Author: jng
Date: 2010-03-03 03:47:34 -0500 (Wed, 03 Mar 2010)
New Revision: 4616
Modified:
sandbox/rfc71/mapviewerjava/common.jsp
sandbox/rfc71/mapviewerjava/gettingstarted.jsp
sandbox/rfc71/mapviewerjava/viewoptions.jsp
sandbox/rfc71/stdicons/icon_buffer.gif
sandbox/rfc71/stdicons/icon_buffer_disabled.gif
sandbox/rfc71/stdicons/icon_pan.gif
sandbox/rfc71/stdicons/icon_pan_disabled.gif
sandbox/rfc71/stdicons/icon_print.gif
sandbox/rfc71/stdicons/icon_print_disabled.gif
sandbox/rfc71/viewerfiles/COPYRIGHT
sandbox/rfc71/viewerfiles/ajaxmappane.templ
sandbox/rfc71/viewerfiles/browserdetect.js
sandbox/rfc71/viewerfiles/bufferui.templ
sandbox/rfc71/viewerfiles/contextmenu.js
sandbox/rfc71/viewerfiles/dwfmappane.templ
sandbox/rfc71/viewerfiles/legendui.templ
sandbox/rfc71/viewerfiles/mainframe.templ
sandbox/rfc71/viewerfiles/sarissa.js
sandbox/rfc71/viewerfiles/statusbar.templ
sandbox/rfc71/viewerfiles/tasklist.templ
sandbox/rfc71/viewerfiles/util.js
Log:
#1053: Sync up sandbox with recent trunk changes
Modified: sandbox/rfc71/mapviewerjava/common.jsp
===================================================================
--- sandbox/rfc71/mapviewerjava/common.jsp 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/mapviewerjava/common.jsp 2010-03-03 08:47:34 UTC (rev 4616)
@@ -1,5 +1,5 @@
<%--
- -Copyright (C) 2004-2009 by Autodesk, Inc.
+ -Copyright (C) 2004-2010 by Autodesk, Inc.
-This library is free software; you can redistribute it and/or
-modify it under the terms of version 2.1 of the GNU Lesser
-General Public License as published by the Free Software Foundation.
@@ -165,9 +165,9 @@
{
str = str.replaceAll("'", "'");
str = str.replaceAll("\"", """);
- str = str.replaceAll("\n", " ");
str = str.replaceAll("<", "<");
str = str.replaceAll(">", ">");
+ str = str.replaceAll("\\\\n", "<br>");
return str;
}
Modified: sandbox/rfc71/mapviewerjava/gettingstarted.jsp
===================================================================
--- sandbox/rfc71/mapviewerjava/gettingstarted.jsp 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/mapviewerjava/gettingstarted.jsp 2010-03-03 08:47:34 UTC (rev 4616)
@@ -1,5 +1,5 @@
<%--
- -Copyright (C) 2004-2009 by Autodesk, Inc.
+ -Copyright (C) 2004-2010 by Autodesk, Inc.
-This library is free software; you can redistribute it and/or
-modify it under the terms of version 2.1 of the GNU Lesser
-General Public License as published by the Free Software Foundation.
@@ -80,10 +80,12 @@
outStream.write(fixedupHtml);
}
catch(MgException mge) {
- outStream.write(mge.GetDetails());
+ String errorMsg = EscapeForHtml(mge.GetDetails());
+ outStream.write(errorMsg);
}
catch(Exception e) {
- outStream.write(e.getMessage());
+ String errorMsg = EscapeForHtml(e.getMessage());
+ outStream.write(errorMsg);
}
%>
Modified: sandbox/rfc71/mapviewerjava/viewoptions.jsp
===================================================================
--- sandbox/rfc71/mapviewerjava/viewoptions.jsp 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/mapviewerjava/viewoptions.jsp 2010-03-03 08:47:34 UTC (rev 4616)
@@ -1,5 +1,5 @@
<%--
- -Copyright (C) 2004-2009 by Autodesk, Inc.
+ -Copyright (C) 2004-2010 by Autodesk, Inc.
-This library is free software; you can redistribute it and/or
-modify it under the terms of version 2.1 of the GNU Lesser
-General Public License as published by the Free Software Foundation.
Modified: sandbox/rfc71/stdicons/icon_buffer.gif
===================================================================
(Binary files differ)
Modified: sandbox/rfc71/stdicons/icon_buffer_disabled.gif
===================================================================
(Binary files differ)
Modified: sandbox/rfc71/stdicons/icon_pan.gif
===================================================================
(Binary files differ)
Modified: sandbox/rfc71/stdicons/icon_pan_disabled.gif
===================================================================
(Binary files differ)
Modified: sandbox/rfc71/stdicons/icon_print.gif
===================================================================
(Binary files differ)
Modified: sandbox/rfc71/stdicons/icon_print_disabled.gif
===================================================================
(Binary files differ)
Modified: sandbox/rfc71/viewerfiles/COPYRIGHT
===================================================================
--- sandbox/rfc71/viewerfiles/COPYRIGHT 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/COPYRIGHT 2010-03-03 08:47:34 UTC (rev 4616)
@@ -2,7 +2,7 @@
copyright shall be used for all source files in this directory
and subdirectories.
-Copyright (C) 2004-2009 by Autodesk, Inc.
+Copyright (C) 2004-2010 by Autodesk, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of version 2.1 of the GNU Lesser
Modified: sandbox/rfc71/viewerfiles/ajaxmappane.templ
===================================================================
--- sandbox/rfc71/viewerfiles/ajaxmappane.templ 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/ajaxmappane.templ 2010-03-03 08:47:34 UTC (rev 4616)
@@ -322,7 +322,7 @@
var slidercourse = 78;
var slidertop = 44;
var showSlider=%s;
-var selTtipText = safari ? "__#ENDSELSAFARI#__" : "__#ENDSEL#__";
+var selTtipText = macOS ? "__#ENDSELMAC#__" : "__#ENDSEL#__";
var curimg = "mapImage1";
var curSelImg = "selImage1";
var ovimgloaded = false;
@@ -331,7 +331,7 @@
var digitizing = false;
var cancelTgt;
var locale = '%s';
-var openHlinkText = safari ? "__#OPENHYPERLINKSAFARI#__" : "__#OPENHYPERLINK#__";
+var openHlinkText = macOS ? "__#OPENHYPERLINKMAC#__" : "__#OPENHYPERLINK#__";
var selectionColor = '0x0000FFFF'; // Blue
var lastLegendScaleUpdate = curScale;
var featureRequestUrl = '%s';
@@ -898,7 +898,9 @@
if(!processed)
{
HideHyperlinkTip();
- if(tool != 6 && e.ctrlKey)
+
+ // Ctrl + Click to open URL except MacOS, which using Command + Click
+ if(tool != 6 && ((e.ctrlKey && !macOS) || (e.metaKey && macOS )))
{
if(hlData.url != "")
ExecuteHyperlink(hlData.url);
@@ -929,7 +931,11 @@
StartToolFeedback(x, y, CIRCLE);
break;
case 6:
- if(!e.ctrlKey)
+ if((e.ctrlKey && !macOS) || (e.metaKey && macOS))
+ {
+ EndPolygonSelection(x, y);
+ }
+ else
{
if(polySel.xs.length == 0)
StartToolFeedback(x, y, POLY);
@@ -941,9 +947,6 @@
ToolFeedback(x, y);
}
}
- else
- EndPolygonSelection(x, y);
-
break;
}
}
@@ -966,11 +969,6 @@
InformationContextMenu(x,y);
else
{
- if(safari && tool == 6)
- {
- EndPolygonSelection(x - mapPosX, y);
- return false;
- }
if(parent.IsContextMenu())
ContextMenu(x, y);
}
@@ -1741,7 +1739,7 @@
url = webAgent + "?OPERATION=GETDYNAMICMAPOVERLAYIMAGE&FORMAT=PNG&VERSION=2.1.0&SESSION=" + sessionId + "&MAPNAME=" + encodeComponent(mapName) + "&SEQ=" + Math.random() + "&CLIENTAGENT=" + encodeComponent(clientAgent) + "&BEHAVIOR=2";
url += viewParams;
document.getElementById("overlay").innerHTML =
- '<img class="mapImage" name="' + reqId + '" id="mapImage" src="' + url + '" width=' + mapDevW + ' height=' + mapDevH + ' border=0 vspace=0 hspace=0 style="visibility: hidden; width: ' + mapDevW + 'px; height: ' + mapDevH + 'px;" onload="return OnMapOverlayImageLoaded(event)">';
+ '<img class="mapImage" name="' + reqId + '" id="mapImage" src="' + url + '" width=' + mapDevW + ' height=' + mapDevH + ' border=0 vspace=0 hspace=0 style="visibility: hidden; width: ' + mapDevW + 'px; height: ' + mapDevH + 'px;" onload="return OnMapOverlayImageLoaded(event)" onerror="return OnMapOverlayImageLoadedError(event)">';
if (opera)
document.getElementById("mapImage").src = document.getElementById("mapImage").src;
}
@@ -1751,7 +1749,7 @@
url = webAgent + "?OPERATION=GETDYNAMICMAPOVERLAYIMAGE&FORMAT=PNG&VERSION=2.1.0&SESSION=" + sessionId + "&MAPNAME=" + encodeComponent(mapName) + "&SEQ=" + Math.random() + "&CLIENTAGENT=" + encodeComponent(clientAgent) + "&BEHAVIOR=5&SELECTIONCOLOR=" + selectionColor;
url += viewParams;
document.getElementById('selOverlay').innerHTML =
- '<img class="mapImage" name="' + reqId + '" id="selectionImage" src="' + url + '" width=' + mapDevW + ' height=' + mapDevH + ' border=0 vspace=0 hspace=0 style="visibility: hidden; width: ' + mapDevW + 'px; height: ' + mapDevH + 'px;" onload="return OnSelectionOverlayImageLoaded(event)">';
+ '<img class="mapImage" name="' + reqId + '" id="selectionImage" src="' + url + '" width=' + mapDevW + ' height=' + mapDevH + ' border=0 vspace=0 hspace=0 style="visibility: hidden; width: ' + mapDevW + 'px; height: ' + mapDevH + 'px;" onload="return OnSelectionOverlayImageLoaded(event)" onerror="return OnSelectionOverlayImageLoadedError(event)">';
if (opera)
document.getElementById("selectionImage").src = document.getElementById("selectionImage").src;
}
@@ -1810,6 +1808,34 @@
return false;
}
+function OnMapOverlayImageLoadedError(e)
+{
+ var frmParent = parent.frames["tbFrame"];
+ var objDivRefresh = frmParent.document.getElementById("divRefresh");
+ if(objDivRefresh != null)
+ {
+ objDivRefresh.style.display='none';
+ }
+ mapLoading = false;
+
+ var text = this.req.responseText;
+
+ var message = text;
+
+ var startPos = text.indexOf("<h2>");
+ if(startPos != -1)
+ {
+ startPos = startPos + 4;
+ var endPos = text.indexOf("</h2>", startPos);
+ if(endPos != -1)
+ message = text.substring(startPos, endPos);
+ }
+
+ alert(message);
+
+ return false;
+}
+
function OnSelectionOverlayImageLoaded(e)
{
if(msie)
@@ -1858,6 +1884,27 @@
return false;
}
+function OnSelectionOverlayImageLoadedError(e)
+{
+ var text = this.req.responseText;
+
+ var messageErr = "";
+ var startPos = text.indexOf("<h2>");
+ if(startPos != -1)
+ {
+ startPos = startPos + 4;
+ var endPos = text.indexOf("</h2>", startPos);
+ if(endPos != -1)
+ messageErr = text.substring(startPos, endPos);
+ }
+ if(messageErr == "")
+ messageErr = "No feature available.";
+
+ alert(messageErr);
+
+ return false;
+}
+
function OnAlternateImageLoaded()
{
altimg = document.getElementById(curimg == "mapImage1"? "mapImage2": "mapImage1");
@@ -1894,7 +1941,16 @@
function RequestFailed(text)
{
- //placeholder for debugging output
+ var message = text;
+ var startPos = text.indexOf("<h2>");
+ if(startPos != -1)
+ {
+ startPos = startPos + 4;
+ var endPos = text.indexOf("</h2>", startPos);
+ if(endPos != -1)
+ message = text.substring(startPos, endPos);
+ }
+ alert(message);
}
function DraggingShape(e)
@@ -2725,7 +2781,12 @@
ProcessFeatureInfo(selRequest.responseXML.documentElement, append, which);
}
else
- RequestFailed("No response");
+ {
+ if(selRequest.responseText != "")
+ RequestFailed(selRequest.responseText);
+ else
+ RequestFailed("No response");
+ }
}
function CompareProperties(p1, p2)
@@ -2923,7 +2984,7 @@
dr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
dr.send(reqParams);
- if(dr.responseXML)
+ if(dr.status == 200)
{
var env = ParseEnvelope(dr.responseXML.documentElement);
if(env != null)
@@ -2936,6 +2997,8 @@
GotoView(centerX, centerY, scale, true, true);
}
}
+ else
+ RequestFailed(dr.responseText);
}
function ParseEnvelope(xmlRoot)
@@ -3636,8 +3699,7 @@
if(wheelZoomDelta == null)
{
//Determine the cursor position
- wheelZoomCursor = new Point(msie ? event.clientX - mapPosX : event.screenX - mapPosX,
- msie ? event.clientY : event.screenY);
+ wheelZoomCursor = new Point(event.clientX - mapPosX, event.clientY);
if(wheelZoomCursor.X < 0)
{
//Do not process wheel events in the property or legend area
Modified: sandbox/rfc71/viewerfiles/browserdetect.js
===================================================================
--- sandbox/rfc71/viewerfiles/browserdetect.js 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/browserdetect.js 2010-03-03 08:47:34 UTC (rev 4616)
@@ -7,6 +7,9 @@
var safari1or2 = false;
var safari3plus = false;
var safari = false;
+
+var macOS = navigator.appVersion.indexOf("Mac")!=-1;
+
if(!chrome && safariIndex != -1)
{
safari = true;
Modified: sandbox/rfc71/viewerfiles/bufferui.templ
===================================================================
--- sandbox/rfc71/viewerfiles/bufferui.templ 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/bufferui.templ 2010-03-03 08:47:34 UTC (rev 4616)
@@ -56,7 +56,7 @@
var transparent = 1;
var pickClr;
var thousandSeparator = "__#THOUSANDSEPARATOR#__";
-var decimalSeparator = "__#DECIMALSEPARATOR#__";
+var decimalSeparator = "__#DECIMALSEPARATOR#__";
function InitDocument()
{
@@ -107,7 +107,7 @@
elt.backgroundColor = transparent? "#ffffff": "#" + fbcolor;
elt.color = transparent? "black": "#" + fbcolor;
}
-
+
function Validate()
{
var field = document.getElementById("distance");
Modified: sandbox/rfc71/viewerfiles/contextmenu.js
===================================================================
--- sandbox/rfc71/viewerfiles/contextmenu.js 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/contextmenu.js 2010-03-03 08:47:34 UTC (rev 4616)
@@ -66,7 +66,7 @@
var menuObj = this.menuObj;
if(menuObj != null)
{
- var name = (firefox || safari3plus) ? this.attributes["name"].nodeValue: this.name;
+ var name = (chrome || firefox || safari3plus) ? this.attributes["name"].nodeValue : this.name;
if(name.indexOf("Sub:") == 0)
{
var subMenu = menuObj.subMenus[name.substr(4)];
@@ -105,7 +105,7 @@
catch(e) {}
}
- var enabled = (firefox || safari3plus) ? this.attributes["state"].nodeValue: this.state;
+ var enabled = (chrome || firefox || safari3plus) ? this.attributes["state"].nodeValue : this.state;
if(!enabled || enabled == "false")
return true;
}
@@ -133,10 +133,10 @@
}
catch(e) {}
}
- var name = (firefox || safari3plus) ? this.attributes["name"].nodeValue: this.name;
+ var name = (chrome || firefox || safari3plus) ? this.attributes["name"].nodeValue : this.name;
if(name.indexOf("Sub:") != 0)
{
- var enabled = (firefox || safari3plus) ? this.attributes["state"].nodeValue: this.state;
+ var enabled = (chrome || firefox || safari3plus) ? this.attributes["state"].nodeValue : this.state;
if(!enabled || enabled == "false")
return true;
}
@@ -279,9 +279,9 @@
var menuObj = tgt == null? null: tgt.menuObj;
if(menuObj != null)
{
- var state = (firefox || safari3plus) ? tgt.attributes["state"].nodeValue: tgt.state;
+ var state = (chrome || firefox || safari3plus) ? tgt.attributes["state"].nodeValue : tgt.state;
if(!(!state || state == "false"))
- executeOption(menuObj, (firefox || safari3plus) ? tgt.attributes["name"].nodeValue: tgt.name);
+ executeOption(menuObj, (chrome || firefox || safari3plus) ? tgt.attributes["name"].nodeValue : tgt.name);
return true;
}
else
@@ -377,10 +377,10 @@
if(obj == null)
break;
- var name = (firefox || safari3plus) ? obj.attributes["name"].nodeValue: obj.name;
+ var name = (chrome || firefox || safari3plus) ? obj.attributes["name"].nodeValue : obj.name;
if(name.indexOf("Sub:") != 0)
{
- var state = (firefox || safari3plus) ? obj.attributes["state"].nodeValue: obj.state;
+ var state = (chrome || firefox || safari3plus) ? obj.attributes["state"].nodeValue : obj.state;
var enabled = true;
if(menuObj.owner)
{
@@ -399,7 +399,7 @@
obj.style.color = enabled? "black": "#b4b4b4";
var iconElt = document.getElementById("PMI" + name);
if(iconElt)
- iconElt.src = enabled? ((firefox || safari3plus) ? obj.attributes["icon"].nodeValue: obj.icon): ((firefox || safari3plus) ? obj.attributes["icond"].nodeValue: obj.icond);
+ iconElt.src = enabled ? ((chrome || firefox || safari3plus) ? obj.attributes["icon"].nodeValue : obj.icon) : ((chrome || firefox || safari3plus) ? obj.attributes["icond"].nodeValue : obj.icond);
}
}
Modified: sandbox/rfc71/viewerfiles/dwfmappane.templ
===================================================================
--- sandbox/rfc71/viewerfiles/dwfmappane.templ 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/dwfmappane.templ 2010-03-03 08:47:34 UTC (rev 4616)
@@ -491,14 +491,14 @@
hidePopup(tbMenu);
hidePopup(ctxMenu);
}
-
+
function OnDblClick(x, y)
{
// Override this method in an external script to implement
// your own double-click handler.
// e.g. mapFrame.OnDblClick = MyOnDblClick
// where MyOnDblClick() is a function in your script
-
+
return false;
}
Modified: sandbox/rfc71/viewerfiles/legendui.templ
===================================================================
--- sandbox/rfc71/viewerfiles/legendui.templ 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/legendui.templ 2010-03-03 08:47:34 UTC (rev 4616)
@@ -195,14 +195,14 @@
var iconRequest = GetMapFrame().GetWebAgent() + "?OPERATION=GETLEGENDIMAGE&SESSION=" + GetMapFrame().GetSessionId() + "&VERSION=1.0.0&SCALE=" + scale + "&LAYERDEFINITION=" + encodeURIComponent(layerDef) + "&THEMECATEGORY=" + themeIndex + "&TYPE=" + geomtype + "&CLIENTAGENT=" + encodeURIComponent(clientAgent);
return iconRequest;
}
-
+
function BuildDelayedLoadIconImg(layerDef, scale, themeIndex, geomtype, iconId)
{
var request = BuildIconRequest(layerDef, scale, themeIndex, geomtype);
iconsToLoad.push(new IconRequest(iconId, '<img width="16" height="16" onerror="OnLoadIconError()" onload="OnLoadIcon()" src="' + request + '" />'));
return '<img width="16" height="16" src="../stdicons/transparentpixel.gif">';
}
-
+
function OnLoadIcon()
{
LoadNextIcon();
@@ -229,7 +229,7 @@
}
}
}
-
+
function IconRequest(id, request)
{
this.id = id;
@@ -277,10 +277,10 @@
if(styles.length <= 10)
sc.showlongtheme = true;
layerChildren.innerHTML = code;
-
+
sc.iconWasRequested = true;
}
-
+
layerIconImg = iconThemeLayer;
}
else
@@ -306,7 +306,7 @@
if(icElt != null)
icElt.innerHTML = layerIconImg;
}
-
+
function GetIconId(node)
{
return 'Ic_' + node.objectId;
@@ -357,7 +357,7 @@
Expand(node);
}
-// Expanding a node, the legend for the sub-items of this node will be generated dynamically
+// Expanding a node, the legend for the sub-items of this node will be generated dynamically
function Expand(node)
{
var elt = document.getElementById('ChildrenOf_' + node.objectId);
@@ -368,7 +368,7 @@
RefreshNodesState(node.children);
iconsToLoad.reverse();
LoadNextIcon();
-
+
if(node.type == 0 || HasLayerThemes(node))
ShowExpandedState(node);
}
@@ -759,7 +759,7 @@
}
-// there are three possible reasons to refresh the nodes' state:
+// there are three possible reasons to refresh the nodes' state:
// the first one is updating scale ranges to refresh the legend images
// the second one is expanding a group to build the legend images of layers in that group.
// the third one is expanding a layer node to build the legend images of themes in that layer.
@@ -810,7 +810,7 @@
break;
}
}
-
+
if(node.displayInLegend && node.curScale != -1)
{
// scale changed
@@ -818,8 +818,8 @@
{
// the layer's theme will be changed on demand
node.children[node.curScale].iconWasRequested = false;
-
- // the layer's legend image will be changed immediately
+
+ // the layer's legend image will be changed immediately
if(!HasCollapsedParent(node))
{
SetLayerStyles(node);
@@ -828,7 +828,6 @@
// the layer's legend image will be changed on demand
else
{
-
node.iconWasRequested = false;
}
}
@@ -839,7 +838,7 @@
node.iconWasRequested = true;
}
}
-
+
node.isDisplayed = node.displayInLegend && node.curScale != -1;
}
else if(node.type == 2)
Modified: sandbox/rfc71/viewerfiles/mainframe.templ
===================================================================
--- sandbox/rfc71/viewerfiles/mainframe.templ 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/mainframe.templ 2010-03-03 08:47:34 UTC (rev 4616)
@@ -12,6 +12,7 @@
var clientAgentName = 'Ajax Viewer';
var webAgentAddress = '%s';
var enablePingServer = %s;
+var serverSessionTimeout = %s;
var locale = '%s';
var hasToolbar = %s;
var hasStatusbar = %s;
@@ -44,9 +45,6 @@
var intervalID;
var pingServerFailTime;
-var isStartPingServer;
-var thousandSeparator = "__#THOUSANDSEPARATOR#__";
-var decimalSeparator = "__#DECIMALSEPARATOR#__";
function BasicCommand(name, action, icon, iconDisabled, tooltip, description)
{
@@ -426,32 +424,19 @@
RestoreView();
OnSelectionChanged();
DisplayMapSize();
- //ping server
+ //ping server
pingServerFailTime = 0;
- isStartPingServer = false;
if(enablePingServer)
- {
- GetServerSessionTimeout();
+ {
+ var pingServerInterval = serverSessionTimeout / 5 * 1000; //Ping server 5 times each period. Timeout is returned in seconds.
+ intervalID = window.setInterval(GetServerSessionTimeout, pingServerInterval);
}
}
-function handler()
+function handler()
{
- if(this.readyState == 4 && this.status == 200)
- {
- if(!isStartPingServer)
- {
- var num = ParseLocalizedFloat(this.responseText);
- if(!isNaN(num) && num != 0)
- {
- var pingServerInterval = num / 5 * 1000; //Ping server 5 times each period. Timeout is returned in seconds.
- intervalID = window.setInterval(GetServerSessionTimeout, pingServerInterval);
- isStartPingServer = true;
- }
- }
- }
- else if (this.readyState == 4 && this.status != 200)
- {
+ if(this.readyState == 4 && this.status != 200)
+ {
// error happens
if(pingServerFailTime < 6)
{
@@ -459,7 +444,6 @@
}
else
{
- if(isStartPingServer)
window.clearInterval(intervalID);
}
}
@@ -467,11 +451,9 @@
function GetServerSessionTimeout()
{
- var url = webAgentAddress + "?OPERATION=GETSESSIONTIMEOUT&VERSION=2.2.0&SESSION=" + GetMapFrame().GetSessionId() + "&LOCALE=" + locale + "&CLIENTAGENT=" + encodeComponent(clientAgentName) + "&REQUESTTIME=" + (new Date()).getTime();
+ var url = webAgentAddress + "?OPERATION=GETSESSIONTIMEOUT&VERSION=1.0.0&SESSION=" + GetMapFrame().GetSessionId() + "&LOCALE=" + locale + "&CLIENTAGENT=" + encodeComponent(clientAgentName) + "&REQUESTTIME=" + (new Date()).getTime();
var request = new XMLHttpRequest();
-
request.onreadystatechange = handler;
-
request.open('GET', url);
request.send(null);
}
@@ -920,7 +902,7 @@
mapUnitsType = GetMapFrame().GetMapUnitsType();
return mapUnitsType;
}
-
+
function FormatLocalizedDecimal(numberValue, decimalPlaces)
{
var unlocalized = numberValue.toFixed(decimalPlaces);
Modified: sandbox/rfc71/viewerfiles/sarissa.js
===================================================================
--- sandbox/rfc71/viewerfiles/sarissa.js 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/sarissa.js 2010-03-03 08:47:34 UTC (rev 4616)
@@ -9,25 +9,25 @@
* ====================================================================
* Licence
* ====================================================================
- * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="gpl.txt">gpl.txt</a>) or higher,
- * GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher
- * (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If
+ * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="gpl.txt">gpl.txt</a>) or higher,
+ * GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher
+ * (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If
* you make modifications under the ASL, i would appreciate it if you submitted those.
* In case your copy of Sarissa does not include the license texts, you may find
- * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and
+ * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and
* <a href="http://www.apache.org">http://www.apache.org</a>.
*
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
- * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
- * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE
- * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+ * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE
+ * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
- * <p>Sarissa is a utility class. Provides "static" methods for DOMDocument,
+ * <p>Sarissa is a utility class. Provides "static" methods for DOMDocument,
* DOM Node serialization to XML strings and other utility goodies.</p>
* @constructor
* @static
@@ -65,16 +65,16 @@
//This breaks for(x in o) loops in the old Safari
if(Sarissa._SARISSA_IS_SAFARI_OLD){
- HTMLHtmlElement = document.createElement("html").constructor;
- Node = HTMLElement = {};
- HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__;
- HTMLDocument = Document = document.constructor;
- var x = new DOMParser();
- XMLDocument = x.constructor;
- Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor;
- x = null;
+ HTMLHtmlElement = document.createElement("html").constructor;
+ Node = HTMLElement = {};
+ HTMLElement.prototype = HTMLHtmlElement.__proto__.__proto__;
+ HTMLDocument = Document = document.constructor;
+ var x = new DOMParser();
+ XMLDocument = x.constructor;
+ Element = x.parseFromString("<Single />", "text/xml").documentElement.constructor;
+ x = null;
}
-if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; }
+if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; }
// IE initialization
if(Sarissa._SARISSA_IS_IE){
@@ -141,13 +141,13 @@
var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
// if a root tag name was provided, we need to load it in the DOM object
if (sName){
- // create an artifical namespace prefix
+ // create an artifical namespace prefix
// or reuse existing prefix if applicable
var prefix = "";
if(sUri){
if(sName.indexOf(":") > 1){
prefix = sName.substring(0, sName.indexOf(":"));
- sName = sName.substring(sName.indexOf(":")+1);
+ sName = sName.substring(sName.indexOf(":")+1);
}else{
prefix = "a" + (Sarissa._sarissa_iNsCounter++);
}
@@ -161,14 +161,14 @@
}
return oDoc;
};
- // see non-IE version
+ // see non-IE version
Sarissa.getParseErrorText = function (oDoc) {
var parseErrorText = Sarissa.PARSED_OK;
if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode !== 0){
- parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason +
- "\nLocation: " + oDoc.parseError.url +
- "\nLine Number " + oDoc.parseError.line + ", Column " +
- oDoc.parseError.linepos +
+ parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason +
+ "\nLocation: " + oDoc.parseError.url +
+ "\nLine Number " + oDoc.parseError.line + ", Column " +
+ oDoc.parseError.linepos +
":\n" + oDoc.parseError.srcText +
"\n";
for(var i = 0; i < oDoc.parseError.linepos;i++){
@@ -187,7 +187,7 @@
oDoc.setProperty("SelectionNamespaces", sNsSet);
};
/**
- * An implementation of Mozilla's XSLTProcessor for IE.
+ * An implementation of Mozilla's XSLTProcessor for IE.
* Reuses the same XSLT stylesheet for multiple transforms
* @constructor
*/
@@ -213,16 +213,16 @@
var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID);
// make included/imported stylesheets work if exist and xsl was originally loaded from url
try{
- converted.resolveExternals = true;
- converted.setProperty("AllowDocumentFunction", true);
+ converted.resolveExternals = true;
+ converted.setProperty("AllowDocumentFunction", true);
}
catch(e){
// Ignore. "AllowDocumentFunction" is only supported in MSXML 3.0 SP4 and later.
- }
+ }
if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") !== null){
converted.async = false;
converted.load(xslDoc.url);
- }
+ }
else {
converted.loadXML(xslDoc.xml);
}
@@ -231,10 +231,10 @@
//this.outputMethod = output ? output.getAttribute("method") : "html";
if(output) {
this.outputMethod = output.getAttribute("method");
- }
+ }
else {
delete this.outputMethod;
- }
+ }
this.template.stylesheet = converted;
this.processor = this.template.createProcessor();
// for getParameter and clearParameters
@@ -262,14 +262,14 @@
}
this.processor.input = sourceDoc;
outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER);
- this.processor.output = outDoc;
+ this.processor.output = outDoc;
this.processor.transform();
var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID);
oDoc.loadXML(outDoc.output+"");
return oDoc;
}
};
-
+
/**
* Transform the given XML DOM and return the transformation result as a new DOM fragment.
* <b>Note</b>: The xsl:output method must match the nature of the owner document (XML/HTML).
@@ -306,7 +306,7 @@
}
return f;
};
-
+
/**
* Set global XSLT parameter of the imported stylesheet
* @argument nsURI The parameter namespace URI
@@ -344,7 +344,7 @@
return null;
}
};
-
+
/**
* Clear parameters (set them to default values as defined in the stylesheet itself)
*/
@@ -393,11 +393,11 @@
oDoc.onreadystatechange();
}
};
-
+
Sarissa.getDomDocument = function(sUri, sName){
var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null);
if(!oDoc.onreadystatechange){
-
+
/**
* <p>Emulate IE's onreadystatechange attribute</p>
*/
@@ -420,7 +420,7 @@
// do nothing
}// TODO: check if the new document has content before trying to copynodes, check for error handling in DOM 3 LS
else if(Sarissa._SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){
- //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good
+ //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good
/**
* <p>Factory method to obtain a new DOM Document object</p>
* @memberOf Sarissa
@@ -455,10 +455,10 @@
* @constructor
*/
DOMParser = function() { };
- /**
+ /**
* Construct a new DOM Document from the given XMLstring
* @param sXml the given XML string
- * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml).
+ * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml).
* @return a new DOM Document from the given XML string
*/
DOMParser.prototype.parseFromString = function(sXml, contentType){
@@ -545,7 +545,7 @@
* Get a string with the concatenated values of all string nodes under the given node
* @memberOf Sarissa
* @argument oNode the given DOM node
- * @argument deep whether to recursively scan the children nodes of the given node for text as well. Default is <code>false</code>
+ * @argument deep whether to recursively scan the children nodes of the given node for text as well. Default is <code>false</code>
*/
Sarissa.getText = function(oNode, deep){
var s = "";
@@ -596,7 +596,7 @@
};
/**
* <p> Copies the childNodes of nodeFrom to nodeTo</p>
- * <p> <b>Note:</b> The second object's original content is deleted before
+ * <p> <b>Note:</b> The second object's original content is deleted before
* the copy operation, unless you supply a true third parameter</p>
* @memberOf Sarissa
* @argument nodeFrom the Node to copy the childNodes from
@@ -605,9 +605,9 @@
*/
Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
if(Sarissa._SARISSA_IS_SAFARI && nodeTo.nodeType == Node.DOCUMENT_NODE){ // SAFARI_OLD ??
- nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node
+ nodeTo = nodeTo.documentElement; //Appearantly there's a bug in safari where you can't appendChild to a document node
}
-
+
if((!nodeFrom) || (!nodeTo)){
throw "Both source and destination nodes must be provided";
}
@@ -630,13 +630,13 @@
/**
* <p> Moves the childNodes of nodeFrom to nodeTo</p>
- * <p> <b>Note:</b> The second object's original content is deleted before
+ * <p> <b>Note:</b> The second object's original content is deleted before
* the move operation, unless you supply a true third parameter</p>
* @memberOf Sarissa
* @argument nodeFrom the Node to copy the childNodes from
* @argument nodeTo the Node to copy the childNodes to
* @argument bPreserveExisting whether to preserve the original content of nodeTo, default is
- */
+ */
Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) {
if((!nodeFrom) || (!nodeTo)){
throw "Both source and destination nodes must be provided";
@@ -666,9 +666,9 @@
}
};
-/**
+/**
* <p>Serialize any <strong>non</strong> DOM object to an XML string. All properties are serialized using the property name
- * as the XML element name. Array elements are rendered as <code>array-item</code> elements,
+ * as the XML element name. Array elements are rendered as <code>array-item</code> elements,
* using their index/key as the value of the <code>key</code> attribute.</p>
* @memberOf Sarissa
* @argument anyObject the object to serialize
@@ -693,7 +693,7 @@
return (s += (objectName.indexOf(' ')!=-1?"</array-item>\n":"</" + objectName + ">\n"));
};
-/**
+/**
* Escape the given string chacters that correspond to the five predefined XML entities
* @memberOf Sarissa
* @param sXml the string to escape
@@ -702,8 +702,8 @@
return sXml.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
};
-/**
- * Unescape the given string. This turns the occurences of the predefined XML
+/**
+ * Unescape the given string. This turns the occurences of the predefined XML
* entities to become the characters they represent correspond to the five predefined XML entities
* @memberOf Sarissa
* @param sXml the string to unescape
@@ -720,9 +720,9 @@
};
/**
- * Asynchronously update an element with response of a GET request on the given URL. Passing a configured XSLT
+ * Asynchronously update an element with response of a GET request on the given URL. Passing a configured XSLT
* processor will result in transforming and updating oNode before using it to update oTargetElement.
- * You can also pass a callback function to be executed when the update is finished. The function will be called as
+ * You can also pass a callback function to be executed when the update is finished. The function will be called as
* <code>functionName(oNode, oTargetElement);</code>
* @memberOf Sarissa
* @param sFromUrl the URL to make the request to
@@ -756,14 +756,14 @@
};
/**
- * Update an element's content with the given DOM node. Passing a configured XSLT
+ * Update an element's content with the given DOM node. Passing a configured XSLT
* processor will result in transforming and updating oNode before using it to update oTargetElement.
- * You can also pass a callback function to be executed when the update is finished. The function will be called as
+ * You can also pass a callback function to be executed when the update is finished. The function will be called as
* <code>functionName(oNode, oTargetElement);</code>
* @memberOf Sarissa
* @param oNode the URL to make the request to
* @param oTargetElement the element to update
- * @param xsltproc (optional) the transformer to use on the given
+ * @param xsltproc (optional) the transformer to use on the given
* DOM node before updating the target element with it
* @param callback (optional) a Function object to execute once the update is finished successfuly, called as <code>callback(oNode, oTargetElement)</code>
*/
@@ -818,9 +818,9 @@
var qs = "";
for(var i = 0;i < oForm.elements.length;i++) {
var oField = oForm.elements[i];
- var sFieldName = oField.getAttribute("name") ? oField.getAttribute("name") : oField.getAttribute("id");
+ var sFieldName = oField.getAttribute("name") ? oField.getAttribute("name") : oField.getAttribute("id");
// ensure we got a proper name/id and that the field is not disabled
- if(sFieldName &&
+ if(sFieldName &&
((!oField.disabled) || oField.type == "hidden")) {
switch(oField.type) {
case "hidden":
@@ -850,22 +850,22 @@
}
}
// return after removing last '&'
- return qs.substr(0, qs.length - 1);
+ return qs.substr(0, qs.length - 1);
};
/**
- * Asynchronously update an element with response of an XMLHttpRequest-based emulation of a form submission. <p>The form <code>action</code> and
- * <code>method</code> attributess will be followed. Passing a configured XSLT processor will result in
+ * Asynchronously update an element with response of an XMLHttpRequest-based emulation of a form submission. <p>The form <code>action</code> and
+ * <code>method</code> attributess will be followed. Passing a configured XSLT processor will result in
* transforming and updating the server response before using it to update the target element.
- * You can also pass a callback function to be executed when the update is finished. The function will be called as
+ * You can also pass a callback function to be executed when the update is finished. The function will be called as
* <code>functionName(oNode, oTargetElement);</code></p>
* <p>Here is an example of using this in a form element:</p>
- * <pre name="code" class="xml"><form action="/my/form/handler" method="post"
+ * <pre name="code" class="xml"><form action="/my/form/handler" method="post"
* onbeforesubmit="return Sarissa.updateContentFromForm(this, document.getElementById('targetId'));"><pre>
* <p>If JavaScript is supported, the form will not be submitted. Instead, Sarissa will
- * scan the form and make an appropriate AJAX request, also adding a parameter
- * to signal to the server that this is an AJAX call. The parameter is
+ * scan the form and make an appropriate AJAX request, also adding a parameter
+ * to signal to the server that this is an AJAX call. The parameter is
* constructed as <code>Sarissa.REMOTE_CALL_FLAG = "=true"</code> so you can change the name in your webpage
* simply by assigning another value to Sarissa.REMOTE_CALL_FLAG. If JavaScript is not supported
* the form will be submitted normally.
Modified: sandbox/rfc71/viewerfiles/statusbar.templ
===================================================================
--- sandbox/rfc71/viewerfiles/statusbar.templ 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/statusbar.templ 2010-03-03 08:47:34 UTC (rev 4616)
@@ -124,14 +124,14 @@
}
}
-function CalcKeyCode(aChar)
+function CalcKeyCode(aChar)
{
var character = aChar.substring(0,1);
var code = aChar.charCodeAt(0);
return code;
}
-function KeyboardController(val)
+function KeyboardController(val)
{
var strPass = val.value;
var strLength = strPass.length;
@@ -146,9 +146,9 @@
return false;
}
-function SetZoomToScale(val)
+function SetZoomToScale(val)
{
- if (val.value == "")
+ if (val.value == "")
{
val.value = origScaleValue;
return;
@@ -162,7 +162,7 @@
function OnScaleFieldKeyDown(event)
{
- if(event.keyCode==13)
+ if(event.keyCode==13)
{
document.getElementById("4").focus();
}
@@ -173,14 +173,14 @@
var scaleField = GetScaleField();
origScaleFieldBackground = scaleField.style.backgroundColor;
scaleField.style.backgroundColor = 'lightyellow';
- origScaleValue = scaleField.value;
+ origScaleValue = scaleField.value;
scaleField.value='';
}
function OnBlurScaleField()
{
var scaleField = GetScaleField();
- scaleField.style.backgroundColor = origScaleFieldBackground;
+ scaleField.style.backgroundColor = origScaleFieldBackground;
SetZoomToScale(scaleField);
}
Modified: sandbox/rfc71/viewerfiles/tasklist.templ
===================================================================
--- sandbox/rfc71/viewerfiles/tasklist.templ 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/tasklist.templ 2010-03-03 08:47:34 UTC (rev 4616)
@@ -116,14 +116,14 @@
var bgcolor = "#dcdcdc";
var color = "black";
- var name = (firefox || safari3plus) ? obj.attributes["name"].nodeValue: obj.name;
+ var name = (chrome || firefox || safari3plus) ? obj.attributes["name"].nodeValue: obj.name;
try
{
owner.OnCommandSelected(name);
}
catch(e) {}
- var enabled = ((firefox || safari3plus) ? obj.attributes["state"].nodeValue: obj.state) != "false";
+ var enabled = ((chrome || firefox || safari3plus) ? obj.attributes["state"].nodeValue: obj.state) != "false";
if(!enabled)
{
bgcolor = "#f0f0f0";
@@ -150,7 +150,7 @@
owner.OnCommandSelected(-1);
} catch(e) {}
- var enabled = ((firefox || safari3plus) ? obj.attributes["state"].nodeValue: obj.state) != "false";
+ var enabled = ((chrome || firefox || safari3plus) ? obj.attributes["state"].nodeValue: obj.state) != "false";
if(!enabled)
{
bgcolor = "#f0f0f0";
@@ -239,7 +239,7 @@
function OnClickItem(obj)
{
- var name = (firefox || safari3plus) ? obj.attributes["name"].nodeValue: obj.name;
+ var name = (chrome || firefox || safari3plus) ? obj.attributes["name"].nodeValue: obj.name;
try
{
owner.ExecuteCommand(name);
Modified: sandbox/rfc71/viewerfiles/util.js
===================================================================
--- sandbox/rfc71/viewerfiles/util.js 2010-03-03 00:36:32 UTC (rev 4615)
+++ sandbox/rfc71/viewerfiles/util.js 2010-03-03 08:47:34 UTC (rev 4616)
@@ -2,7 +2,7 @@
function encodeComponent(str) {
op = /\(/g; cp = /\)/g;
- return encodeURIComponent(str).replace(op, "%%28").replace(cp, "%%29");
+ return encodeURIComponent(str).replace(op, "%28").replace(cp, "%29");
}
function ParseLocalizedFloat(floatString) {
More information about the mapguide-commits
mailing list