Re: [Maypole] Where do I place actions without a model ?

From: Dave Howorth (Dave.Howorth at acm.org)
Date: Mon Jan 10 2005 - 19:52:29 GMT


Peter Speltz wrote:
> --- Rolf Schaufelberger <rs at plusw.de> wrote:
>> Hi, I'm just evaluating Maypole and I didn't find any hint where I
>> can place actions which don't relate to a model.
>>
>> For instance : I use Plugin::I18N and want to place some links on
>> my page like : <base>/setLang?lang=en in order to switch the
>> language. Now how does a URL look like if I have no <table> and
>> where can I place a method which calls the lang method ? Wouldn't
>> it make sense to fall back BeerDB ? Right now nothing at all
>> happens when is_applicable returns 0 ?
>
> This is an excellent question. I don't believe I'd want to fall back
> on BeerDB as that IS Maypole, the holy $r. Also i think this is true
> : <base>/plain_templates_can_go_here, so it would be confusing.
>
> What would ideal solution be? Would it do to be able to have plain
> Models that don't relate to tables and put actions in them. so
> <base/settings/setLang?lang=en would map to Settings::setLang($r)
> call.

I think this is all good. IIRC, making models more flexible is something
Simon Flack is pondering on. I suspect he's on holiday at the moment
since we haven't heard from him since the new year, so perhaps he'll
give an answer when he returns.

There may be another possible answer to Rolf's original question. To
make the language setting mean anything, I think you need the concept of
a session, yes? If you're using
Maypole::Plugin::Authentication::UserSessionCookie to provide sessions,
then you can add the setLang action to the BeerDB::User class. The
UserSessionCookie pod also has a brief discussion of sessions without
users but I suspect it would need fleshing out a bit.

Cheers, Dave

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.6.9 - Release Date: 06/01/05

_______________________________________________ maypole mailing list maypole at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT