From 50593baa9099b33250a3ccdf5b9e55105869d1b1 Mon Sep 17 00:00:00 2001 From: Steve Lime Date: Tue, 11 Nov 2003 05:20:44 +0000 Subject: [PATCH] Added QUERYFORMAT to the webObj and updated the template code to use it. It basically allows you to specify the MIME type of any query output. It's a bandaid though. I really prefer Frank's outputFormatObj, but mapoutput.c needs to be generalized a bit. Perhaps for 4.2. git-svn-id: http://svn.osgeo.org/mapserver/trunk@2532 7532c77e-422f-0410-93f4-f0b67bdd69e2 --- map.h | 2 +- mapfile.c | 2 +- mapserv.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/map.h b/map.h index 521948c1d8..5cb1e3e636 100644 --- a/map.h +++ b/map.h @@ -380,7 +380,7 @@ typedef struct { double minscale, maxscale; char *mintemplate, *maxtemplate; - char *queryformat; // what format is the query to be returned (e.g. HTML, SVG, ...), given as the name of an output format + char *queryformat; // what format is the query to be returned, given as a MIME type #ifndef SWIG hashTableObj metadata; diff --git a/mapfile.c b/mapfile.c index 17073150a5..d1ec18f463 100644 --- a/mapfile.c +++ b/mapfile.c @@ -3532,7 +3532,7 @@ void initWeb(webObj *web) web->imageurl = strdup(""); web->metadata = NULL; web->map = NULL; - web->queryformat = NULL; + web->queryformat = strdup("text/html"); } void freeWeb(webObj *web) diff --git a/mapserv.c b/mapserv.c index d635d9f2a8..2ceb8bd2d3 100644 --- a/mapserv.c +++ b/mapserv.c @@ -1028,7 +1028,7 @@ int main(int argc, char *argv[]) { writeError(); if(QueryFile) { - if (msReturnQuery(msObj, "text/html", NULL) != MS_SUCCESS) + if (msReturnQuery(msObj, msObj->Map->web.queryformat, NULL) != MS_SUCCESS) writeError(); } else { if(TEMPLATE_TYPE(msObj->Map->web.template) == MS_FILE) { /* if thers's an html template, then use it */ @@ -1329,7 +1329,7 @@ int main(int argc, char *argv[]) { } else { // process the query through templates - if (msReturnTemplateQuery(msObj, "text/html", NULL) != MS_SUCCESS) writeError(); + if (msReturnTemplateQuery(msObj, msObj->Map->web.queryformat, NULL) != MS_SUCCESS) writeError(); if(msObj->SaveQuery) { sprintf(buffer, "%s%s%s%s", msObj->Map->web.imagepath, msObj->Map->name, msObj->Id, MS_QUERY_EXTENSION);