Index: /trunk/Dockerfile
===================================================================
--- /trunk/Dockerfile	(revision 983)
+++ /trunk/Dockerfile	(revision 984)
@@ -14,4 +14,10 @@
     libmapserver-dev \
     libmozjs185-dev \
+    \
+    saga \
+    libsaga-api-7.3.0 \
+    libotb \
+    otb-bin \
+    \
     libpq5 \
     libpython3.6 \
@@ -49,6 +55,21 @@
     gettext-base \
     \
+    # Comment lines bellow if nor OTB nor SAGA \
+    libotb-dev \
+    otb-qgis \
+    otb-bin-qt \
+    qttools5-dev \
+    qttools5-dev-tools \
+    qtbase5-dev \
+    libqt5opengl5-dev \
+    libtinyxml-dev \
+    libfftw3-dev \
+    cmake \
+    libsaga-dev \
+    # Comment lines before this one if nor OTB nor SAGA \
+    \
     libfcgi-dev \
     libgdal-dev \
+    libwxgtk3.0-dev \
     libjson-c-dev \
     libssh2-1-dev \
@@ -70,5 +91,5 @@
     && cd ./zoo-project/zoo-kernel \
     && autoconf \
-    && ./configure --with-python=/usr --with-pyvers=3.6 --with-js=/usr --with-mapserver=/usr --with-ms-version=7 --with-json=/usr --with-db-backend --prefix=/usr \
+    && ./configure --with-python=/usr --with-pyvers=3.6 --with-js=/usr --with-mapserver=/usr --with-ms-version=7 --with-json=/usr --with-r=/usr --with-db-backend --prefix=/usr --with-otb=/usr/ --with-itk=/usr --with-otb-version=6.6 --with-itk-version=4.12 --with-saga=/usr --with-saga-version=7.2 --with-wx-config=/usr/bin/wx-config \
     && make \
     && make install \
