[1/5] testbot/web: Recognize 'textarea' properties and use the appropriate input type.
Francois Gouget
fgouget at codeweavers.com
Fri Jun 13 11:22:17 CDT 2014
This simplifies the code for web pages that have multiline input fields.
---
testbot/lib/ObjectModel/CGI/FormPage.pm | 15 ++++-----------
testbot/web/Feedback.pl | 14 +-------------
2 files changed, 5 insertions(+), 24 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm
index dc4a58a..77c02b3 100644
--- a/testbot/lib/ObjectModel/CGI/FormPage.pm
+++ b/testbot/lib/ObjectModel/CGI/FormPage.pm
@@ -221,17 +221,10 @@ sub GetInputType($$)
{
my ($self, $PropertyDescriptor) = @_;
- if ($PropertyDescriptor->GetClass() eq "Enum")
- {
- return "select";
- }
-
- if ($PropertyDescriptor->GetType() eq "B")
- {
- return "checkbox";
- }
-
- return "text";
+ return $PropertyDescriptor->GetClass() eq "Enum" ? "select" :
+ $PropertyDescriptor->GetType() eq "B" ? "checkbox" :
+ $PropertyDescriptor->GetType() eq "textarea" ? "textarea" :
+ "text";
}
sub GenerateField($$$)
diff --git a/testbot/web/Feedback.pl b/testbot/web/Feedback.pl
index 39558da..f0ae921 100644
--- a/testbot/web/Feedback.pl
+++ b/testbot/web/Feedback.pl
@@ -34,7 +34,7 @@ sub _initialize($$$)
my @PropertyDescriptors = (
CreateBasicPropertyDescriptor("Name", "Name", !1, !1, "A", 40),
CreateBasicPropertyDescriptor("EMail", "Email", !1, !1, "A", 40),
- CreateBasicPropertyDescriptor("Remarks", "Remarks", !1, 1, "A", 1024),
+ CreateBasicPropertyDescriptor("Remarks", "Remarks", !1, 1, "textarea", 1024),
);
$self->SUPER::_initialize($Request, $RequiredRole, \@PropertyDescriptors);
@@ -79,18 +79,6 @@ sub GetHeaderText($)
"or email address.";
}
-sub GetInputType($$)
-{
- my ($self, $PropertyDescriptor) = @_;
-
- if (substr($PropertyDescriptor->GetName(), 0, 8) eq "Remarks")
- {
- return "textarea";
- }
-
- return $self->SUPER::GetInputType($PropertyDescriptor);
-}
-
sub GetActions($)
{
my ($self) = @_;
--
2.0.0
More information about the wine-patches
mailing list