[Mapbender-commits] r7915 - in trunk/mapbender: http/include
http/plugins http/print http/print/classes
resources/db/pgsql/UTF-8/update
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Jul 7 08:41:22 EDT 2011
Author: verenadiewald
Date: 2011-07-07 05:41:22 -0700 (Thu, 07 Jul 2011)
New Revision: 7915
Modified:
trunk/mapbender/http/include/dyn_php.php
trunk/mapbender/http/plugins/mb_print.php
trunk/mapbender/http/print/classes/mbLegendDecorator.php
trunk/mapbender/http/print/classes/mbMapDecorator.php
trunk/mapbender/http/print/classes/mbOverviewDecorator.php
trunk/mapbender/http/print/classes/mbTemplatePdf.php
trunk/mapbender/http/print/printFactory.php
trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.1_to_2.7.2_pgsql_UTF-8.sql
Log:
http://trac.osgeo.org/mapbender/ticket/828
Modified: trunk/mapbender/http/include/dyn_php.php
===================================================================
--- trunk/mapbender/http/include/dyn_php.php 2011-07-07 12:34:02 UTC (rev 7914)
+++ trunk/mapbender/http/include/dyn_php.php 2011-07-07 12:41:22 UTC (rev 7915)
@@ -24,7 +24,8 @@
$t = array('s', 's');
$res = db_prep_query($sql,$v,$t);
- echo "\n";
+ # there used to be a echo "\n"; here, but that doesn't make any common sense (problem with return value of printFactory.php)
+ //echo "\n";
while($row = db_fetch_array($res))
{
if (preg_match("/\w+\[\d+\]/", $row["var_name"])) {
Modified: trunk/mapbender/http/plugins/mb_print.php
===================================================================
--- trunk/mapbender/http/plugins/mb_print.php 2011-07-07 12:34:02 UTC (rev 7914)
+++ trunk/mapbender/http/plugins/mb_print.php 2011-07-07 12:41:22 UTC (rev 7915)
@@ -240,7 +240,7 @@
*/
var hookForm = function () {
var o = {
- url: '../print/printFactory.php',
+ url: '../print/printFactory.php?e_id='+myId,
type: 'post',
dataType: 'json',
beforeSubmit: validate,
Modified: trunk/mapbender/http/print/classes/mbLegendDecorator.php
===================================================================
--- trunk/mapbender/http/print/classes/mbLegendDecorator.php 2011-07-07 12:34:02 UTC (rev 7914)
+++ trunk/mapbender/http/print/classes/mbLegendDecorator.php 2011-07-07 12:41:22 UTC (rev 7915)
@@ -86,6 +86,7 @@
}
}
+ $this->pdf->unlink($legendFilename);
}
}
Modified: trunk/mapbender/http/print/classes/mbMapDecorator.php
===================================================================
--- trunk/mapbender/http/print/classes/mbMapDecorator.php 2011-07-07 12:34:02 UTC (rev 7914)
+++ trunk/mapbender/http/print/classes/mbMapDecorator.php 2011-07-07 12:41:22 UTC (rev 7915)
@@ -120,6 +120,8 @@
$this->pdf->objPdf->Text($this->conf->x_ul + $width - ($this->pdf->objPdf->GetStringWidth($myMaxx)), $this->conf->y_ul - 2, $myMaxx);
}
+
+ $this->pdf->unlink($this->filename);
}
}
Modified: trunk/mapbender/http/print/classes/mbOverviewDecorator.php
===================================================================
--- trunk/mapbender/http/print/classes/mbOverviewDecorator.php 2011-07-07 12:34:02 UTC (rev 7914)
+++ trunk/mapbender/http/print/classes/mbOverviewDecorator.php 2011-07-07 12:41:22 UTC (rev 7915)
@@ -92,6 +92,8 @@
}
$this->pdf->objPdf->Image($this->filename, $this->conf->x_ul, $this->conf->y_ul, $width, $height, 'png');
+
+ $this->pdf->unlink($this->filename);
}
protected function rotate($point, $center, $angle) {
Modified: trunk/mapbender/http/print/classes/mbTemplatePdf.php
===================================================================
--- trunk/mapbender/http/print/classes/mbTemplatePdf.php 2011-07-07 12:34:02 UTC (rev 7914)
+++ trunk/mapbender/http/print/classes/mbTemplatePdf.php 2011-07-07 12:41:22 UTC (rev 7915)
@@ -5,7 +5,8 @@
class mbTemplatePdf extends mbPdf {
/* it seems several decorators are going to need this information */
- public $mapInfo = array();
+ public $mapInfo = array();
+ public $unlinkFiles = false;
public function __construct($jsonConf) {
$this->confPdf = $jsonConf;
@@ -98,6 +99,12 @@
$this->isSaved = true;
}
}
+
+ public function unlink($filename) {
+ if($this->unlinkFiles && $this->unlinkFiles == 'true') {
+ unlink($filename);
+ }
+ }
}
Modified: trunk/mapbender/http/print/printFactory.php
===================================================================
--- trunk/mapbender/http/print/printFactory.php 2011-07-07 12:34:02 UTC (rev 7914)
+++ trunk/mapbender/http/print/printFactory.php 2011-07-07 12:41:22 UTC (rev 7915)
@@ -2,6 +2,7 @@
require_once dirname(__FILE__) . "/../php/mb_validateSession.php";
require_once dirname(__FILE__) . "/classes/factoryClasses.php";
+require_once dirname(__FILE__) . "/../include/dyn_php.php";
$pf = new mbPdfFactory();
@@ -18,6 +19,8 @@
$pdf = $pf->create($_REQUEST["printPDF_template"]);
+$pdf->unlinkFiles = $unlink;
+
$pdf->render();
try {
$pdf->save();
Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.1_to_2.7.2_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.1_to_2.7.2_pgsql_UTF-8.sql 2011-07-07 12:34:02 UTC (rev 7914)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.1_to_2.7.2_pgsql_UTF-8.sql 2011-07-07 12:41:22 UTC (rev 7915)
@@ -88,3 +88,9 @@
UPDATE gui_element SET e_mb_mod = '../../lib/printbox.js,../extensions/jquery-ui-1.7.2.custom/development-bundle/external/bgiframe/jquery.bgiframe.js,../extensions/jquery.form.min.js,../extensions/wz_jsgraphics.js'
WHERE e_id = 'printPDF' AND e_js_file = '../plugins/mb_print.php';
+-- new element var unlink for gui element template printPDF
+INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value, context, var_type)
+SELECT gui_element.fkey_gui_id, 'printPDF', 'unlink', 'true', 'delete print pngs after pdf creation' ,'php_var'
+FROM gui_element WHERE gui_element.e_id = 'printPDF' AND gui_element.e_js_file = '../plugins/mb_print.php' AND gui_element.fkey_gui_id
+NOT IN (SELECT fkey_gui_id FROM gui_element_vars
+WHERE var_name = 'unlink' AND fkey_e_id = 'printPDF');
\ No newline at end of file
More information about the Mapbender_commits
mailing list