phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property/inc class.pdf.inc.php class.uiinvoice....


From: Sigurd Nes
Subject: [Phpgroupware-cvs] property/inc class.pdf.inc.php class.uiinvoice....
Date: Sun, 02 Jul 2006 20:56:34 +0000

CVSROOT:        /sources/phpgroupware
Module name:    property
Changes by:     Sigurd Nes <sigurdne>   06/07/02 20:56:34

Modified files:
        inc            : class.pdf.inc.php class.uiinvoice.inc.php 
                         class.uiwo_hour.inc.php 
        inc/pdf        : class.pdf.php 

Log message:
        allow pdf with mod_deflate and IE

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.pdf.inc.php?cvsroot=phpgroupware&r1=1.7&r2=1.8
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.uiinvoice.inc.php?cvsroot=phpgroupware&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/property/inc/class.uiwo_hour.inc.php?cvsroot=phpgroupware&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/property/inc/pdf/class.pdf.php?cvsroot=phpgroupware&r1=1.3&r2=1.4

Patches:
Index: class.pdf.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.pdf.inc.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- class.pdf.inc.php   3 Feb 2006 12:05:49 -0000       1.7
+++ class.pdf.inc.php   2 Jul 2006 20:56:34 -0000       1.8
@@ -7,9 +7,79 @@
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package Cpdf
-       * @version $Id: class.pdf.inc.php,v 1.7 2006/02/03 12:05:49 sigurdne 
Exp $
+       * @version $Id: class.pdf.inc.php,v 1.8 2006/07/02 20:56:34 sigurdne 
Exp $
        */
 
+       class pdf__
+       {
+               function print_pdf($document = '',$document_name = 'document')
+               {
+                       $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       
+                       $browser = CreateObject('phpgwapi.browser');
+
+                       if($browser->BROWSER_AGENT != 'IE')
+                       {
+                               $size=strlen($document);
+                               $browser->content_header($document_name 
.'.pdf','application/pdf',$size);
+                               echo $document;
+                       }
+                       else
+                       {
+                               $dir = PHPGW_APP_INC  . '/..';
+                               $dir = $dir . SEP . 'pdf_files';
+  
+                               //save the file
+                               if (!file_exists($dir))
+                               {
+                                       die('Directory for temporary pdf-files 
is missing - pleace notify the Administrator');
+                               }
+
+                               $fname = tempnam($dir.SEP,'PDF_').'.pdf';
+ 
+                               $fp = fopen($fname,'w');
+                               fwrite($fp,$document);
+                               fclose($fp);
+
+                               if (!file_exists($fname))
+                               {
+                                       die('Directory for temporary pdf-files 
is not writeable to the webserver - pleace notify the Administrator');
+                               }
+
+                               $fname = $this->currentapp . '/pdf_files/'. 
basename($fname);
+                               echo '<html>
+                               <head>
+                               <SCRIPT LANGUAGE="JavaScript"><!-- 
+                               function go_now ()   { window.location.href = 
"'.$fname.'"; }
+                               //--></SCRIPT>
+                               </head>
+                               <body onLoad="go_now()"; >
+                               <a href="'.$fname.'">click here</a> if you are 
not re-directed.
+                               </body>
+                               </html>
+                               ';
+
+                               // also have a look through the directory, and 
remove the files that are older than a week
+                               if ($d = @opendir($dir))
+                               {
+                                       while (($file = readdir($d)) !== false)
+                                       {
+                                               if (substr($file,0,4)=="PDF_")
+                                               {
+                                                       // then check to see if 
this one is too old
+                                                       $ftime = 
filemtime($dir.'/'.$file);
+                                                       if (time()-$ftime > 
3600*24)
+                                                       {
+                                                               
unlink($dir.'/'.$file);
+                                                       }
+                                               }
+                                       }  
+                                       closedir($d);
+                               }
+                       }
+               }
+       }
+       
        include (PHPGW_APP_INC . '/pdf/class.pdf.php');
        include (PHPGW_APP_INC . '/pdf/class.ezpdf.php');
 ?>

Index: class.uiinvoice.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.uiinvoice.inc.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- class.uiinvoice.inc.php     28 Jun 2006 13:32:19 -0000      1.34
+++ class.uiinvoice.inc.php     2 Jul 2006 20:56:34 -0000       1.35
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage eco
-       * @version $Id: class.uiinvoice.inc.php,v 1.34 2006/06/28 13:32:19 
sigurdne Exp $
+       * @version $Id: class.uiinvoice.inc.php,v 1.35 2006/07/02 20:56:34 
sigurdne Exp $
        */
 
        /**
@@ -1474,12 +1474,7 @@
                        }
 
                        $document= $pdf->ezOutput();
-                       $size=strlen($document);
-
-                       $browser = CreateObject('phpgwapi.browser');
-                       
$browser->content_header('receipt.pdf','application/pdf',$size);
-
-                       echo $document;
+                       $pdf->print_pdf($document,'receipt_'.$voucher_id);
                }
 
 

Index: class.uiwo_hour.inc.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/class.uiwo_hour.inc.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- class.uiwo_hour.inc.php     20 Jun 2006 10:54:17 -0000      1.24
+++ class.uiwo_hour.inc.php     2 Jul 2006 20:56:34 -0000       1.25
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
        * @subpackage project
-       * @version $Id: class.uiwo_hour.inc.php,v 1.24 2006/06/20 10:54:17 
sigurdne Exp $
+       * @version $Id: class.uiwo_hour.inc.php,v 1.25 2006/07/02 20:56:34 
sigurdne Exp $
        */
 
        /**
@@ -1021,14 +1021,8 @@
                                                        ));
                        }
 
-               //      $pdf->ezStream();
                        $document= $pdf->ezOutput();
-                       $size=strlen($document);
-
-                       $browser = CreateObject('phpgwapi.browser');
-                       
$browser->content_header('tender.pdf','application/pdf',$size);
-
-                       echo $document;
+                       $pdf->print_pdf($document,'tender');
                }
 
                function prizebook()

Index: pdf/class.pdf.php
===================================================================
RCS file: /sources/phpgroupware/property/inc/pdf/class.pdf.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- pdf/class.pdf.php   13 Jan 2005 16:52:48 -0000      1.3
+++ pdf/class.pdf.php   2 Jul 2006 20:56:34 -0000       1.4
@@ -26,7 +26,8 @@
  * @package Cpdf
  */
 
-class pdf_ {
+class pdf_ extends pdf__
+{
 
 /**
 * the current number of pdf objects in the document




reply via email to

[Prev in Thread] Current Thread [Next in Thread]