[freeside-commits] freeside/httemplate/elements header.html, 1.45, 1.46 menu.html, 1.113, 1.114 searchbar-combined.html, NONE, 1.1

Mark Wells mark at wavetail.420.am
Wed Apr 27 01:31:03 PDT 2011


Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv23959/httemplate/elements

Modified Files:
	header.html menu.html 
Added Files:
	searchbar-combined.html 
Log Message:
RT mobile UI, #11630

--- NEW FILE: searchbar-combined.html ---
<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>

Index: menu.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/menu.html,v
retrieving revision 1.113
retrieving revision 1.114
diff -u -w -d -r1.113 -r1.114
--- menu.html	1 Apr 2011 02:52:15 -0000	1.113
+++ menu.html	27 Apr 2011 08:31:01 -0000	1.114
@@ -41,6 +41,16 @@
 
   var myBar = new WebFXMenuBar;
 
+% 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 $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 @@
   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')

Index: header.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/header.html,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -w -d -r1.45 -r1.46
--- header.html	3 Aug 2010 23:20:24 -0000	1.45
+++ header.html	27 Apr 2011 08:31:01 -0000	1.46
@@ -28,10 +28,14 @@
     <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 @@
 
       <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 @@
         <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 @@
 
 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 @@
   $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 @@
 } else {
   $company_name = $conf->config('company_name');
 }
-
 </%init>



More information about the freeside-commits mailing list