[tools] testbot/web: Highlight the submit page's File and Branch fields if invalid.

Francois Gouget fgouget at codeweavers.com
Wed Jul 6 09:05:06 CDT 2022


Unlike the other fields, these two fields are generated by the submit
page itself.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/web/Submit.pl | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index ca225b615d..c5423c7951 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -77,7 +77,7 @@ sub _Upload($)
     {
       umask($OldUMask);
       delete $self->{FileName};
-      $self->{ErrField} = "Upload";
+      $self->{ErrField} = "File";
       $self->{ErrMessage} = "Unable to save the uploaded file";
       return undef;
     }
@@ -85,7 +85,7 @@ sub _Upload($)
   else
   {
     delete $self->{FileName};
-    $self->{ErrField} = "Upload";
+    $self->{ErrField} = "File";
     $self->{ErrMessage} = "Unable to upload the file";
     return undef;
   }
@@ -709,6 +709,15 @@ sub GetPropertyDescriptors($)
   return $self->SUPER::GetPropertyDescriptors();
 }
 
+sub GetHtmlLabel($$)
+{
+  my ($self, $Label) = @_;
+
+  # This assumes that the label is also the field name
+  return "<label". ($self->IsErrField($Label) ? " class='errorfield'" : "")
+         .">$Label</label>";
+}
+
 sub GenerateFields($)
 {
   my ($self) = @_;
@@ -723,7 +732,7 @@ sub GenerateFields($)
 
   if ($self->{Page} == 1 or $self->{Page} == 4)
   {
-    print "<div class='ItemProperty'><label>File</label>",
+    print "<div class='ItemProperty'>", $self->GetHtmlLabel("File"),
           "<div class='ItemValue'>";
     if (defined $self->{FileName})
     {
@@ -749,7 +758,7 @@ sub GenerateFields($)
     }
     else
     {
-      print "<div class='ItemProperty'><label>Branch</label>",
+      print "<div class='ItemProperty'>", $self->GetHtmlLabel("Branch"),
             "<div class='ItemValue'>",
             "<select name='Branch' size='1'>";
       my $SortedBranches = $Branches->GetSortedItems();
-- 
2.30.2




More information about the wine-devel mailing list