Author: spadkins
Date: Mon Feb 5 08:56:22 2007
New Revision: 8799
Modified:
p5ee/trunk/App-Widget/lib/App/Widget/Label.pm
Log:
onclick event for text
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 Feb 5 08:56:22 2007
@@ -65,34 +65,56 @@
sub html {
my $self = shift;
- my ($html);
+ my ($html, $text);
if ($self->{values} || $self->{domain}) {
my ($values, $labels) = $self->values_labels();
my $value = $self->get_value();
-
if ($value =~ /,/) {
- $html = "";
+ $text = "";
foreach my $val (split(/,/,$value)) {
- $html .= ", " if ($html);
+ $text .= ", " if ($text);
if (exists $labels->{$val}) {
- $html .= $labels->{$val};
+ $text .= $labels->{$val};
}
else {
- $html .= $val;
+ $text .= $val;
}
}
}
else {
if (exists $labels->{$value}) {
- $html = $labels->{$value};
+ $text = $labels->{$value};
+ }
+ else {
+ $text = "";
+ }
+ }
+ }
+ else {
+ $text = $self->label();
+ }
+ if ($self->{event}) {
+
+ $text = $self->{values};
+ my (@args);
+ my $args = $self->{event_args};
+ if ($args) {
+ if (ref($args)) {
+ @args = @$args;
}
else {
- $html = "";
+ @args = split(/,/, $args);
}
}
+ my $name = $self->{name};
+ my $event = "$name.$self->{event}";
+ if ($#args > -1) {
+ $event .= "(" . join(",", @args) . ")";
+ }
+ $html = "<a class=\"App-Label\" id=\"$name\" onclick=\"f=document.forms[0]; e=f['app.event']; e.value = '$event'; f.submit(); e.value = ''; return(0);\">$text</a>";
}
else {
- $html = $self->label();
+ $html = $text;
}
return($html);
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.