Francois Gouget : testbot/cgi: Better select which FormPage fields can be shown / edited.
Alexandre Julliard
julliard at winehq.org
Tue Mar 22 16:37:57 CDT 2022
Module: tools
Branch: master
Commit: bcab71a7c81db6ec8a285d0ec761c1b295650fea
URL: https://source.winehq.org/git/tools.git/?a=commit;h=bcab71a7c81db6ec8a285d0ec761c1b295650fea
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Tue Mar 22 13:15:26 2022 +0100
testbot/cgi: Better select which FormPage fields can be shown / edited.
Also better document why each type of field can or cannot be edited /
shown.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/lib/ObjectModel/CGI/FormPage.pm | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/testbot/lib/ObjectModel/CGI/FormPage.pm b/testbot/lib/ObjectModel/CGI/FormPage.pm
index 3ac6223..e432fcb 100644
--- a/testbot/lib/ObjectModel/CGI/FormPage.pm
+++ b/testbot/lib/ObjectModel/CGI/FormPage.pm
@@ -208,6 +208,8 @@ sub GetInputType($$)
{
my ($self, $PropertyDescriptor) = @_;
+ # Note: Editing Detailrefs and Itemrefs is not supported which leaves only
+ # Basic and Enum property descriptors here.
return $PropertyDescriptor->GetClass() eq "Enum" ? "select" :
$PropertyDescriptor->GetType() eq "B" ? "checkbox" :
$PropertyDescriptor->GetType() eq "textarea" ? "textarea" :
@@ -331,12 +333,20 @@ sub DisplayProperty($$)
{
my ($self, $PropertyDescriptor) = @_;
- if ($PropertyDescriptor->GetClass() eq "Detailref")
- {
- return "";
- }
-
- return "rw";
+ return # Detailref fields point to a Collection of objects matching the
+ # primary key of this form data. As such they can neither be shown
+ # nor edited.
+ $PropertyDescriptor->GetClass() eq "Detailref" ? "" :
+ # Itemref fields are keys identifying other objects and thus would
+ # require careful validation if edited. Requiring users to manually
+ # type the appropriate key value would also be cumbersome so this is
+ # currently not supported. But they can be displayed.
+ $PropertyDescriptor->GetClass() eq "Itemref" ? "ro" :
+ # All other properties can be edited...
+ $PropertyDescriptor->GetClass() ne "Basic" ? "rw" :
+ $PropertyDescriptor->GetType() ne "S" ? "rw" :
+ # ...except autoincrement ones (shown as <unset> if undefined)
+ "ro";
}
sub GetActions($)
More information about the wine-cvs
mailing list