On Thu, Jun 25, 2009 at 1:54 AM, Christian Lackas <christ...@lackas.net>wrote:
> * Devin Austin <devin.aus...@gmail.com> [090625 09:43]: > > Hi Devin, > > > I would approach it so that when the user registers, they choose their > time > > zone. When they login, this information is stored into their session, and > > retrieved whenever. > > agreed. > > > I would store it in the session in the form you want it to be > > presented, which would save you whatever time it would take to be > > inflating it. > > Now the problem begins: > I have tables for studies, series and images (and many more), each of > them has multiple timestamps (e.g. when the study was created, the > series acquired, the image processed, and when everything was created > and deleted). > So when I access all these times, I would have to convert all of them, > e.g. in a template > > [% study.time.convertTZ(c.user) %] > [% series.time.convertTZ(c.user) %] > > rather than just use (after Catalyst knows about the users timezone, > somehow). > > [% study.time %] > [% series.time %] > > and I must not miss a single value. And things get even more complicated > when I filter for times (e.g. show images created in the last 3 hours), > or if I want to show only datasets whose deletion date is in the past > (could have be deleted in Europe and should also be gone in the US). > > I do know how to do all these things manually one by one, however, I > already foresee that I will miss TZ conversions somewhere or > accidentally do it twice in wrong direction, or ... > > I also know how to use inflation/deflation to a DateTime, which allows > me to specify ONE timezone in the Model, however, how do I change the > timezone on a per-user basis. > > Christian > > -- > http://www.invicro.com/ > > _______________________________________________ > List: Catalyst@lists.scsys.co.uk > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ > Hi Christian, Now the problem begins: > I have tables for studies, series and images (and many more), each of > them has multiple timestamps (e.g. when the study was created, the > series acquired, the image processed, and when everything was created > and deleted). > So when I access all these times, I would have to convert all of them, > e.g. in a template There we go, that's better :-) Check this out: http://search.cpan.org/~dkamholz/Catalyst-Plugin-Session-PerUser-0.03/lib/Catalyst/Plugin/Session/PerUser.pm That should allow you to stuff things into your session *per user*. I know this doesn't exactly help with converting each timestamp, but it's a start. I mean, you're going to have to retrieve each record per user anyway, why not retrieve, convert, and stuff it into the per-user session? -- Devin Austin http://www.codedright.net http://www.dreamhost.com/r.cgi?326568/hosting.html - Host with DreamHost!
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/