From 1e105b0140935abad3e15e23294eb359503abc6f Mon Sep 17 00:00:00 2001
From: tux091 <renaud.legac@free.fr>
Date: Thu, 8 Mar 2012 21:54:44 +0100
Subject: [PATCH] Final touch in order to run with application embeded in the
 browser.

---
 controllers/reports.py       | 18 +++++++++++-------
 views/reports/report_2.latex |  4 ++--
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/controllers/reports.py b/controllers/reports.py
index a58620e6..8893c987 100644
--- a/controllers/reports.py
+++ b/controllers/reports.py
@@ -22,21 +22,25 @@ def report_2():
     """
 
     vars = request.vars
+    fmt = vars.Foo1My_format 
     # user request a file with a specific format (latex,...)
     # return to the browser na iframe balise with a new URL
     # the browser will request the file locate at the url
-    if vars.Foo1My_format and vars.Foo1My_format == 'latex':
+    # The iframe occupy all the space in the receiving container
+    # it is usefull for embeded application like acroread.
+    if  fmt and fmt != 'html':
 
-        # remove the field use to select the file format
-        # in order to avoid circular loop
         del vars.Foo1My_format
 
         s = IFRAME(_id='MyId',
                    _frameborder=0,
-                   _width=0,
-                   _height=0,
-                   _css='display:none;visibility:hidden;height:0px;',
-                   _src=URL('reports', 'report_2.latex', vars=vars)).xml()
+                   _width="100%",
+                   _height="100%",
+                   _src=URL('reports', 'report_2.%s' % fmt, vars=vars)).xml()
+
+        # remove the field use to select the file format
+        # in order to avoid circular loop
+        del fmt
 
         return s
 
diff --git a/views/reports/report_2.latex b/views/reports/report_2.latex
index e0efffea..dbc18fdf 100644
--- a/views/reports/report_2.latex
+++ b/views/reports/report_2.latex
@@ -5,7 +5,7 @@
 \begin{document}
 \section*{Test}
 \begin{enumerate}
- {{for k in test:}}
- \item {{=k}}: {{=test[k]}}{{pass}}
+ {{for k in test:}}\item {{=k.replace('_', ' ')}}: {{=test[k]}}
+ {{pass}}
 \end{enumerate}
 \end{document}
\ No newline at end of file
-- 
GitLab