summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/elements/header-full.html3
-rw-r--r--httemplate/elements/header-popup.html3
-rw-r--r--httemplate/elements/printtofit.js26
-rw-r--r--httemplate/pref/pref-process.html1
-rw-r--r--httemplate/pref/pref.html9
5 files changed, 40 insertions, 2 deletions
diff --git a/httemplate/elements/header-full.html b/httemplate/elements/header-full.html
index 611da10dc..2e1047486 100644
--- a/httemplate/elements/header-full.html
+++ b/httemplate/elements/header-full.html
@@ -47,6 +47,9 @@ Example:
<link rel="stylesheet" href="<% $fsurl %>elements/jquery-ui.min.css">
<SCRIPT SRC="<% $fsurl %>elements/jquery.js"></SCRIPT>
<SCRIPT SRC="<% $fsurl %>elements/jquery-ui.min.js"></SCRIPT>
+% if ( $FS::CurrentUser::CurrentUser->option('printtofit') ) {
+ <SCRIPT SRC="<% $fsurl %>elements/printtofit.js"></SCRIPT>
+% }
% }
<% include('init_overlib.html') |n %>
diff --git a/httemplate/elements/header-popup.html b/httemplate/elements/header-popup.html
index f1ac86cd5..04709ce53 100644
--- a/httemplate/elements/header-popup.html
+++ b/httemplate/elements/header-popup.html
@@ -30,6 +30,9 @@ Example:
<META HTTP-Equiv="Expires" Content="0">
% 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>
diff --git a/httemplate/elements/printtofit.js b/httemplate/elements/printtofit.js
new file mode 100644
index 000000000..66257fca8
--- /dev/null
+++ b/httemplate/elements/printtofit.js
@@ -0,0 +1,26 @@
+$().ready(function() {
+ var beforePrint = function() {
+ if ($('body').width() > 0) {
+ // 7.5 inches * 96 DPI; maybe make the width a user pref?
+ var maxwidth = 7.5 * 96;
+ $('body').css('zoom', maxwidth / $('body').width());
+ }
+ };
+ var afterPrint = function() {
+ $('body').css('zoom', 1);
+ }
+
+ if (window.matchMedia) { // chrome, most importantly; also IE10?
+ window.matchMedia('print').addListener(
+ function(mq) {
+ mq.matches ? beforePrint() : afterPrint();
+ }
+ );
+ } else { // other IE
+ $(window).on('beforeprint', beforePrint);
+ $(window).on('afterprint', afterPrint);
+ }
+ // got nothing for firefox
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=774398
+ // but firefox already has "shrink to fit"
+});
diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html
index 74a14939a..f5b5bb68e 100644
--- a/httemplate/pref/pref-process.html
+++ b/httemplate/pref/pref-process.html
@@ -55,6 +55,7 @@ unless ( $error ) { # if ($access_user) {
disable_html_editor disable_enter_submit_onetimecharge
enable_mask_clipboard_hack dashboard_customers
customer_view_emails
+ printtofit
email_address
snom-ip snom-username snom-password
vonage-fromnumber vonage-username vonage-password
diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html
index 24c6a4db9..a6b5ba740 100644
--- a/httemplate/pref/pref.html
+++ b/httemplate/pref/pref.html
@@ -143,6 +143,13 @@ Interface
</TR>
<TR>
+ <TH ALIGN="right">Scale documents to fit on a letter-size page</TH>
+ <TD ALIGN="left">
+ <INPUT TYPE="checkbox" NAME="printtofit" VALUE="Y" <% $curuser->option('printtofit') ? 'CHECKED' : '' %>>
+ </TD>
+ </TR>
+
+ <TR>
<TH ALIGN="right">How many recently-modified customers displayed on dashboard</TH>
<TD ALIGN="left" COLSPAN=2>
<INPUT TYPE="text" NAME="dashboard_customers" VALUE="<% $curuser->option('dashboard_customers') %>"></TD>
@@ -156,8 +163,6 @@ Interface
</TD>
</TR>
-
-
</TABLE>
<BR>