svn commit: r699 - trunk/mapbender/http/extensions/geom2wfst.php
christoph at osgeo.org
christoph at osgeo.org
Wed Jul 26 06:21:58 EDT 2006
Author: christoph
Date: 2006-07-26 10:21:57+0000
New Revision: 699
Modified:
trunk/mapbender/http/extensions/geom2wfst.php
Log:
now shows an error message or a success confirmation
Modified: trunk/mapbender/http/extensions/geom2wfst.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/extensions/geom2wfst.php?view=diff&rev=699&p1=trunk/mapbender/http/extensions/geom2wfst.php&p2=trunk/mapbender/http/extensions/geom2wfst.php&r1=698&r2=699
==============================================================================
--- trunk/mapbender/http/extensions/geom2wfst.php (original)
+++ trunk/mapbender/http/extensions/geom2wfst.php 2006-07-26 10:21:57+0000
@@ -24,6 +24,7 @@
?>
<title>Test WFS-T operated by CCGIS</title>
</head>
+<body>
<?php
$arURL = parse_url($_REQUEST["url"]);
$host = $arURL["host"];
@@ -38,8 +39,71 @@
$out = sendToHost($host,$port,$method,html_entity_decode($path),$data);
+$data = $out;
+
+$data = eregi_replace("^[^<]*", "", $data);
+$data = eregi_replace("[^>]*$", "", $data);
+
+$parser = xml_parser_create(CHARSET);
+xml_parser_set_option($parser,XML_OPTION_CASE_FOLDING,0);
+xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
+xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,CHARSET);
+xml_parse_into_struct($parser,$data,$values,$tags);
+$code = xml_get_error_code ($parser);
+if ($code) {
+ echo "<br><br>Error " . $code . " (" . xml_error_string($code) . ")<br><br>";
+}
+xml_parser_free($parser);
+
+$section;
+$result="";
+foreach ($values as $element) {
+ $element[tag] = sepNameSpace($element[tag]);
+ if(strtoupper($element[tag]) == "SERVICEEXCEPTIONREPORT" && $element[type] == "open"){
+ $section = "serviceexceptionreport";
+ }
+ if ($section == "serviceexceptionreport" && strtoupper($element[tag]) == "SERVICEEXCEPTION") {
+ $result = $element[value];
+ $error = true;
+ }
+ if(strtoupper($element[tag]) == "STATUS" && $element[type] == "open"){
+ $section = "status";
+ }
+ if ($section == "status" && strtoupper($element[tag]) == "SUCCESS") {
+ $result = "Success!";
+ $error = false;
+ }
+}
+
+if ($error) {
+ #echo "wfsWindow = open('', 'wfs', 'width=400, height=300, resizable, dependent=yes, scrollbars=yes');";
+ #echo "wfsWindow.document.open('text/html');";
+ #echo "wfsWindow.document.write('<html><head></head><body>');";
+ #echo "wfsWindow.document.write('</body></html>');";
+ #echo "wfsWindow.document.getElementsByTagName('body')[0].innerHTML = '".addslashes($result)."';";
+ #echo "wfsWindow.document.close();";
+ echo $result;
+ echo "<script language='javascript'>";
+ echo "window.focus();";
+ echo "</script>";
+}
+else {
+ echo "<script language='javascript'>";
+ echo "window.opener.alert('".$result."');\n";
+ echo "window.opener.focus();";
+ echo "window.close();";
+ echo "</script>";
+}
-echo $out;
+function sepNameSpace($s){
+ $c = strpos($s,":");
+ if($c>0){
+ return substr($s,$c+1);
+ }
+ else{
+ return $s;
+ }
+}
function sendToHost($host,$port,$method,$path,$data)
{
$buf = '';
@@ -64,6 +128,5 @@
return $buf;
}
?>
-<body>
</body>
</html>
\ No newline at end of file
More information about the Mapbender_commits
mailing list