summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/header.html30
-rw-r--r--httemplate/elements/menu.html20
-rw-r--r--httemplate/elements/searchbar-combined.html51
-rw-r--r--httemplate/search/searchbar.cgi16
4 files changed, 112 insertions, 5 deletions
diff --git a/httemplate/elements/header.html b/httemplate/elements/header.html
index c83529e..432e9c6 100644
--- a/httemplate/elements/header.html
+++ b/httemplate/elements/header.html
@@ -28,10 +28,14 @@ Example:
<META HTTP-Equiv="Cache-Control" Content="no-cache">
<META HTTP-Equiv="Pragma" Content="no-cache">
<META HTTP-Equiv="Expires" Content="0">
+% if ( $mobile ) {
+ <META NAME="viewport" content="width=device-width height=device-height user-scalable=yes">
+% }
<% include('menu.html', 'freeside_baseurl' => $fsurl,
'position' => $menu_position,
'nocss' => $nocss,
+ 'mobile' => $mobile,
) |n
%>
@@ -67,6 +71,19 @@ Example:
<TR>
+% if ( $mobile ) {
+
+ <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#cccccc">
+ <SCRIPT TYPE="text/javascript">
+ document.write(myBar.toString());
+ </SCRIPT>
+ </TD>
+ <TD STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079;width:auto" BGCOLOR="#cccccc">
+ <% include('searchbar-combined.html') |n %>
+ </TD>
+
+% } else {
+
<TD COLSPAN="7" WIDTH="100%" STYLE="padding:1px 0px 0px 0px;border-top: 1px solid #7e0079" BGCOLOR="#cccccc">
<SCRIPT TYPE="text/javascript">
document.write(myBar);
@@ -100,6 +117,7 @@ Example:
<TD COLSPAN=1 BGCOLOR="#cccccc" ALIGN="right" STYLE="padding-left:2px;padding-right:2px">
<% include('searchbar-ticket.html') |n %>
</TD>
+% }
</TR>
</TABLE>
@@ -154,6 +172,9 @@ Example:
my( $title, $menubar, $etc, $head ) = ( '', '', '', '' );
my( $nobr, $nocss ) = ( 0, 0 );
+
+my $mobile;
+
if ( ref($_[0]) ) {
my $opt = shift;
$title = $opt->{title};
@@ -162,12 +183,20 @@ if ( ref($_[0]) ) {
$head = $opt->{head};
$nobr = $opt->{nobr};
$nocss = $opt->{nocss};
+ $mobile = $opt->{mobile};
} else {
($title, $menubar) = ( shift, shift );
$etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
$head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
}
+if ( !defined($mobile) ) {
+ $mobile = FS::UI::Web::is_mobile();
+}
+if ( $cgi->param('mobile') =~ /^(\d)$/ ) { # allow client to override
+ $mobile = $1;
+}
+
my $conf = new FS::Conf;
my $curuser = $FS::CurrentUser::CurrentUser;
@@ -182,5 +211,4 @@ if ( scalar(@agentnums) == 1 ) {
} else {
$company_name = $conf->config('company_name');
}
-
</%init>
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index f558777..2ca2dbd 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -41,7 +41,17 @@
var myBar = new WebFXMenuBar;
-% foreach my $item ( keys %menu ) {
+% if ( $mobile ) {
+%
+% my( $subhtml, $submenuname ) = submenu(\%menu, 'Freeside');
+ <% $subhtml |n %>
+ myBar.add(new WebFXMenuButton("Freeside",
+ null,
+ null,
+ <% $submenuname |n %>));
+% }
+% else {
+% foreach my $item ( keys %menu ) {
%
% my( $url_or_submenu, $tooltip ) = @{ $menu{$item} };
%
@@ -59,8 +69,8 @@
myBar.add(new WebFXMenuButton("<% $item %>", "<% $url_or_submenu %>", "<% $tooltip %>" ));
% }
-%
-% }
+% } #foreach $item
+% } #if $mobile
myBar.show( null, 'vertical' );
myBar.width = 154;
@@ -72,6 +82,8 @@ my( %opt ) = @_;
my $conf = new FS::Conf;
my $fsurl = $opt{'freeside_baseurl'};
+my $mobile = $opt{'mobile'} || 0;
+
my $curuser = $FS::CurrentUser::CurrentUser;
#XXX Active tickets not assigned to a customer
@@ -634,7 +646,7 @@ $menu{'Reports'} = [ \%report_menu, 'Lists, reporting and graphing' ]
if keys %report_menu;
$menu{'Tools'} = [ \%tools_menu, 'Tools' ]
if keys %tools_menu;
-$menu{'Configuration'} = [ \%config_menu, 'Configuraiton and setup' ]
+$menu{'Configuration'} = [ \%config_menu, 'Configuration and setup' ]
if $curuser->access_right('Configuration')
|| $curuser->access_right('Edit package definitions')
|| $curuser->access_right('Edit global package definitions')
diff --git a/httemplate/elements/searchbar-combined.html b/httemplate/elements/searchbar-combined.html
new file mode 100644
index 0000000..20425cd
--- /dev/null
+++ b/httemplate/elements/searchbar-combined.html
@@ -0,0 +1,51 @@
+<DIV STYLE="display:inline;
+ padding:3px 7px;
+ font-size:16px;
+ float:right;
+ border:1px solid #cccccc">
+Search
+<FORM ACTION="<%$fsurl%>search/searchbar.cgi"
+ METHOD="GET"
+ STYLE="margin:0; display:inline">
+ <SCRIPT TYPE="text/javascript">
+var hints=new Array(<% join(',', map {"'$hints{$_}'"} @searches) |n%>);
+function update_hint() {
+ var s = document.getElementById('search_for');
+ var q = document.getElementById('q');
+ q.value = hints[s.selectedIndex];
+}
+function clear_hint() {
+ var s = document.getElementById('search_for');
+ var q = document.getElementById('q');
+ if ( q.value == hints[s.selectedIndex] ) {
+ q.value = '';
+ }
+}
+ </SCRIPT>
+ <SELECT NAME="search_for" id="search_for" STYLE="width:auto" onchange="update_hint()">
+% foreach (@searches) {
+ <OPTION NAME="<% $_ %>"><% $_ %></OPTION>
+% }
+ </SELECT>
+ <INPUT NAME="q" ID="q" TYPE="text" STYLE="width:140px" VALUE="<% $hints{$searches[0]} %>" onmousedown="clear_hint()">
+ <INPUT TYPE="submit" VALUE="Search" STYLE="width:auto">
+</FORM>
+</DIV>
+<%init>
+my $curuser = $FS::CurrentUser::CurrentUser;
+my @searches = ();
+push @searches, 'customers' if $curuser->access_right('List customers');
+push @searches, 'prospects' if $curuser->access_right('List prospects');
+push @searches, 'invoices' if $curuser->access_right('View invoices');
+push @searches, 'services' if $curuser->access_right('View customer services');
+push @searches, 'tickets' if FS::Conf->new->exists('ticket_system');
+
+my %hints = (
+ 'customers' => '(cust #, name, company)',
+ 'prospects' => '(name, company, phone)',
+ 'invoices' => '(invoice #)',
+ 'services' => '(user, email, phone...)',
+ 'tickets' => '(ticket #, subject, email)',
+);
+
+</%init>
diff --git a/httemplate/search/searchbar.cgi b/httemplate/search/searchbar.cgi
new file mode 100644
index 0000000..c932871
--- /dev/null
+++ b/httemplate/search/searchbar.cgi
@@ -0,0 +1,16 @@
+<%init>
+my %searches = (
+ 'customers' => 'cust_main.cgi?search_cust=',
+ 'prospects' => 'prospect_main.html?search_prospect=',
+ 'invoices' => 'cust_bill.html?invnum=',
+ 'services' => 'cust_svc.html?search_svc=',
+);
+if ( FS::Conf->new->config('ticket_system') ) {
+ $searches{'tickets'} = FS::TicketSystem->baseurl . 'index.html?q=';
+}
+
+$cgi->param('search_for') =~ /^(\w+)$/;
+my $search = $searches{$1} or die "unknown search type: '$1'\n";
+my $q = $cgi->param('q'); # pass through unparsed
+</%init>
+<% $cgi->redirect($search . $q) %>