X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FUI%2FWeb.pm;h=40abdc4a15e1fc5cdaac8e8b79705afbfae11761;hb=b79a8cb932946c849328a3c117c35821d9d21e66;hp=2d00d2c146337fad4604f1585342a04a3162dbcc;hpb=1702ffad58949ebe9e4769afeb9fe9c93249cf69;p=freeside.git diff --git a/FS/FS/UI/Web.pm b/FS/FS/UI/Web.pm index 2d00d2c14..40abdc4a1 100644 --- a/FS/FS/UI/Web.pm +++ b/FS/FS/UI/Web.pm @@ -3,6 +3,7 @@ package FS::UI::Web; use strict; use vars qw($DEBUG @ISA @EXPORT_OK $me); use Exporter; +use Carp qw( confess );; use FS::Conf; use FS::Misc::DateTime qw( parse_datetime ); use FS::Record qw(dbdef); @@ -134,7 +135,8 @@ sub svc_link { sub svc_label_link { my($m, $part_svc, $cust_svc) = @_ or return ''; - svc_X_link( ($cust_svc->label)[1], @_ ); + my($svc, $label, $svcdb) = $cust_svc->label; + svc_X_link( $label, @_ ); } sub svc_X_link { @@ -143,6 +145,9 @@ sub svc_X_link { return $x unless $FS::CurrentUser::CurrentUser->access_right('View customer services'); + confess "svc_X_link called without a service ($x, $m, $part_svc, $cust_svc)\n" + unless $cust_svc; + my $ahref = svc_url( 'ahref' => 1, 'm' => $m, @@ -479,6 +484,20 @@ sub cust_aligns { } } +=item is_mobile + +Utility function to determine if the client is a mobile browser. + +=cut + +sub is_mobile { + my $ua = $ENV{'HTTP_USER_AGENT'} || ''; + if ( $ua =~ /(?:hiptop|Blazer|Novarra|Vagabond|SonyEricsson|Symbian|NetFront|UP.Browser|UP.Link|Windows CE|MIDP|J2ME|DoCoMo|J-PHONE|PalmOS|PalmSource|iPhone|iPod|AvantGo|Nokia|Android|WebOS|S60|Opera Mini|Opera Mobi)/io ) { + return 1; + } + return 0; +} + ### # begin JSRPC code... ###