Bug 617 - [Chameleon - Widget]QuickZoom selection not preserved
: [Chameleon - Widget]QuickZoom selection not preserved
Status: NEW
: Chameleon
Widget
: 1.99
: PC Windows XP
: P2 enhancement
: FUTURE
Assigned To:
:
:
:
:
:
  Show dependency treegraph
 
Reported: 2004-08-13 07:42 by
Modified: 2004-08-13 07:56 (History)


Attachments


Note

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


Description From 2004-08-13 07:42:03
Eric Bridger reported:

I noticed a bug in the QuickZoom widget (Chameleon 1.99 beta 1 and 2).

The current selection: SEL_QUICKZOOM hidden variable was not getting
set, after the first submit, i.e. it was not sticky.  So if you quick
zoom, then pan, you lose the previous selection and wind up with the
first choice in your select list selected.  A minor problem since you
can then not select the first choice (it's an onChange event).

The problem is in the 

GetHTMLHiddenVariables() function.  The current value of SEL_QUICKZOOM
is not retrieved and reset.

This fix to widgets/QuickZoom.widget.php:

 function GetHTMLHiddenVariables()
    {
        parent::GetHTMLHiddenVariables();

        $szVariable = "NAV_QUICKZOOM";
        $szValue = " <INPUT TYPE=HIDDEN NAME=$szVariable VALUE=\"\">\n";
        $aReturn[$szVariable] = $szValue;

        $szVariable = "SEL_QUICKZOOM";
+       $szVal = "";
+       if ($this->isVarSet( $szVariable ))
+            $szVal = $this->getVar( $szVariable );
+      $szValue = " <INPUT TYPE=HIDDEN NAME=$szVariable
VALUE=\"$szVal\">\n";
        $aReturn[$szVariable] = $szValue;

        return $aReturn;
    }

This seems to fix the problem.  But I'm not sure if this is the correct
way to fix it, or how to ensure that this fix get's into a future
release.
------- Comment #1 From 2004-08-13 07:56:21 -------
One problem with the approach you mention here is that if you move the selection
to the previously selected value after you navigate, then you can never select
it again unless you select something else first.  For instance, if you select
PEI, then pan west and PEI stays selected, you can't select it again.  So this
generates the same problem as you have noted with the first element in the list.

The way to handle this in the widget is to make the first view tag a static
entry, as in:

<view name="Select a location"/>

This way, when you first select a quickzoom location, it will navigate to it and
set the selection to that entry.  On subsequent pages, it will reset to the
first element in the list, in this case the "Select a location" entry, which
allows you to pick any of the quick zoom locations.

The best enhancement would be to have the widget detect that the current extents
match the extents for a particular view and set that view as selected ... this
would require a lot of processing and would probably require a buffer operation
to provide a small tolerance to the selection
     
A compromise would be for the widget to remember the last set of extents that it
used and keep the selection as long as those extents don't change.  This would
mean that you would zoom to PEI and then could change layer visibility etc and
PEI would stay selected in the list.  As soon as you navigate away from those
exact extents, then it would reset the list to the first entry ...

I've put a copy of this in the bug.

Comments and suggestions welcome.