Re: Olson - Microsoft mappings

2003-09-23 Thread Rick Measham
  It's become painfully obvious that having end users choose
 a timezone based on the huge list that is provided natively
 by DateTime::TimeZone::all_names just isn't very practical
 at this time.  (Perhaps in the future when more people are
 used to dealing with the Olson names.)
snip

 Is there anyway to do some work on TimeZoneCatalog to get some
 different kinds of lists (for instance, a shortened list of
 timezones that removes zones that only have historical differnces)?
 Would anyone be opposed to/in favor of that?

At 10:31 PM -1000 22/9/03, Joshua Hoblitt replied:
I think you want DateTime::TimeZone::names_in_category().  Which 
accepts a scalar from the array returned by categories() and itself 
returns a list of Olson timezones.
Maybe there should be a method to get the list of zones as a 
Hash-of-Hashes-of-Hashes such that we have:

$time_zones = {
'Oceania' = {
'Australia' = {
Melbourne = 'Australia/Melbourne',
Sydney= 'Australia/Sydney',
},
'New Zealand' = {
Auckland  = 'NewZealand/Auckland',
},
},
'North America' = {
'United States' = {
'New York' = 'America/NewYork',
},
}
}
This would mean that we have tree data that can be used in forms. 
This code will turn it into a HTML select:

function make_select {
my %time_zones = (ref $_[0]) ? %{$_[0]} : @_;
foreach my $key ( sort keys %time_zones ) {
  if (ref $time_zones{$key}) {
print qq|\toptgroup label=$key\n|;
foreach my $subkey( sort keys %{$time_zones{$key}} ) {
  if (ref $time_zones{$key}{$subkey}) {
print qq|\t\toptgroup label=$subkey\n|;
foreach my $subsubkey( sort keys %{$time_zones{$key}{$subkey}} ) {
  print qq|\t\t\toption 
value=$time_zones{$key}{$subkey}{$subsubkey}$subsubkey/option\n|;
}
print qq|\t\t/optgroup\n|;
  } else {
print qq|\t\toption 
value=$time_zones{$key}{$subkey}$subkey/option\n|;
  }
}
print qq|\t/optgroup\n|;
  } else {
print qq|\toption value=$time_zones{$key}$key/option\n|;
  }
}

The above code would allow you to feed it with a sub group of the 
data hash or the whole hash:
$select = make_select( %time_zones );
$select_usa = make_select( $time_zones{'North America'}{'United States'} );




TAN: Elmz - no mail

2003-09-23 Thread Rick Measham
Is there some way I can turn off receieving email on this list 
without unsubscribing? I want to subscribe from two addresses (so 
messages are auto-approved) but only receive one copy.

Cheers!
Rick


Re: Olson - Microsoft mappings

2003-09-23 Thread Ben Bennett
I agree with Joshua's intent.  I think that the timezone selection
right now is the most difficult part of using DateTime if the user has
to specify it (and especially if you are not using a GUI).

I agree that changing DT::TZ is probably not the right thing to do.
Perhaps there should be a DT::TZ::Helper namespace?

I would also love a module that would set up appropriate
DT::TZ::Alias(es) for a given country.  So if I loaded
DT::TZ::Alias::Country qw(US); (or whatever) it would load EST as an
alias for America/New_York.

Finally, having the aliases US/Eastern makes a lot of sense to me.
Perhaps it would make sense to make equivalent alises for all of the
countries (possibly under a DT::TZ::Alias submodule).  So for
countries without different zones that is simply:
 China
 Britain
Then for countries with multiple zones:
 Australia/Eastern
etc.

  -ben

On Mon, Sep 22, 2003 at 10:31:38PM -1000, Joshua Hoblitt wrote:
  It's become painfully obvious that having end users choose
  a timezone based on the huge list that is provided natively
  by DateTime::TimeZone::all_names just isn't very practical
  at this time.  (Perhaps in the future when more people are
  used to dealing with the Olson names.)

..