[Mapbender-commits] r5109 - trunk/mapbender/http/plugins
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Thu Dec 10 08:05:16 EST 2009
Author: verenadiewald
Date: 2009-12-10 08:05:15 -0500 (Thu, 10 Dec 2009)
New Revision: 5109
Modified:
trunk/mapbender/http/plugins/mb_resultList_PrintPreview.js
trunk/mapbender/http/plugins/mb_resultList_SaveAsFile.js
Log:
Modified: trunk/mapbender/http/plugins/mb_resultList_PrintPreview.js
===================================================================
--- trunk/mapbender/http/plugins/mb_resultList_PrintPreview.js 2009-12-10 09:37:37 UTC (rev 5108)
+++ trunk/mapbender/http/plugins/mb_resultList_PrintPreview.js 2009-12-10 13:05:15 UTC (rev 5109)
@@ -5,26 +5,59 @@
var c = 0;
var table = "";
var rows = "";
- for (var c = 0; c < geoObj.features.length; c++){
- var feature = geoObj.features[c]
- var cells = "<td>"+ feature.properties.firstname + "</td>";
- rows += "<tr>"+cells+"</tr>";
+ var showDetailColumnsArray = [];
+ for (var i = 0 ; i < data.WFSConf.element.length ; i++) {
+ if(data.WFSConf.element[i].f_show_detail == 1) {
+ showDetailColumnsArray.push({
+ name : data.WFSConf.element[i].element_name,
+ label : data.WFSConf.element[i].f_label,
+ position : data.WFSConf.element[i].f_detail_pos
+ });
+ }
+ }
+
+ var sortFunction = function (a, b) {
+ if(typeof a.position != "number") {
+ return 1;
+ }
+ if(typeof b.position != "number") {
+ return -1;
+ }
+ return a.position < b.position;
+ }
+
+ showDetailColumnsArray.sort(sortFunction);
+
+ var pageHtml = "";
+ for (var j = 0; j < geoObj.features.length; j++){
+ var feature = geoObj.features[j];
+ var rows = "";
+ for (elementName in feature.properties) {
+ for (var k = 0 ; k < showDetailColumnsArray.length ; k++) {
+ if(showDetailColumnsArray[k].name == elementName) {
+ var cells = "<td>"+ showDetailColumnsArray[k].label + "</td>";
+ cells += "<td>"+ feature.properties[elementName] + "</td>";
+ rows += "<tr>"+cells+"</tr>";
+ }
+ }
+ }
+ pageHtml += "<table><tbody>"+rows+"</tbody></table><br>";
}
- var selected = data.selectedRows;
+/* var selected = data.selectedRows;
rows = "";
for(c in selected){
var feature = selected[c];
var name = feature.e.getElementValueByName("firstname")
rows += "<tr><td>"+ name +"</td></tr>";
}
+*/
- table = "<table><tbody>"+rows+"</tbody></table>";
- doc = "<html><head></head><body>"+ table +"</body></html>";
+ doc = "<html><head>" + options.pageCss + "</head><body>"+ pageHtml +"</body></html>";
var popup = open("","Print FeatureCollection");
popup.document.write(doc);
popup.document.close();
};
-Mapbender.modules[options.target].addGlobalButton({"title":"Print Preview", "callback": WFSPrintPreview});
+Mapbender.modules[options.target].addGlobalButton({"title":"Alle Detailinfos drucken", "callback": WFSPrintPreview});
Modified: trunk/mapbender/http/plugins/mb_resultList_SaveAsFile.js
===================================================================
--- trunk/mapbender/http/plugins/mb_resultList_SaveAsFile.js 2009-12-10 09:37:37 UTC (rev 5108)
+++ trunk/mapbender/http/plugins/mb_resultList_SaveAsFile.js 2009-12-10 13:05:15 UTC (rev 5109)
@@ -6,12 +6,16 @@
data: data.geoJSON
},
callback : function(result, success, message){
- if(success){
+ if(success) {
$('#resultdownloader').remove();
- var hiddenIframe = $(document.body).append('<iframe id="resultdownloader"></iframe>');
- $('#resultdownloader').css('display','none');
- $('#resultdownloader').attr('src',result.url);
- }else{
+ var hiddenIframe = $(document.body).append('<iframe name="resultdownloader" id="resultdownloader"></iframe>');
+ $('#resultdownloader').css(
+ 'display','none'
+ ).attr('src',result.url);
+ window.frames["resultdownloader"].location.href =
+ "../php/mod_download.php?download=" + result.url;
+ }
+ else {
alert("could not create file on server: "+message);
}
@@ -23,5 +27,4 @@
}
-
-Mapbender.modules[options.target].addGlobalButton({"title":"Save as File", "callback": WFSSaveAsFile});
+Mapbender.modules[options.target].addGlobalButton({"title":"Suchergebnis speichern", "callback": WFSSaveAsFile});
\ No newline at end of file
More information about the Mapbender_commits
mailing list