export cleanups and mobile style
This commit is contained in:
parent
93819cda0c
commit
1f3ab6a419
20 changed files with 518 additions and 318 deletions
|
|
@ -120,6 +120,51 @@ sub makePrintable {
|
|||
$self->{_makePrintable} = shift;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 useMobileStyle
|
||||
|
||||
Returns a true value if we are on a mobile display.
|
||||
|
||||
=cut
|
||||
|
||||
sub useMobileStyle {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $scratchCheck = $session->scratch->get('useMobileStyle');
|
||||
if (defined $scratchCheck) {
|
||||
return $scratchCheck;
|
||||
}
|
||||
if (exists $self->{_useMobileStyle}) {
|
||||
return $self->{_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;
|
||||
}
|
||||
}
|
||||
return $self->{_useMobileStyle} = 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setMobileStyle
|
||||
|
||||
Sets whether the mobile style should be used for this session.
|
||||
|
||||
=cut
|
||||
|
||||
sub setMobileStyle {
|
||||
my $self = shift;
|
||||
my $enableMobile = shift;
|
||||
$self->session->scratch->set('useMobileStyle', $enableMobile);
|
||||
return $enableMobile;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue