Bug 965 - WMSBrowser: bug in mySearch javascript function
: WMSBrowser: bug in mySearch javascript function
Status: RESOLVED FIXED
: Chameleon
Widget
: 2.0
: PC Windows XP
: P2 normal
: 2.2
Assigned To:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2005-02-17 02:42 by
Modified: 2005-05-27 16:13 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2005-02-17 02:42:33
There is a bug in the mySearch javascript function when you have the following
kind of capabilities structure:

+ nested2 (121)
  + tdn (122)
    + top10huizen (123)
      + Gemeentes0 (124)
    + top10lijnen (125)
      + Gemeentes1 (126)

Layer Gemeentes1, with layer_id 126, is not found by the function, and so no
preview is shown of that layer.

You can test this against:
http://www.vz.geodan.nl:1111/cgi-bin/44/mapserv.exe?map=/ms4w/apps/general/map/nested2.map&
------- Comment #1 From 2005-02-17 04:44:55 -------
I suggest the following for the mySearch function instead of the current
implementation:

function mySearch( sr, value )
{
    var i;
    var result = null;

    if (sr.GetValue( "layer_id" ) == value)
    {
      result = sr;
    }
    else
    {
        if (sr.maoChildren.length > 0)
        {
            for (i=0; result == null && i < sr.maoChildren.length; i++)
            {
                result = mySearch( sr.maoChildren[i], value );
            }
        }
    }
    return result;
}
------- Comment #2 From 2005-05-27 08:13:11 -------
Julien/Paul, are you guys okay with me fixing this in 2.2?
------- Comment #3 From 2005-05-27 09:33:42 -------
Sure! Please do!
------- Comment #4 From 2005-05-27 16:13:57 -------
Fixed in CVS version only.