Action names starting with a dot will not be sent to the form page. This
can be useful to get a clean 'get' URL.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/ObjectModel/CGI/FormPage.pm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm
index 2565c077b..83b078b24 100644
--- a/testbot/lib/ObjectModel/CGI/FormPage.pm
+++ b/testbot/lib/ObjectModel/CGI/…
[View More]FormPage.pm
@@ -555,6 +555,11 @@ Returns a list of actions that can be applied after completing or reading this
form. Each action is a string which is used as the label of a button at the
bottom of the form.
+If an action name starts with a dot, the button label omits the dot and the
+corresponding <input> field gets no name attribute. Note that this means the
+action name is not sent to the form so it probably does not make sense to have
+more than one such action per form.
+
By default there is no action.
=back
@@ -573,7 +578,9 @@ sub GenerateActions($)
print "<div class='ItemActions'>\n";
foreach my $Action (@{$self->GetActions()})
{
- print "<input type='submit' name='Action' value='$Action'/>\n";
+ print "<input type='submit' ";
+ print "name='Action' " if ($Action !~ s/^\.//);
+ print "value='$Action'/>\n";
}
print "</div>\n";
}
--
2.30.2
[View Less]
The whole point is to pass them to _initialize() so FormPage::Validate()
can then do its job.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/web/Activity.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/testbot/web/Activity.pl b/testbot/web/Activity.pl
index 272215f95..d98f50a6c 100644
--- a/testbot/web/Activity.pl
+++ b/testbot/web/Activity.pl
@@ -45,7 +45,7 @@ sub _initialize($$$)
my @PropertyDescriptors = (
…
[View More]CreateBasicPropertyDescriptor("Hours", "Hours", !1, 1, "N", 3),
);
- $self->SUPER::_initialize($Request, $RequiredRole);
+ $self->SUPER::_initialize($Request, $RequiredRole, \@PropertyDescriptors);
$self->{Method} = "get";
if (!$self->GetParam("Hours") or !$self->Validate() or
--
2.30.2
[View Less]
PageBase::Redirect() does not use the Page parameter and there is no
reason for it to need that parameter since it has $self->{Request}
and thus can already get any relevant HTTP request information.
CheckSecurePage() only has a $Page parameter in order to pass it to
Redirect() and the CheckSecurePage() callers never provide the $Page
parameter anyway.
Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com>
---
testbot/lib/ObjectModel/CGI/Page.pm | 2 +-
testbot/lib/…
[View More]WineTestBot/CGI/PageBase.pm | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/Page.pm b/testbot/lib/ObjectModel/CGI/Page.pm
index d5988803c..85e94b379 100644
--- a/testbot/lib/ObjectModel/CGI/Page.pm
+++ b/testbot/lib/ObjectModel/CGI/Page.pm
@@ -248,7 +248,7 @@ sub Redirect($$)
{
my ($self, $Location) = @_;
- return $self->{PageBase}->Redirect($self, $Location);
+ return $self->{PageBase}->Redirect($Location);
}
diff --git a/testbot/lib/WineTestBot/CGI/PageBase.pm b/testbot/lib/WineTestBot/CGI/PageBase.pm
index 6d94ae967..aa90245cf 100644
--- a/testbot/lib/WineTestBot/CGI/PageBase.pm
+++ b/testbot/lib/WineTestBot/CGI/PageBase.pm
@@ -92,7 +92,7 @@ sub new($$$$@)
! $Session->User->HasRole($RequiredRole))
{
my $LoginURL = "/Login.pl?Target=" . uri_escape($ENV{"REQUEST_URI"});
- exit($self->Redirect($Page, MakeSecureURL($LoginURL)));
+ exit($self->Redirect(MakeSecureURL($LoginURL)));
}
}
@@ -253,9 +253,9 @@ sub SessionActive($)
return !1;
}
-sub Redirect($$$)
+sub Redirect($$)
{
- my ($self, $Page, $Location) = @_;
+ my ($self, $Location) = @_;
$self->SetCookies();
if (substr($Location, 0, 4) ne "http")
@@ -278,13 +278,13 @@ sub Redirect($$$)
return 0; # a suitable exit code
}
-sub CheckSecurePage($$)
+sub CheckSecurePage($)
{
- my ($self, $Page) = @_;
+ my ($self) = @_;
if ($UseSSL && ! SecureConnection())
{
- exit($self->Redirect($Page, MakeSecureURL($ENV{"REQUEST_URI"})));
+ exit($self->Redirect(MakeSecureURL($ENV{"REQUEST_URI"})));
}
}
--
2.30.2
[View Less]