[Mapbender-commits] r3587 - in branches/print_dev: http/print
resources/db/update
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Feb 24 11:30:43 EST 2009
Author: mschulz
Date: 2009-02-24 11:30:43 -0500 (Tue, 24 Feb 2009)
New Revision: 3587
Modified:
branches/print_dev/http/print/mod_printPDF_div.php
branches/print_dev/http/print/printFactory.php
branches/print_dev/http/print/testConfigTemplate.json
branches/print_dev/resources/db/update/update_gui2_print.sql
Log:
added drop-down selection for template configurations
Modified: branches/print_dev/http/print/mod_printPDF_div.php
===================================================================
--- branches/print_dev/http/print/mod_printPDF_div.php 2009-02-24 16:28:58 UTC (rev 3586)
+++ branches/print_dev/http/print/mod_printPDF_div.php 2009-02-24 16:30:43 UTC (rev 3587)
@@ -25,13 +25,43 @@
echo "var myId = '".$e_id."';";
?>
+/* the array of json print config files */
+try{
+ if (mbPrintConfigFilenames){}
+}
+catch(e){
+ mbPrintConfigFilenames = new Array("testConfigTemplate.json");
+}
+
+/* the array of json print config titles */
+try{
+ if (mbPrintConfigTitles){}
+}
+catch(e){
+ mbPrintConfigTitles = new Array("Default");
+}
+
+/* the path where the json print config files reside*/
+try{
+ if (mbPrintConfigPath){}
+}
+catch(e){
+ mbPrintConfigPath = "../print/";
+}
+
eventInit.register(function () {
mod_printPDF_init();
});
function mod_printPDF_init() {
- /* first we'd need to read the json configuration */
- $.get("../print/testConfigTemplate.json", function(json, status){
+ /* first we'd need to build the configuration selection */
+ buildConfigSelector();
+ /* second we'd need to read the json configuration */
+ loadConfig(mbPrintConfigFilenames[0]);
+}
+
+function loadConfig(configFilename) {
+ $.get(mbPrintConfigPath + configFilename, function(json, status){
var obj = eval('(' + json + ')');
buildForm(obj);
hookForm();
@@ -153,11 +183,12 @@
* @param {Object} json the config object in json
*/
function buildForm(json) {
+ $(".print_option_dyn").remove();
var str = "";
for (var item in json.controls) {
var element = json.controls[item];
var element_id = myId + "_" + element.id;
- str += '<div class="print_option">\n';
+ str += '<div class="print_option_dyn">\n';
str += '<label class="print_label" for="'+element.id+'">'+element.label+'</label>\n';
switch (element.type) {
case "text":
@@ -180,6 +211,21 @@
if (str) $("#"+myId+"_formsubmit").before(str);
}
+/**
+ * Generates the configuration select element from the gui element vars
+ * mbPrintConfigFilenames and mbPrintConfigTitles
+ */
+function buildConfigSelector() {
+ var str = "";
+ str += '<label class="print_label" for="printPDF_template">Vorlage</label>\n';
+ str += '<select id="printPDF_template" name="printPDF_template" size="1" onchange="loadConfig(mbPrintConfigFilenames[this.selectedIndex]);">\n';
+ for (var i = 0; i < mbPrintConfigFilenames.length; i++) {
+ str += '<option value="'+mbPrintConfigFilenames[i]+'">'+mbPrintConfigTitles[i]+'</option>\n';
+ }
+ str += '</select><br />\n';
+ if (str) $("#printPDF_selector").append(str);
+}
+
function stripslashes( str ) {
return (str+'').replace(/\0/g, '0').replace(/\\([\\'"])/g, '$1');
}
\ No newline at end of file
Modified: branches/print_dev/http/print/printFactory.php
===================================================================
--- branches/print_dev/http/print/printFactory.php 2009-02-24 16:28:58 UTC (rev 3586)
+++ branches/print_dev/http/print/printFactory.php 2009-02-24 16:30:43 UTC (rev 3587)
@@ -3,7 +3,7 @@
require_once(dirname(__FILE__)."/classes/factoryClasses.php");
$pf = new mbPdfFactory();
-$pdf = $pf->create('testConfigTemplate.json');
+$pdf = $pf->create($_REQUEST["printPDF_template"]);
$pdf->render();
$pdf->save();
Modified: branches/print_dev/http/print/testConfigTemplate.json
===================================================================
--- branches/print_dev/http/print/testConfigTemplate.json 2009-02-24 16:28:58 UTC (rev 3586)
+++ branches/print_dev/http/print/testConfigTemplate.json 2009-02-24 16:30:43 UTC (rev 3587)
@@ -58,7 +58,22 @@
"height" : 185
},
"messung" : {
- "type" : "measure"
+ "type" : "measure",
+ "do_fill" : 0,
+ "fill_color" : {
+ "r" : 255,
+ "g" : 0,
+ "b" : 0
+ },
+ "do_stroke" : 0,
+ "stroke_color" : {
+ "r" : 0,
+ "g" : 0,
+ "b" : 0
+ },
+ "line_style" : {
+ "width" : 1.0
+ }
},
"minikarte" : {
"type" : "overview",
Modified: branches/print_dev/resources/db/update/update_gui2_print.sql
===================================================================
--- branches/print_dev/resources/db/update/update_gui2_print.sql 2009-02-24 16:28:58 UTC (rev 3586)
+++ branches/print_dev/resources/db/update/update_gui2_print.sql 2009-02-24 16:30:43 UTC (rev 3587)
@@ -8,6 +8,7 @@
</div>
<div id="printPDF_input">
<form id="printPDF_form" action="../print/printFactory.php">
+<div id="printPDF_selector"></div>
<div class="print_option">
<input type="hidden" id="map_url" name="map_url" value=""/>
<input type="hidden" id="overview_url" name="overview_url" value=""/>
More information about the Mapbender_commits
mailing list