Ticket #89 (closed defect: fixed)

Opened 4 years ago

Last modified 3 years ago

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: External ID:
state: Approved Browser: All
Operating System: All

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

Changed 4 years ago by madair

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

Changed 4 years ago by madair

  • status changed from new to closed
  • resolution set to fixed

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

Changed 3 years ago by cgountanis

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

Changed 3 years ago by poulet1212

  • status changed from closed to reopened
  • resolution fixed deleted

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

Changed 3 years ago by madair

  • milestone changed from 1.0.7 to 1.1

Changed 3 years ago by madair

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

Changed 3 years ago by madair

  • status changed from reopened to closed
  • resolution set to fixed

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

Note: See TracTickets for help on using tickets.