This issue is a placeholder for discussing UI changes.

HEAD currently has a tableless cssified UI for the location entry form, but it needs to be tested cross browser and discussed.

Comments

wim leers’s picture

Perhaps this is the right time then, to ask for initial feedback (possible tricky things I should take into account) before supporting the location CCK field in my Hierarchical Select module through a CCK widget?

Hierarchical Select expects – surprise, surprise – a hierarchy to work with. Obviously you *can* represent locations as hierarchies, but not everything . Country > state/province > city/postal code would work (on condition that every country has states defined, as well as postal codes, which is unlikely, so you would have to be able to fall back). But to be able to enter addresses, you will always need additional text fields.

Thoughts?

bdragon’s picture

I was actually looking at hierarchical select when thinking about this. Does the js degrade gracefully?

Some countries are administratively divided differently than others. Some countries aren't even consistent internally. Japan, for example, has some city/urban-like divisions on the top level. (http://en.wikipedia.org/wiki/Prefectures_of_Japan)

Also, postal codes are completely different than administrative boundaries in most countries, and shouldn't be part of the hierarchy *at all.*

This would work best as a hierarchy where each item knows what it is representing... (state/province/prefecture/city/region/department/town/village/division/whatever)

wim leers’s picture

When JS is disabled, a normal select is used. For version 3, I will provide more graceful degradation (which will also solve scalability issues when you've got thousands of nodes in the tree).

Postal codes not part of the hierarchy: no problem.

I'm not sure what you mean by "each item should know what it is representing", but: you have to generate some sort of identifier for each item in the tree (like taxonomy's term ids). You could easily make it such that you embed the "location type" (for lack of a better term) in this identifier.

To get an idea of how this would work, please give a look at the taxonomy implementation. See the Hierarchical Select hooks section, except for the hook_hierarchical_select_form_alter() implementation, that's irrelevant for location. I've copy/pasted all current code here, so you don't have to go through that rather large file: http://drupalbin.com/1189.

wim leers’s picture

Status update: Hierarchical Select 3 now has the more graceful degradation I was talking about, and the scalability issues have been solved. I hope to have the final ready in a couple of weeks.

Writing implementations is easy, but before I write one for the location module, I'd like to know if the API is considered stable? At least the part that I'm going to use. If there's no API for this part (i.e. I have to write the queries myself), then the question is if the database structure is considered stable.

jasontanner’s picture

I'm not sure if you have already considered this but it might be useful to have a grouping at a higher level than country - e.g. continent (or region). I have found this especially useful when searching - rather than on location entry.

Examples would be: Europe, Middle East, Africa, North America, South America, Oceania with countries grouped in each level. There are standard mappings for countries to region available that can be reused (http://en.wikipedia.org/wiki/List_of_countries_by_continent). I think I also have a couple of database tables I can provide dumps of that contain the mappings.

wim leers’s picture

jasontanner: that's one of the things I asked Bdragon to add, as per http://drupal.org/node/31609#comment-906923.

jasontanner’s picture

wim: did you get any indication as to whether it would be included for sure ?

And to clarify I mean: Continent -> Country -> (Region aka Province aka State aka Country)

wim leers’s picture

Nope: I didn't get a reply yet.

bdragon’s picture

Title: [master] [meta] Rewrite the location entry UI » [meta] Rewrite the location entry UI
Status: Active » Closed (duplicate)