Make the display of a textarea instead of an HTMLarea independent of whether mobile styles are configured for the site. Refixes #11902.

This commit is contained in:
Colin Kuskie 2010-10-25 15:30:23 -07:00
parent dcae5190da
commit 6fced77b37
3 changed files with 23 additions and 6 deletions

View file

@ -184,7 +184,7 @@ Renders an HTML area field.
sub toHtml {
my $self = shift;
##Do not display a rich editor on any mobile browser.
if ($self->session->style->useMobileStyle) {
if ($self->session->style->mobileBrowser) {
return $self->SUPER::toHtml;
}
my $i18n = WebGUI::International->new($self->session);

View file

@ -123,6 +123,25 @@ sub makePrintable {
#-------------------------------------------------------------------
=head2 mobileBrowser ( )
Returns true if the user's browser matches any of the mobile browsers set in the config file.
=cut
sub mobileBrowser {
my $self = shift;
my $session = $self->session;
my $ua = $session->env->get('HTTP_USER_AGENT');
for my $mobileUA (@{ $session->config->get('mobileUserAgents') }) {
if ($ua =~ m/$mobileUA/) {
return 1;
}
}
}
#-------------------------------------------------------------------
=head2 useMobileStyle
Returns a true value if we are on a mobile display.
@ -143,11 +162,8 @@ sub useMobileStyle {
if (! $session->setting->get('useMobileStyle')) {
return $self->{_useMobileStyle} = 0;
}
my $ua = $session->env->get('HTTP_USER_AGENT');
for my $mobileUA (@{ $self->session->config->get('mobileUserAgents') }) {
if ($ua =~ m/$mobileUA/) {
return $self->{_useMobileStyle} = 1;
}
if ($self->mobileBrowser) {
return $self->{_useMobileStyle} = 1;
}
return $self->{_useMobileStyle} = 0;
}