@@ -82,5 +103,7 @@
     && cp ../zoo-services/hello-py/cgi-env/* /usr/lib/cgi-bin/ \
     && cp ../zoo-services/hello-js/cgi-env/* /usr/lib/cgi-bin/ \
+    && cp ../zoo-services/hello-r/cgi-env/* /usr/lib/cgi-bin/ \
     && cp ../zoo-api/js/* /usr/lib/cgi-bin/ \
+    && cp ../zoo-api/r/minimal.r /usr/lib/cgi-bin/ \
     \
     && cp oas.cfg /usr/lib/cgi-bin/ \
@@ -88,4 +111,36 @@
     # TODO: main.cfg is not processed \
     && prefix=/usr envsubst < main.cfg > /usr/lib/cgi-bin/main.cfg \
+    \
+    #Comment lines below from here if no OTB \
+    && mkdir otb_build \
+    && cd otb_build \
+    && cmake ../../../thirds/otb2zcfg \
+    && make \
+    && mkdir OTB \
+    && cd OTB \
+    && ITK_AUTOLOAD_PATH=/usr/lib/x86_64-linux-gnu/otb/applications/ ../otb2zcfg \
+    && mkdir /usr/lib/cgi-bin/OTB \
+    && cp *zcfg /usr/lib/cgi-bin/OTB \
+    #&& for i in *zcfg; do cp $i /usr/lib/cgi-bin/$i ; j="$(echo $i | sed "s:.zcfg::g")" ; sed "s:$j:OTB_$j:g" -i  /usr/lib/cgi-bin/OTB_$i ; done \
+    #Comment lines before this one if no OTB \
+    \
+    #Comment lines below from here if no SAGA \
+    && cd .. \
+    && make -C ../../../thirds/saga2zcfg \
+    && mkdir zcfgs \
+    && cd zcfgs \
+    && dpkg -L saga \
+    && export MODULE_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/saga/ \
+    && export SAGA_MLB=/usr/lib/x86_64-linux-gnu/saga/ \
+    && ln -s /usr/lib/x86_64-linux-gnu/saga/ /usr/lib/saga \
+    && ../../../../thirds/saga2zcfg/saga2zcfg \
+    && mkdir /usr/lib/cgi-bin/SAGA \
+    && ls \
+    && cp -r * /usr/lib/cgi-bin/SAGA \
+    #Remove OTB if not built or SAGA if no SAGA \
+    && for j in OTB SAGA ; do for i in $(find /usr/lib/cgi-bin/$j/ -name "*zcfg"); do sed "s:image/png:image/png\n     useMapserver = true\n     msClassify = true:g;s:text/xml:text/xml\n     useMapserver = true:g;s:mimeType = application/x-ogc-aaigrid:mimeType = application/x-ogc-aaigrid\n   </Supported>\n   <Supported>\n     mimeType = image/png\n     useMapserver=true:g" -i $i; done; done \
+    \
+    && cd ../.. \
+    #Comment lines before this one if nor OTB nor SAGA \
     \
     && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS \
@@ -158,4 +213,5 @@
 ARG BUILD_DEPS=" \
     git \
+    \
 "
 WORKDIR /zoo-project
@@ -164,5 +220,6 @@
     && apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
     \
-    && git clone https://github.com/ZOO-Project/examples.git 
+    && git clone https://github.com/ZOO-Project/examples.git \
+    && git clone https://github.com/swagger-api/swagger-ui.git
 
 #
@@ -174,4 +231,11 @@
     apache2 \
     curl \
+    cgi-mapserver \
+    mapserver-bin \
+    #Uncomment the line below to add vi editor \
+    #vim \
+    #Uncomment the lines below to add debuging \
+    #valgrind \
+    #gdb \
 "
 
@@ -190,4 +254,5 @@
 COPY --from=demos /zoo-project/examples/data/ /usr/com/zoo-project/
 COPY --from=demos /zoo-project/examples/ /var/www/html/
+COPY --from=demos /zoo-project/swagger-ui /var/www/html/swagger-ui
 
 
@@ -195,9 +260,13 @@
     && apt-get update && apt-get install -y --no-install-recommends $RUN_DEPS \
     \
+    && sed "s=https://petstore.swagger.io/v2/swagger.json=http://localhost/ogc-api/api=g" -i /var/www/html/swagger-ui/dist/index.html \
+    && mv  /var/www/html/swagger-ui/dist  /var/www/html/swagger-ui/oapip \
+    && ln -s /tmp/ /var/www/html/temp \
+    && ln -s /usr/lib/x86_64-linux-gnu/saga/ /usr/lib/saga \
     && rm -rf /var/lib/apt/lists/* \
     && pip3 install Cheetah3 redis\
     && sed "s:AllowOverride None:AllowOverride All:g" -i /etc/apache2/apache2.conf \
     && mkdir -p /tmp/statusInfos \
-    && chown www-data:www-data -R /tmp/statusInfos \
+    && chown www-data:www-data -R /tmp/statusInfos /usr/com/zoo-project \
     && a2enmod cgi rewrite
 
Index: /trunk/docker/main.cfg
===================================================================
--- /trunk/docker/main.cfg	(revision 983)
+++ /trunk/docker/main.cfg	(revision 984)
@@ -2,12 +2,15 @@
 encoding = utf-8
 version = 1.0.0
-serverAddress = http://www.zoo-project.org/zoo/
+serverAddress = http://localhost/cgi-bin/zoo_loader.cgi
 language = en-US
 lang = fr-FR,en-CA,en-US
 tmpPath=/tmp/
-tmpUrl = ../tmpPathRelativeToServerAdress/
+tmpUrl = ../temp/
 dataPath = /usr/com/zoo-project
 cacheDir = /tmp/
 templatesPath = /var/www/
+mapserverAddress = http://localhost/cgi-bin/mapserv
+msOgcVersion=1.0.0
+cors=true
 
 [identification]
@@ -42,2 +45,6 @@
 schema=public
 
+[env]
+R_HOME=/usr/lib/R
+ITK_AUTOLOAD_PATH=/usr/lib/x86_64-linux-gnu/otb/applications/
+MODULE_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/saga/
Index: /trunk/docker/oas.cfg
===================================================================
--- /trunk/docker/oas.cfg	(revision 983)
+++ /trunk/docker/oas.cfg	(revision 984)
@@ -12,5 +12,4 @@
 wsUrl=ws://localhost:8888/
 publisherUrl=http://localhost/cgi-bin/publish.py?jobid=
-io_as_array=true
 
 [/]
@@ -41,5 +40,5 @@
 
 [api.html]
-href=https://demo.mapmint.com/swagger-ui/ogc-api-processes/
+href=http://localhost/swagger-ui/oapip/
 
 [api]
Index: /trunk/thirds/otb2zcfg/otb2zcfg.cxx
===================================================================
--- /trunk/thirds/otb2zcfg/otb2zcfg.cxx	(revision 983)
+++ /trunk/thirds/otb2zcfg/otb2zcfg.cxx	(revision 984)
@@ -222,5 +222,5 @@
 	  if(type == ParameterType_StringList || type == ParameterType_String || type == ParameterType_Float
 	     || type == ParameterType_Int || type == ParameterType_Choice || type == ParameterType_ListView
-	     || type == ParameterType_RAM || type == ParameterType_Empty || type == ParameterType_Directory){
+	     || type == ParameterType_RAM || type == ParameterType_Directory){
 	    std::cout << "   <LiteralData>" << std::endl;
 	    std::string lt;
@@ -233,6 +233,4 @@
 	       || type == ParameterType_ListView)
 	      lt="string";
-	    if(type == ParameterType_Empty)
-	      lt="boolean";
 	    std::cout << "    dataType = " << lt << std::endl;
 	    if(type == ParameterType_Choice || type == ParameterType_ListView){
@@ -281,9 +279,7 @@
 	    }
 	    else{
-	      if(type == ParameterType_ComplexOutputImage){
-		printOutputComplexImage(m_Application->GetParameterComplexOutputImagePixelType(paramKey));
-	      }else{
+	      {
 		std::cout << "   <ComplexData>" << std::endl;
-		if(type == ParameterType_InputImage || type == ParameterType_InputImageList || type == ParameterType_ComplexInputImage){
+		if(type == ParameterType_InputImage || type == ParameterType_InputImageList){
 		  printImages();
 		}
@@ -338,5 +334,5 @@
 	if(paramKey!="inxml" && paramKey!="outxml" &&
 	   ((type == ParameterType_OutputVectorData || type == ParameterType_OutputImage
-	     || type == ParameterType_OutputImage || type == ParameterType_ComplexOutputImage
+	     || type == ParameterType_OutputImage
 	     || type == ParameterType_OutputFilename) || role==1) && type != ParameterType_Group){
 	  hasOutput=1;
@@ -356,5 +352,5 @@
 	  }
 
-	  if(type == ParameterType_OutputImage || type == ParameterType_ComplexOutputImage){
+	  if(type == ParameterType_OutputImage){
 	    std::cout << "   <ComplexData>" << std::endl;
 	    printImages();
Index: /trunk/zoo-project/HISTORY.txt
===================================================================
--- /trunk/zoo-project/HISTORY.txt	(revision 983)
+++ /trunk/zoo-project/HISTORY.txt	(revision 984)
@@ -1,3 +1,4 @@
 Version 1.8.1
+  * Make all demos running within docker
   * Deploy demo HTML UI from github from the Dockerfile
   * Add demo ZOO-Services build in the Dockerfile
Index: /trunk/zoo-project/zoo-kernel/configure.ac
===================================================================
--- /trunk/zoo-project/zoo-kernel/configure.ac	(revision 983)
+++ /trunk/zoo-project/zoo-kernel/configure.ac	(revision 984)
@@ -415,6 +415,4 @@
 CPPFLAGS_SAVE="$CPPFLAGS"
 CPPFLAGS="$PROJ_CPPFLAGS"
-AC_CHECK_HEADERS([proj_api.h],
-                 [], [AC_MSG_ERROR([could not find headers include related to PROJ4])])
 
 AC_SUBST([PROJ_CPPFLAGS])
@@ -607,5 +605,6 @@
 	echo $PYTHONCONFIG
 	# Extract the linker and include flags 
-	PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
+	#PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
+	PYTHON_LDFLAGS=$($PYTHONCONFIG --ldflags | sed "s:python${PYTHON_VERS}/config-${PYTHON_VERS}-::g")
 	PYTHON_CPPFLAGS=`$PYTHONCONFIG --includes`
 
@@ -618,8 +617,12 @@
 	# Ensure we can link against libphp
 	LIBS_SAVE="$LIBS"
-	LIBS="$PYTHON_LDFLAGS"
-	PY_LIB=`$PYTHONCONFIG --libs | sed \
-			      -e 's/.*\(python[[0-9]]\.[[0-9]]\).*/\1/'`
-	AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
+	#LIBS="$PYTHON_LDFLAGS"
+	#PY_LIB=`$PYTHONCONFIG --libs | sed \
+	#		      -e 's/.*\(python[[0-9]]\.[[0-9]]\).*/\1/'`
+	#AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
+	LIBS="m $PYTHON_LDFLAGS -lpython${PYTHON_VERS}"
+	PYTHON_LDFLAGS="-l$LIBS"
+	LDFLAGS=$PYTHON_LDFLAGS
+	AC_CHECK_LIB([], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
 	LIBS="$LIBS_SAVE"
 fi
Index: /trunk/zoo-project/zoo-kernel/main_conf_read.y
===================================================================
--- /trunk/zoo-project/zoo-kernel/main_conf_read.y	(revision 983)
+++ /trunk/zoo-project/zoo-kernel/main_conf_read.y	(revision 984)
@@ -154,4 +154,7 @@
   my_maps=my_map;
   my_maps->name=NULL;
+  my_maps->content=NULL;
+  my_maps->child=NULL;
+  my_maps->next=NULL;
   current_maps=my_maps;
   
Index: /trunk/zoo-project/zoo-kernel/service.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service.c	(revision 983)
+++ /trunk/zoo-project/zoo-kernel/service.c	(revision 984)
@@ -838,4 +838,5 @@
 	else
 	  pmsCursor->next->child=NULL;
+	return;
       }
       else{
Index: /trunk/zoo-project/zoo-kernel/service_internal_ms.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_ms.c	(revision 983)
+++ /trunk/zoo-project/zoo-kernel/service_internal_ms.c	(revision 984)
@@ -1272,5 +1272,7 @@
   m->numlayers++;
   GDALClose( hDataset );
+#ifndef RELY_ON_DB
   GDALDestroyDriverManager();
+#endif
   CPLCleanupTLS();
   storeMd5(pszFilename);
Index: /trunk/zoo-project/zoo-kernel/service_internal_otb.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_otb.c	(revision 983)
+++ /trunk/zoo-project/zoo-kernel/service_internal_otb.c	(revision 984)
@@ -211,5 +211,5 @@
 		}else{
 		  if(type == ParameterType_OutputVectorData){
-		      char* ext="json";
+		      const char* ext="json";
 		      if(tmpVal!=NULL){
 			if(strncasecmp(tmpVal->value,"text/xml",8)==0)
@@ -232,5 +232,5 @@
 		  else
 		    if(type == ParameterType_OutputFilename){
-		      char* ext="txt";
+		      const char* ext="txt";
 		      if(tmpVal!=NULL){
 			if(strncasecmp(tmpVal->value,"text/xml",8)==0)
@@ -308,5 +308,5 @@
 		    char tmp[1024];
 		    map* tmpVal=getMapFromMaps(inputs,paramKey.c_str(),"mimeType");
-		    char* ext="json";
+		    const char* ext="json";
 		    if(tmpVal!=NULL){
 		      if(strncasecmp(tmpVal->value,"application/zip",14)==0){
@@ -362,5 +362,5 @@
 		  else
 		    if(type == ParameterType_InputImage
-		       || type == ParameterType_ComplexInputImage || type == ParameterType_InputVectorData
+		       || type == ParameterType_InputVectorData
 		       || type == ParameterType_InputFilename){
 		      m_Application->SetParameterString(paramKey, test->value);
@@ -403,5 +403,5 @@
 			long count;
 			
-			char *exts[4];
+			const char *exts[4];
 			exts[0]=".shp";
 			exts[1]=".shx";
Index: /trunk/zoo-project/zoo-kernel/service_internal_otb.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_otb.h	(revision 983)
+++ /trunk/zoo-project/zoo-kernel/service_internal_otb.h	(revision 984)
@@ -36,11 +36,8 @@
 #include "service_internal.h"
 #include "service.h"
-#include "cgic.h"
 #ifdef WIN32
 #include <windows.h>
 #include <direct.h>
 #endif
-#include <vector>
-#include <string>
 
 /**
Index: /trunk/zoo-project/zoo-kernel/ulinet.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/ulinet.h	(revision 983)
+++ /trunk/zoo-project/zoo-kernel/ulinet.h	(revision 984)
@@ -34,5 +34,4 @@
 #include "jsapi.h"
 #endif
-#include "fcgi_stdio.h"
 #include <stdlib.h>
 #include <fcntl.h>
Index: /trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 983)
+++ /trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 984)
@@ -1886,5 +1886,5 @@
   FILE *f0, *f1;
   HINTERNET hInternet;
-  service *s1;
+  service *s1=NULL;
   maps *request_output_real_format = NULL;
   maps *request_input_real_format = NULL;
@@ -2552,4 +2552,5 @@
       printf("\n");
       fflush(stdout);
+      json_object_put(res);
     }
     //return 1;
@@ -3453,6 +3454,6 @@
 #else
       recordResponse(m,fbkp1);
+#ifdef USE_CALLBACK
       if (eres == SERVICE_SUCCEEDED)
-#ifdef USE_CALLBACK
 	invokeCallback(m,NULL,request_output_real_format,6,0);
 #endif
@@ -3493,7 +3494,9 @@
 #endif
   }
-  
-  freeService (&s1);
-  free (s1);
+
+  if(s1!=NULL){
+    freeService (&s1);
+    free (s1);
+  }
   freeMaps (&m);
   free (m);
Index: /trunk/zoo-project/zoo-services/ogr/base-vect-ops/service.c
===================================================================
--- /trunk/zoo-project/zoo-services/ogr/base-vect-ops/service.c	(revision 983)
+++ /trunk/zoo-project/zoo-services/ogr/base-vect-ops/service.c	(revision 984)
@@ -38,5 +38,4 @@
 #include "service_internal.h"
 
-extern "C" {
 #include <libxml/tree.h>
 #include <libxml/parser.h>
@@ -44,10 +43,5 @@
 #include <libxml/xpathInternals.h>
 
-/*#include <openssl/sha.h>
-#include <openssl/hmac.h>
-#include <openssl/evp.h>
-#include <openssl/bio.h>
-#include <openssl/buffer.h>
-*/
+extern "C" {
 
   void printExceptionReportResponse(maps*,map*);
Index: /trunk/zoo-project/zoo-services/utils/open-api/templates/index.html
===================================================================
--- /trunk/zoo-project/zoo-services/utils/open-api/templates/index.html	(revision 983)
+++ /trunk/zoo-project/zoo-services/utils/open-api/templates/index.html	(revision 984)
@@ -18,10 +18,11 @@
 #import json
 #if "cache_file" in $inputs["tmpl"]
-#set values=json.load(open($inputs["tmpl"]["cache_file"]))
+#set values=json.load(open($inputs["tmpl"]["cache_file"], encoding='utf-8'))
 #else
-#set values=$inputs["tmpl"]["value"]
+#set values=json.loads($inputs["tmpl"]["value"])
 #end if
 #except Exception as e
 $e
+#set values={}
 #end try
 <html lang="en">
@@ -202,5 +203,5 @@
  #end if
 #end if
-#if $obj["maxOccurs"]>1
+#if $obj["maxOccurs"]=="unbounded" or $obj["maxOccurs"]>1
 	<div class="btn-group" role="group" aria-label="Basic example">
 	  <button type="button" class="btn btn-secondary" onclick="addElementToList(\$(this));">Add</button>
@@ -525,5 +526,5 @@
       <hr>
       <address>$openapi["openapi"]["rootUrl"]$(currentUrl).html</address>
-      <!-- hhmts start -->Last modified: Wed Dec 16 16:06:56 CET 2020 <!-- hhmts end -->
+      <!-- hhmts start -->Last modified: Mon Mar  1 17:01:50 CET 2021 <!-- hhmts end -->
     </main>
 #if $currentKey=="root"
