Opened 12 years ago

Closed 12 years ago

#390 closed defect (fixed)

Legend: layer's legend icon cannot be loaded if the layer's name contains brackets

Reported by: liuar Owned by: madair
Priority: P2 Milestone: 2.0
Component: Widgets Version: 2.0.0-RC1
Severity: Major Keywords:
Cc: Browser: Firefox 3 (beta)
External ID: 1313948 Operating System: All
state: Committed

Description

  1. Create a layer named 1(1).
  1. Create a weblayout with this layer and view it in browsers


For IE, everything works fine.

For FireFox, Chrome and Safari, the layer's legend is not loaded.

Attachments (1)

MapGuideLayer.patch (820 bytes ) - added by liuar 12 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 by liuar, 12 years ago

In Legend.js line 936,

this.domImg.style.backgroundImage = "url("+this.options.image+")";


If this.options.image contains brackets in its value, the assignment will fail in FF, Chrome and Safari. So if the layer name contains brackets, its legend icon will not display in the legend.

To resolve this problem, we can encode the image url by updating MapGuide.js line 1226,
From:

url += "&LAYERDEFINITION=" + encodeURIComponent(layer.resourceId);


To:

op = /\(/g; cp = /\)/g; 
url += "&LAYERDEFINITION=" + encodeURIComponent(layer.resourceId).replace(op, "%28").replace(cp, "%29");


replace "(" and ")" with valid url components "%28" and "%29".

by liuar, 12 years ago

Attachment: MapGuideLayer.patch added

comment:2 by liuar, 12 years ago

Resolution: fixed
state: NewCommitted
Status: newclosed

Fixed in ChangeSet [2134]

Note: See TracTickets for help on using tickets.