Opened 16 years ago

Closed 15 years ago

#89 closed defect (fixed)

Search panel: incorrect parameters javascript calls

Reported by: pagameba Owned by: madair@…
Priority: P2 Milestone: 1.1
Component: Widgets Version: 1.0.6
Severity: Major Keywords:
Cc: Browser: All
External ID: Operating System: All
state: Approved

Description

Reported by Rémy, filed in mapguide trac as:

http://trac.osgeo.org/mapguide/ticket/630

This appears to be a copy/paste error when we brought the search panel over, to be fixed in 1.0 and trunk.

--

I found a fix that worked.

First, looking at widgets/Search/Search.templ:

function CellClicked(sel)
{
    var map = GetParent().Fusion.getMapByName(mapName);
    map.setSelection(sel, false, true);
}

Should be changed like this to match correctly the API:

function CellClicked(sel)
{
    var map = GetParent().Fusion.getMapByName(mapName);
    map.setSelection(sel, true);
}

Second, the call to setSelection from map object is (lib/Map.js):

setSelection: function(selText, requery, zoomTo) {
         for (var i=0; i<this.aMaps.length; i++ ) {
             this.aMaps[i].setSelection(selText, requery, zoomTo);
         }
      }

Should be changed like this to match correctly the API:

setSelection: function(selText, zoomTo) {
         for (var i=0; i<this.aMaps.length; i++ ) {
             this.aMaps[i].setSelection(selText, zoomTo);
         }
      },

Finally, setSelection from Mapguide.js has for params:

'selection': encodeURIComponent(selText),

it's proposed to change like this:

'selection': selText,

encodeURIComponent encodes twice the params and that make the call-back error happend.

We see that setSelection has finally in Mapguide.js only 2 parameters: selText, zoomTo. But in Map.js and Search.templ it was called with 3 parameters: selText, requery, zoomTo

Quite confusing for a mistake.

Rémy

Change History (7)

comment:1 by madair, 16 years ago

(In [1445]) re #89: make calls to setSelection consistent

comment:2 by madair, 16 years ago

Resolution: fixed
Status: newclosed

(In [1446]) closes #89: make calls to setSelection consistent; patch applied to 1.0 branch; also adds missing method for ViewOptions widget

comment:3 by cgountanis, 16 years ago

I noticed the widgets/Search/Search.templ was the only fix not committed. Was it not an issue or ignored?

comment:4 by poulet1212, 16 years ago

Resolution: fixed
Status: closedreopened

I can confirm what cgountanis sais. In the trunk, the widgets/Search/Search.templ IS the only fix NOT committed. That's why I reopened the ticket.

So the last thing to do is:

in: widgets/Search/Search.templ

change this:

function CellClicked(sel)
{
    var map = GetParent().Fusion.getMapByName(mapName);
    map.setSelection(sel, false, true);
}

to this:

function CellClicked(sel)
{
    var map = GetParent().Fusion.getMapByName(mapName);
    map.setSelection(sel, true);
}

Rémy

comment:5 by madair, 16 years ago

Milestone: 1.0.71.1

comment:6 by madair, 15 years ago

(In [1611]) re #89: adjust setSelection method call - missed from previous patch

comment:7 by madair, 15 years ago

Resolution: fixed
Status: reopenedclosed

(In [1612]) closes #89: adjust setSelection method call - missed from previous patch

Note: See TracTickets for help on using tickets.