[tools 1/2] testbot/cgi: Add support for nameless actions.
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/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
This makes it easier to bookmark the page for custom values. Also make the action nameless for a cleaner URL. Signed-off-by: Francois Gouget <fgouget(a)codeweavers.com> --- testbot/web/Stats.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/testbot/web/Stats.pl b/testbot/web/Stats.pl index 8433c6d37..39c28789c 100644 --- a/testbot/web/Stats.pl +++ b/testbot/web/Stats.pl @@ -44,6 +44,7 @@ sub _initialize($$$) CreateBasicPropertyDescriptor("Days", "Days to analyze", !1, 1, "N", 2), ); $self->SUPER::_initialize($Request, $RequiredRole, \@PropertyDescriptors); + $self->{Method} = "get"; if (!$self->GetParam("Days") or !$self->Validate() or !int($self->GetParam("Days"))) # 00 case! @@ -368,7 +369,7 @@ sub GenerateBody($) sub GetActions($) { #my ($self) = @_; - return ["Update"]; + return [".Update"]; } sub GenerateFooter($) -- 2.30.2
participants (1)
-
Francois Gouget