Am Montag 10 Januar 2005 20:52 schrieb Dave Howorth:
> 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.
>
Yes, concerning the language setting you are right with the session, this
would be the next problem, since M::P::A::U creates a session only when an
authentication takes place, yet I need the language selection also in my
"public" part of the website, so I must simulate a login here or create a
session outside the Authetication (and reuse it there).
But the general question with non-model related actions is still there, and
Peters solution with a dummy table may be a solution, but it's just not
"clean" (don't know how to express is in english, I mean it's a workaround an
no proper conceptual solution).
I 've thought about a solution like starting the table part in the URL with
an underscore like <base>/_settings/setLang?lang=en and handler_guts calls
Settings::setlang without checking for table existance. But this is more ore
less the same than Peters solution.
Greetings Rolf
_______________________________________________
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