}
     $ajaxResponse->setResult($result);
     $ajaxResponse->send();
     break;
 case "getWfs":
     $aWFS = new wfs_conf();
     $aWFS->getallwfs(Mapbender::session()->get("mb_user_id"));
     $result = array();
     for ($i = 0; $i < count($aWFS->wfs_id); $i++) {
         // featuretypes
         $featuretypeArray = array();
         $aWFS->getfeatures($aWFS->wfs_id[$i]);
         for ($j = 0; $j < count($aWFS->features->featuretype_id); $j++) {
             // featuretype elements
             $ftElementArray = array();
             $aWFS->getelements($aWFS->features->featuretype_id[$j]);
             for ($k = 0; $k < count($aWFS->elements->element_id); $k++) {
                 $ftElementArray[] = array("id" => $aWFS->elements->element_id[$k], "name" => $aWFS->elements->element_name[$k], "type" => $aWFS->elements->element_type[$k]);
             }
             $featuretypeArray[] = array("id" => $aWFS->features->featuretype_id[$j], "name" => $aWFS->features->featuretype_name[$j], "srs" => $aWFS->features->featuretype_srs[$j], "elementArray" => $ftElementArray);
         }
         $result[] = array("id" => $aWFS->wfs_id[$i], "name" => $aWFS->wfs_name[$i], "title" => $aWFS->wfs_title[$i], "abstr" => $aWFS->wfs_abstract[$i], "getCapabilities" => $aWFS->wfs_getcapabilities[$i], "describeFeaturetype" => $aWFS->wfs_describefeaturetype[$i], "getFeature" => $aWFS->wfs_getfeature[$i], "featuretypeArray" => $featuretypeArray);
     }
     $ajaxResponse->setResult($result);
     $ajaxResponse->send();
     break;
 case "updateWfsConf":
     $wfsConfObj = $ajaxResponse->getParameter("wfsConf");
     $wfsConf = WfsConfiguration::createFromObject($wfsConfObj);
     $success = WfsConfiguration::updateInDb($wfsConf);
     $ajaxResponse->setSuccess($success);
        $res = @db_prep_query($sql, $v, $t);
        //Use the new sld
    } else {
        $data = db_result($res, 0, "sld_xml");
        $use_sld = db_result($res, 0, "use_sld");
    }
}
//$file = "sld.xml";
//$data = readSld($file);
$styledlayerdescriptor = parseSld($data);
$_SESSION["sld"] = $data;
/* Check for a related WFS featuretype */
$wfs_conf_id = $dbutils->getLayerWfsConfId($_SESSION["sld_gui_id"], $layer_id);
if ($wfs_conf_id) {
    $featuretype_id = $dbutils->getWfsConfFeatureTypeId($wfs_conf_id);
    $classWfsConf->getelements($featuretype_id);
    $wfs_element = $classWfsConf->elements;
    $fts = $styledlayerdescriptor->layers[0]->styles[0]->featuretypestyles[0];
    $fts->setElementArray("element_id", $wfs_element->element_id);
    $fts->setElementArray("element_name", $wfs_element->element_name);
} else {
    $wfs_element = false;
}
/* create getMap-Url for preview with/without sld */
$previewMapUrl = $dbutils->getPreviewMapUrl($_SESSION["sld_gui_id"], $layer_id, $_SESSION["sld_wms_id"]);
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
echo "<html>\n";
echo "<head>\n";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n";
echo "<meta HTTP-EQUIV=\"CACHE-CONTROL\" CONTENT=\"NO-CACHE\">\n";
echo "<META HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO-CACHE\">\n";
     }
 }
 /* set featuretype options */
 echo "<table>";
 echo "<tr><td>Abstract:</td><td><input type='text' name='gazetteer_abstract'></td></tr>";
 echo "<tr><td>Label:</td><td><input type='text' name='g_label'></td></tr>";
 echo "<tr><td>Label_id:</td><td><input type='text' name='g_label_id'></td></tr>";
 echo "<tr><td>Button:</td><td><input type='text' name='g_button'></td></tr>";
 echo "<tr><td>Button_id:</td><td><input type='text' name='g_button_id'></td></tr>";
 echo "<tr><td>Style:</td><td><textarea cols=50 rows=5 name='g_style'></textarea></td></tr>";
 echo "<tr><td>Buffer:</td><td><input type='text' size='4' name='g_buffer'></td></tr>";
 echo "<tr><td>ResultStye:</td><td><textarea cols=50 rows=5 name='g_res_style'></textarea></td></tr>";
 echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'></td></tr>";
 echo "</table>";
 /* set element options */
 $aWFS->getelements($_REQUEST["featuretype"]);
 echo "<table border='1'>";
 echo "<tr>";
 echo "<td>ID</td>";
 echo "<td>name</td>";
 echo "<td>type</td>";
 echo "<td>search</td>";
 echo "<td>pos</td>";
 echo "<td>style_id</td>";
 echo "<td>to_upper</td>";
 echo "<td>label</td>";
 echo "<td>label_id</td>";
 echo "<td>show</td>";
 echo "<td>position</td>";
 echo "</tr>";
 for ($i = 0; $i < count($aWFS->elements->element_id); $i++) {
     }
 }
 /* set featuretype options */
 echo "<table>";
 echo "<tr><td>Abstract:</td><td><input type='text' name='wfs_conf_abstract'></td></tr>";
 echo "<tr><td>Label:</td><td><input type='text' name='g_label'></td></tr>";
 echo "<tr><td>Label_id:</td><td><input type='text' name='g_label_id'></td></tr>";
 echo "<tr><td>Button:</td><td><input type='text' name='g_button'></td></tr>";
 echo "<tr><td>Button_id:</td><td><input type='text' name='g_button_id'></td></tr>";
 echo "<tr><td>Style:</td><td><textarea cols=50 rows=5 name='g_style'></textarea></td></tr>";
 echo "<tr><td>Buffer:</td><td><input type='text' size='4' name='g_buffer' value='1'></td></tr>";
 echo "<tr><td>ResultStyle:</td><td><textarea cols=50 rows=5 name='g_res_style'></textarea></td></tr>";
 //        echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'></td></tr>";
 echo "</table>";
 /* set element options */
 $aWFS->getelements($_POST["featuretype"]);
 echo "<table border='1'>";
 echo "<tr valign = bottom>";
 echo "<td>" . toImage('ID') . "</td>";
 echo "<td>" . toImage('name / type') . "</td>";
 echo "<td>" . toImage('geom') . "</td>";
 echo "<td>" . toImage('search') . "</td>";
 echo "<td>" . toImage('pos') . "</td>";
 echo "<td>" . toImage('minimum_input') . "</td>";
 echo "<td>" . toImage('style_id') . "</td>";
 echo "<td>" . toImage('upper') . "</td>";
 echo "<td>" . toImage('label') . "</td>";
 echo "<td>" . toImage('label_id') . "</td>";
 echo "<td>" . toImage('show') . "</td>";
 echo "<td>" . toImage('position') . "</td>";
 echo "<td>" . toImage('show_detail') . "</td>";