[Chameleon-dev] [Bug 1108] New: odd code in Locate.phtml

bugzilla-daemon at bugzilla.maptools.org bugzilla-daemon at bugzilla.maptools.org
Mon Jul 11 13:32:27 EDT 2005


http://bugzilla.maptools.org/show_bug.cgi?id=1108

           Summary: odd code in Locate.phtml
           Product: Chameleon
           Version: 2.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Widget
        AssignedTo: chameleon-dev at lists.maptools.org
        ReportedBy: mcgrawj at agr.gc.ca


I just came across some code in the Locate.phtml that seems like a mistake to 
me. In the javascript's apply function, you will see the code below near the 
bottom of the function. 

Questions:
Which block of code gets run when there are 3 tokens in the szLatLong string? I 
assume the first, but begs the question why is the second block there? And 
besides all that, how can the szElementType variable come out of either of 
these blocks being anything except "RECTANGLE". 

Anyway, it's not particularly important, since Locate appears to be working. 
But this looks like someone was trying to accomplish some functionality that 
probably isn't working. Someone may want to revisit the code. As it is, I am 
only in that code because I am using Locate as the foundation for another 
widget I am writing. I came across this and didn't know how the code really 
should be written. For now, I'm leaving it as it is in Locate. 

Cheers,
jtm
/*
 * szLatLong is a | delimited string.  First element is the name,
 * second is the coords ... third is possibly a feature
 */
var aVals = szLatLong.split( "|" );
if (aVals.length > 2)
{
    szElementType = "FEATURE";
    szElementType = "RECTANGLE";
}
else if (aVals.length > 2)
{
    if (aVals[1].indexOf( ";" ) != -1)
    {
        szElementType = "RECTANGLE";
    }
}



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Please do NOT reply to this email, use the link above instead to 
login to bugzilla and submit your comment. Any email reply to this
address will be lost.


More information about the Chameleon-dev mailing list