changeset 15:f17f43f0a63f

bug fixed: download error for data from LGDataverse
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Fri, 30 Oct 2015 16:47:15 +0100
parents 4151de159dbe
children bb63a70b8542
files map.js php/download.php
diffstat 2 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/map.js	Wed Oct 28 12:02:37 2015 +0100
+++ b/map.js	Fri Oct 30 16:47:15 2015 +0100
@@ -160,7 +160,7 @@
 	if (urlParameter['name']!=undefined && urlParameter['file']==undefined && urlParameter['fileId']!=undefined) {
 		var file=undefined;
 		var name=decodeURI(urlParameter['name']);
-		var obj={name:name,file:file,preload:true};
+		var obj={name:name,file:file,preload:true};	
 		datasetArray.splice(0,0,obj);
 	};
 	// end 
@@ -192,6 +192,7 @@
 	
 	// debug by yao
 	$("#aboutIcon").click();
+
 });
 function getUrlParameter(){
 	//examine the parameter "mode" in the url
@@ -264,12 +265,12 @@
 				}
 			];
 			*/
-
+			
 	    	var dataCSVformat = fileData.file.dataString;
-
+	    	dataCSVformat = dataCSVformat.substring(0, dataCSVformat.length-2);	// remove the last two characters which are "\n"
+	    																		// it will cause download error since the last element in table is null
 	    	//console.log(dataCSVformat);
 	    	var json = GeoTemConfig.convertCsv(dataCSVformat);
-	    	
 			GeoTemConfig.addDataset(new Dataset(GeoTemConfig.loadJson(json),name));
 
 		}
@@ -295,9 +296,11 @@
 			timeline.display(GeoTemConfig.datasets);
 			table.display(GeoTemConfig.datasets);
 			pieChart.display(GeoTemConfig.datasets); */ 
+		
                 }
+   			
         );
-   	
+   		
    	}
         
 }
--- a/php/download.php	Wed Oct 28 12:02:37 2015 +0100
+++ b/php/download.php	Fri Oct 30 16:47:15 2015 +0100
@@ -28,7 +28,7 @@
 	$mime = array('application/octet-stream');
 	
 	header('Content-Type: '.$mime);
-	header('Content-Disposition: attachment; filename="test.kml"');
+	header('Content-Disposition: attachment; filename="download.kml"');
 	header('Content-Transfer-Encoding: binary');
 	header('Content-Length: '.sprintf('%d', $filesize));
 	header('Expires: 0');