Derived pages can use it to determine whether the form has any editable field.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/ObjectModel/CGI/FormPage.pm | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm index e286880fd..224bf3687 100644 --- a/testbot/lib/ObjectModel/CGI/FormPage.pm +++ b/testbot/lib/ObjectModel/CGI/FormPage.pm @@ -90,6 +90,7 @@ sub _initialize($$$$) $self->{HasRequired} = !1; $self->{ActionPerformed} = !1; $self->{Method} = "post"; + $self->{HasRW} = !1; }
=pod @@ -437,6 +438,7 @@ sub GenerateField($$$$) my $Value = $self->GetFormValue($PropertyDescriptor); if ($Display eq "rw") { + $self->{HasRW} = 1; print "<div class='ItemValue'>"; $self->GenerateValueInput($PropertyDescriptor, $Value, $Format); print "</div>";
This allows derived pages to offer a read-only view of the item details just by overriding DisplayProperty().
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/ObjectModel/CGI/ItemPage.pm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/ItemPage.pm b/testbot/lib/ObjectModel/CGI/ItemPage.pm index 1b77eea01..8bea816b0 100644 --- a/testbot/lib/ObjectModel/CGI/ItemPage.pm +++ b/testbot/lib/ObjectModel/CGI/ItemPage.pm @@ -132,10 +132,7 @@ sub GetActions($) { my ($self) = @_;
- my @Actions = @{$self->SUPER::GetActions()}; - push @Actions, "Save", "Cancel"; - - return @Actions; + return $self->{HasRW} ? ["Save", "Cancel"] : []; }
sub RedirectToList($)