Author: spadkins
Date: Fri Jun 16 11:16:51 2006
New Revision: 6513
Modified:
p5ee/trunk/App-Widget/lib/App/Widget.pm
Log:
add theme support to all widgets via get_theme_value()
Modified: p5ee/trunk/App-Widget/lib/App/Widget.pm
==============================================================================
--- p5ee/trunk/App-Widget/lib/App/Widget.pm (original)
+++ p5ee/trunk/App-Widget/lib/App/Widget.pm Fri Jun 16 11:16:51 2006
@@ -448,6 +448,39 @@
return($html_attribs);
}
+sub get_theme_value {
+ &App::sub_entry if ($App::trace);
+ my ($self, $var, $default) = @_;
+
+ my $theme_values = $self->{theme_values};
+ if (!defined $theme_values) {
+ my $context = $self->{context};
+ my $theme = $self->{theme};
+ if (!$theme) {
+ $theme = $context->get_user_option("theme") || "default";
+ $self->{theme} = $theme if ($theme);
+ }
+ my $theme_domain = $context->value_domain("theme.$theme",
+ class => "App::ValueDomain::Repository,
+ repository => "default",
+ table => "value_domain",
+ params => { name => "theme.$theme" },
+ valuecolumn => "value",
+ labelcolumn => "label");
+ $theme_values = $theme_domain->values();
+ $self->{theme_values} = $theme_values;
+ }
+ my $name = $self->{name};
+ my $class = ref($self);
+ my $value = $theme_values->{"$name.$var"};
+ $value = $theme_values->{"$class.$var"} if (!defined $value);
+ $value = $theme_values->{$var} if (!defined $value);
+ $value = $default if (!defined $value && defined $default);
+
+ &App::sub_exit($value) if ($App::trace);
+ return($value);
+}
+
sub html {
my ($self) = @_;
return $self->html_escape($self->{name});
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.