Francois Gouget : testbot/cgi: Add a format parameter to GenerateHTMLValue().

Alexandre Julliard julliard at winehq.org
Mon Apr 25 16:23:48 CDT 2022


Module: tools
Branch: master
Commit: 46ecbb6325b91c03be6d3a376d86c67e71f9d348
URL:    https://source.winehq.org/git/tools.git/?a=commit;h=46ecbb6325b91c03be6d3a376d86c67e71f9d348

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Mon Apr 25 20:50:21 2022 +0200

testbot/cgi: Add a format parameter to GenerateHTMLValue().

This mostly allows specifying how it should format timestamps, though it
could also be used to force intepreting an integer property as a
boolean, etc.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 testbot/lib/ObjectModel/CGI/ValueFormatter.pm | 31 ++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)

diff --git a/testbot/lib/ObjectModel/CGI/ValueFormatter.pm b/testbot/lib/ObjectModel/CGI/ValueFormatter.pm
index 62c1499..638504d 100644
--- a/testbot/lib/ObjectModel/CGI/ValueFormatter.pm
+++ b/testbot/lib/ObjectModel/CGI/ValueFormatter.pm
@@ -163,27 +163,48 @@ Generates an HTML snippet representing the value in a user-readable form.
 The Parent parameter must point to a class that implements the escapeHTML()
 method.
 
+The format parameter can be used to specify how to display the specified
+value and should have one of the basic property descriptor types with a couple
+of extensions for timestamps:
+
+=over
+
+=item "DT"
+Show the date and time mostly in ISO 8601 format. This is the default format
+for timestamp properties.
+
+=item "timetipdate"
+Same as above but put the date part in a tooltip.
+
+=back
+
 =back
 =cut
 
-sub GenerateValueHTML($$$);
+sub GenerateValueHTML($$$;$);
 
-sub GenerateValueHTML($$$)
+sub GenerateValueHTML($$$;$)
 {
-  my ($Parent, $PropertyDescriptor, $Value) = @_;
+  my ($Parent, $PropertyDescriptor, $Value, $Format) = @_;
 
   if ($PropertyDescriptor->GetClass() eq "Basic")
   {
-    if ($PropertyDescriptor->GetType() eq "B")
+    $Format ||= $PropertyDescriptor->GetType();
+    if ($Format eq "B")
     {
       print $Value ? "Yes" : "No";
       return;
     }
-    if ($PropertyDescriptor->GetType() eq "DT")
+    if ($Format eq "DT")
     {
       GenerateDateTime($Value);
       return;
     }
+    if ($Format eq "timetipdate")
+    {
+      GenerateTimeTipDate($Value);
+      return;
+    }
   }
   elsif ($PropertyDescriptor->GetClass() eq "Itemref" and defined $Value)
   {




More information about the wine-cvs mailing list