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@codeweavers.com --- 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 62c1499ab..638504d32 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) {