[Maypole] Choosing a $r->{template} based on the previous value of $r->{template}

From: Matt Adams (matt.adams at morcor.com)
Date: Thu Sep 30 2004 - 18:50:18 BST


Okay, here's one that stumps me. I'm not even sure if this should fit in to the
Maypole framework so I need some kind direction.

I don't like how do_edit always returns to either 'edit' or 'view' depending on
whether or not the edit was successful. I've several customized templates that
display data from one table in a couple of different ways and would like to use
do_edit to take care of what it does best.

I was thinking I'd build something like:

package Orange::CoolTable;

sub this_view :Exported { }
sub that_view :Exported { }

sub do_edit :Exported {
   my ($self, $r) = @_;
   $self->SUPER::do_edit($r);

   $r->{template} = $r->{the_previous_template};
}

So that no matter what, the user always ends up with the template that they
began at. Ex: If I tried to do_edit from that_view, I'd end up at that_view; if
I tried to do_edit from this_view, I'd end up at this_view.

Except that I'm not sure what to override and where to set
$r->{the_previous_template}.

Any thoughts on where I should be looking to set this?

Thanks in advance,

Matt

-- 
Matt Adams <matt.adams at morcor.com>
Development Specialist
Morcor Solutions Inc. <http://www.morcor.com/>
(613) 354-2912 x228

GnuPG public key at <http://staff.morcor.com/~madams/> Key fingerprint: BED5 B4F7 CCF5 D7B5 7C56 0505 9A0A A0FB C937 5975

_______________________________________________ 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:56 GMT