optionally scale to the page width when printing, #71301
[freeside.git] / httemplate / elements / header-popup.html
index 43d9bc3..6c0f80b 100644 (file)
@@ -1,23 +1,72 @@
-%
-%  my($title, $menubar) = ( shift, shift ); #$menubar is unused here though
-%  my $etc = @_ ? shift : ''; #$etc is for things like onLoad= etc.
-%  my $head = @_ ? shift : ''; #$head is for things that go in the <HEAD> section
-%  my $conf = new FS::Conf;
-%
+<%doc>
 
+Example:
+
+  <& /elements/header-popup.html,
+       {
+         'title'   => 'Title',
+         'menubar' => \@menubar,
+         'etc'     => '', #included in <BODY> tag, for things like onLoad=
+         'head'    => '', #included before closing </HEAD> tag
+         'nobr'    => 0,  #1 for no <BR><BR> after the title
+       }
+  &>
+
+  #old-style
+  include( '/elements/header.html', 'Title', $menubar, $etc, $head);
+
+</%doc>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <HTML>
   <HEAD>
     <TITLE>
-      <% $title %>
+      <% encode_entities($title) || $title_noescape |n %>
     </TITLE>
+    <!-- per RT, to prevent IE compatibility mode -->
+    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+    <!-- The X-UA-Compatible <meta> tag above must be very early in <head> -->
     <META HTTP-Equiv="Cache-Control" Content="no-cache">
     <META HTTP-Equiv="Pragma" Content="no-cache">
     <META HTTP-Equiv="Expires" Content="0"> 
-    <% $head %>
+%   unless ( $no_jquery ) {
+      <SCRIPT SRC="<% $fsurl %>elements/jquery.js"></SCRIPT>
+%     if ( $FS::CurrentUser::CurrentUser->option('printtofit') ) {
+      <SCRIPT SRC="<% $fsurl %>elements/printtofit.js"></SCRIPT>
+%     }
+%   }
+    <% $head |n %>
   </HEAD>
-  <BODY BGCOLOR="#e8e8e8" <% $etc %>>
+  <BODY <% $etc |n %>>
+    <link href="<%$fsurl%>elements/freeside.css" type="text/css" rel="stylesheet">
+% if ( $title || $title_noescape ) {
     <FONT SIZE=6>
-      <CENTER><% $title %></CENTER>
+      <CENTER><% encode_entities($title) || $title_noescape |n %></CENTER>
     </FONT>
+% }
+% unless ( $nobr ) {
     <BR><!--<BR>-->
+% }
+<%init>
+
+my( $title, $title_noescape, $menubar, $etc, $head ) = ( '', '', '', '', '' );
+my( $nobr, $no_jquery ) = ( 0, 0 );
+if ( ref($_[0]) ) {
+  my $opt = shift;
+  $title          = $opt->{title};
+  $title_noescape = $opt->{title_noescape};
+  $menubar        = $opt->{menubar};
+  $etc            = $opt->{etc};
+  $head           = $opt->{head};
+  $nobr           = $opt->{nobr};
+  #$nocss          = $opt->{nocss};
+  $no_jquery      = $opt->{no_jquery};
+} 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
+}
+$etc .= ' BGCOLOR="#f8f8f8"' unless $etc =~ /BGCOLOR/i;
+
+my $conf = new FS::Conf;
+
+</%init>