The parent of a Details page may not be a *List.pl page.
For instance a naive web interface for a Job -> Step hierarchy would result in a JobsList -> JobDetails -> StepsList -> StepDetails page tree. But such a page hierarchy would be very cumbersome to use so one would instead have JobsList -> JobDetails (with embedded StepsBlock) -> StepDetails. So the StepDetails page would link back to the JobDetails page and not to a *List page.
So a better name for the redirect method is the more generic RedirectToParent().
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- Also some pages may have more than one parent. This is the case of the RoleDetails page which should either go back to the main RolesList page, or to the UserDetails page. But that's for the Details page to figure out on its own. (Which in the RoleDetails page case it currently does not. But since it only bothers TestBot administrators and only on rare occasions it's a minor concern.) --- testbot/lib/ObjectModel/CGI/ItemPage.pm | 6 +++--- testbot/web/admin/UserDetails.pl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/ItemPage.pm b/testbot/lib/ObjectModel/CGI/ItemPage.pm index 690458e3a..cd40ba2e4 100644 --- a/testbot/lib/ObjectModel/CGI/ItemPage.pm +++ b/testbot/lib/ObjectModel/CGI/ItemPage.pm @@ -125,7 +125,7 @@ sub GetActions($) return $self->{HasRW} ? ["Save", "Cancel"] : []; }
-sub RedirectToList($) +sub RedirectToParent($) { my ($self) = @_;
@@ -139,11 +139,11 @@ sub OnAction($$) if ($Action eq "Save") { return !1 if (!$self->Save()); - exit($self->RedirectToList()); + exit($self->RedirectToParent()); } if ($Action eq "Cancel") { - exit($self->RedirectToList()); + exit($self->RedirectToParent()); }
return $self->SUPER::OnAction($Action); diff --git a/testbot/web/admin/UserDetails.pl b/testbot/web/admin/UserDetails.pl index 798063dd7..833a36d14 100644 --- a/testbot/web/admin/UserDetails.pl +++ b/testbot/web/admin/UserDetails.pl @@ -196,7 +196,7 @@ sub OnApprove($) return !1 if (!$self->Save()); $self->{ErrMessage} = $self->{Item}->Approve(); return !1 if (defined $self->{ErrMessage}); - exit($self->RedirectToList()); + exit($self->RedirectToParent()); }
sub OnReject($) @@ -208,7 +208,7 @@ sub OnReject($) return !1 if (defined $self->{ErrMessage}); # Forcefully log out that user by deleting his web sessions DeleteSessions($self->{Item}); - exit($self->RedirectToList()); + exit($self->RedirectToParent()); }
sub OnSave($) @@ -221,7 +221,7 @@ sub OnSave($) # Forcefully log out that user by deleting his web sessions DeleteSessions($self->{Item}); } - exit($self->RedirectToList()); + exit($self->RedirectToParent()); }
sub OnAction($$)