[Mapbender-commits] r3460 - branches/print_dev/http/print

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jan 14 16:44:36 EST 2009


Author: mschulz
Date: 2009-01-14 16:44:36 -0500 (Wed, 14 Jan 2009)
New Revision: 3460

Modified:
   branches/print_dev/http/print/mod_printPDF_div.php
   branches/print_dev/http/print/testConfigTemplate.json
Log:
added select element in config and div

Modified: branches/print_dev/http/print/mod_printPDF_div.php
===================================================================
--- branches/print_dev/http/print/mod_printPDF_div.php	2009-01-14 21:03:54 UTC (rev 3459)
+++ branches/print_dev/http/print/mod_printPDF_div.php	2009-01-14 21:44:36 UTC (rev 3460)
@@ -41,10 +41,23 @@
 function buildForm(json) {
 	/* first let's build some defaults then the stuff from config */
 	
-	for (var element in json.controls) {
-		var element_id = myId + "_" + json.controls[element].id;
-		var str = '<label for="'+element_id+'">'+json.controls[element].label+'</label>';
-		str += '<input type="'+json.controls[element].type+'" id="'+element_id+'" size="'+json.controls[element].size+'">';
+	for (var item in json.controls) {
+		var element = json.controls[item];
+		var element_id = myId + "_" + element.id;
+		var str = '<label class="print_label" for="'+element_id+'">'+element.label+'</label>\n';
+		switch (element.type) {
+			case "text":
+				str += '<input class="" type="'+element.type+'" id="'+element_id+'" size="'+element.size+'">\n';
+				break;
+			case "select":
+				str += '<select class="" id="'+element_id+'" size="'+element.size+'">\n';
+				for (var option_index in element.options) {
+					option = element.options[option_index];
+					str += '<option value="'+option.value+'">'+option.label+'</option>\n';
+				}
+				str += '</select>\n';
+				break;
+		}
 		$("#"+myId).append(str);
 	}
 }
\ No newline at end of file

Modified: branches/print_dev/http/print/testConfigTemplate.json
===================================================================
--- branches/print_dev/http/print/testConfigTemplate.json	2009-01-14 21:03:54 UTC (rev 3459)
+++ branches/print_dev/http/print/testConfigTemplate.json	2009-01-14 21:44:36 UTC (rev 3460)
@@ -9,7 +9,24 @@
     		"label" : "Titel",
     		"type" : "text",
     		"size" : 20
-    	}	
+    	},
+    	{
+    		"id" : "dpi",
+    		"label" : "DPI",
+    		"type" : "select",
+    		"size" : 20,
+    		"options" : [{
+    			"value" : "val1",
+    			"label" : "label1"
+    			},{
+    			"value" : "val2",
+    			"label" : "label2"
+    			},{
+    			"value" : "val3",
+    			"label" : "label3"
+    			}
+    		]
+    	}    		
     ],
     "pages" : [
     	{



More information about the Mapbender_commits mailing list