Author: spadkins
Date: Mon Oct 16 11:31:03 2006
New Revision: 7951

Modified:
   p5ee/trunk/App-Widget/lib/App/Widget/Label.pm

Log:
enhance to allow Label to display a decoded form of a value or list of values

Modified: p5ee/trunk/App-Widget/lib/App/Widget/Label.pm
==============================================================================
--- p5ee/trunk/App-Widget/lib/App/Widget/Label.pm       (original)
+++ p5ee/trunk/App-Widget/lib/App/Widget/Label.pm       Mon Oct 16 11:31:03 2006
@@ -65,8 +65,36 @@
 
 sub html {
     my $self = shift;
-    my $html = $self->label();
-    $html;
+    my ($html);
+    if ($self->{values} || $self->{domain}) {
+        my ($values, $labels) = $self->values_labels();
+        my $value = $self->get_value();
+
+        if ($value =~ /,/) {
+            $html = "";
+            foreach my $val (split(/,/,$value)) {
+                $html .= ", " if ($html);
+                if (exists $labels->{$val}) {
+                    $html .= $labels->{$val};
+                }
+                else {
+                    $html .= "";
+                }
+            }
+        }
+        else {
+            if (exists $labels->{$value}) {
+                $html = $labels->{$value};
+            }
+            else {
+                $html = "";
+            }
+        }
+    }
+    else {
+        $html = $self->label();
+    }
+    return($html);
 }
 
 1;

Reply via email to