[Mapbender-commits] r2088 - branches/2.5/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Feb 15 03:24:39 EST 2008
Author: verenadiewald
Date: 2008-02-15 03:24:37 -0500 (Fri, 15 Feb 2008)
New Revision: 2088
Modified:
branches/2.5/http/php/mod_wfs_conf.php
branches/2.5/http/php/mod_wfs_edit.php
Log:
updated code for new wfs conf parameters f_auth_varname etc.
Modified: branches/2.5/http/php/mod_wfs_conf.php
===================================================================
--- branches/2.5/http/php/mod_wfs_conf.php 2008-02-14 14:40:34 UTC (rev 2087)
+++ branches/2.5/http/php/mod_wfs_conf.php 2008-02-15 08:24:37 UTC (rev 2088)
@@ -60,6 +60,14 @@
function validate(){
return true;
}
+
+function removeChildNodes(node) {
+ while (node.childNodes.length > 0) {
+ var childNode = node.firstChild;
+ node.removeChild(childNode);
+ }
+}
+
</script>
</head>
@@ -90,81 +98,67 @@
db_select_db($DB,$con);
- $sql = "INSERT INTO wfs_conf (";
- $sql .= "wfs_conf_abstract, wfs_conf_description, fkey_wfs_id, ";
- $sql .= "fkey_featuretype_id, g_label, g_label_id, g_button, ";
- $sql .= "g_button_id, g_style, g_buffer, g_res_style, g_use_wzgraphics";
- $sql .= ") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, ";
- if (!empty($_REQUEST["g_use_wzgraphics"])) {
+ $sql = "INSERT INTO wfs_conf (wfs_conf_abstract,wfs_conf_description,fkey_wfs_id,fkey_featuretype_id,g_label,g_label_id,g_button,g_button_id,g_style,g_buffer,g_res_style,g_use_wzgraphics) VALUES(";
+ $sql .= "'".$_REQUEST["wfs_conf_abstract"]."',";
+ $sql .= "'".$_REQUEST["wfs_conf_description"]."',";
+ $sql .= "'".$_REQUEST["wfs"]."',";
+ $sql .= "'".$_REQUEST["featuretype"]."',";
+ $sql .= "'".$_REQUEST["g_label"]."',";
+ $sql .= "'".$_REQUEST["g_label_id"]."',";
+ $sql .= "'".$_REQUEST["g_button"]."',";
+ $sql .= "'".$_REQUEST["g_button_id"]."',";
+ $sql .= "'".$_REQUEST["g_style"]."',";
+ $sql .= "'".$_REQUEST["g_buffer"]."',";
+ $sql .= "'".$_REQUEST["g_res_style"]."',";
+ if(!empty($_REQUEST["g_use_wzgraphics"])){
$sql .= "'1'";
- }
- else {
- $sql .= "'0'";
- }
+ }else{$sql .= "'0'";}
$sql .= "); ";
-
- $v = array($_REQUEST["wfs_conf_abstract"], $_REQUEST["wfs_conf_description"], $_REQUEST["wfs"], $_REQUEST["featuretype"], $_REQUEST["g_label"], $_REQUEST["g_label_id"], $_REQUEST["g_button"], $_REQUEST["g_button_id"], $_REQUEST["g_style"], $_REQUEST["g_buffer"], $_REQUEST["g_res_style"]);
- $t = array("s", "s", "s", "s", "s", "s", "s", "s", "s", "s", "s");
- $res = db_prep_query($sql, $v, $t);
-
- $wfsID = db_insert_id($con,'wfs_conf','wfs_conf_id');
- for ($i = 0; $i < $_REQUEST["num"]; $i++){
+ $res = db_query($sql);
+ $wfsID = db_insert_id($con,'wfs_conf','wfs_conf_id');
+ for($i=0; $i<$_REQUEST["num"]; $i++){
$sql = "INSERT INTO wfs_conf_element (fkey_wfs_conf_id,f_id,f_search,f_pos,f_style_id,f_toupper,f_label,f_label_id,f_show,f_respos,f_edit,f_form_element_html,f_mandatory,f_auth_varname,f_show_detail) VALUES(";
- $sql .= "$1, $2, ";
- if (!empty($_REQUEST["f_search".$i])) {
+ $sql .= "'".$wfsID."',";
+ $sql .= "'".$_REQUEST["f_id".$i]."',";
+ if(!empty($_REQUEST["f_search".$i])){
+ $sql .= "'1',";
+ }else{$sql .= "'0',";}
+ $sql .= "'".$_REQUEST["f_pos".$i]."',";
+ $sql .= "'".$_REQUEST["f_style_id".$i]."',";
+ if(!empty($_REQUEST["f_toupper".$i])){
+ $sql .= "'1',";
+ }else{$sql .= "'0',";}
+ $sql .= "'".$_REQUEST["f_label".$i]."',";
+ $sql .= "'".$_REQUEST["f_label_id".$i]."',";
+ if(!empty($_REQUEST["f_show".$i])){
+ $sql .= "'1',";
+ }else{$sql .= "'0',";}
+ $sql .= "'".$_REQUEST["f_respos".$i]."'";
+ $sql .= ",";
+ if(!empty($_REQUEST["f_edit".$i])){
+ $sql .= "'1',";
+ }else{$sql .= "'0',";}
+ $sql .= "'".$_REQUEST["f_form_element_html".$i]."',";
+ if(!empty($_REQUEST["f_mandatory".$i])){
$sql .= "'1'";
- }
- else {
- $sql .= "'0'";
- }
- $sql .= ", $3, $4, ";
- if (!empty($_REQUEST["f_toupper".$i])) {
- $sql .= "'1'";
- }
- else {
- $sql .= "'0'";
- }
- $sql .= ",$5, $6, ";
- if (!empty($_REQUEST["f_show".$i])) {
- $sql .= "'1'";
- }
- else {
- $sql .= "'0',";
- }
- $sql .= ", $7, ";
- if (!empty($_REQUEST["f_edit".$i])) {
- $sql .= "'1'";
- }
- else {
- $sql .= "'0'";
- }
- $sql .= ",$8, ";
- if (!empty($_REQUEST["f_mandatory".$i])) {
- $sql .= "'1'";
- }
- else {
- $sql .= "'0'";
- }
- $sql .= ", $9, ";
- if (!empty($_REQUEST["f_show_detail".$i])) {
+ }else{$sql .= "'0'";}
+ $sql .= ", ";
+ $sql .= "'".$_REQUEST["f_auth_varname".$i];
+ $sql .= "'";
+ $sql .= ", ";
+ if(!empty($_REQUEST["f_show_detail".$i])){
$sql .= "'1'";
- }
- else {
- $sql .= "'0'";
- }
- $sql .= "); ";
+ }else{$sql .= "'0'";}
+ $sql .= "); ";
- $v = array($wfsID, $_REQUEST["f_id".$i], $_REQUEST["f_pos".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], $_REQUEST["f_form_element_html".$i], $_REQUEST["f_auth_varname".$i]);
- $t = array("s", "s", "s", "s", "s", "s", "s", "s", "s");
- $res = db_prep_query($sql, $v, $t);
+ $res = db_query($sql);
}
if (isset($_REQUEST["f_geom"])) {
- $sql = "UPDATE wfs_conf_element SET f_geom = 1 ";
- $sql .= "WHERE fkey_wfs_conf_id = $1 AND f_id = $2;";
- $v = array($wfsID, $_REQUEST["f_geom"]);
- $t = array("i", "i");
- $res = db_prep_query($sql, $v, $t);
+ $sql = "UPDATE wfs_conf_element SET ";
+ $sql .= "f_geom = 1";
+ $sql .= " WHERE fkey_wfs_conf_id = ".$wfsID." AND f_id = ".$_REQUEST["f_geom"].";";
+ $res = db_query($sql);
}
echo "<script language='javascript'>";
echo "document.location.href = 'mod_wfs_edit.php?gaz=".$wfsID."';";
@@ -275,6 +269,7 @@
echo "<td>" . toImage('edit') . "</td>";
echo "<td>" . toImage('html') . "</td>";
echo "<td>" . toImage('auth') . "</td>";
+
echo "</tr>";
for($i=0; $i<count($aWFS->elements->element_id); $i++){
@@ -293,7 +288,7 @@
echo "<td><input name='f_respos".$i."' type='text' size='1' value='0'></td>";
echo "<td><input name='f_mandatory".$i."' type='checkbox'></td>";
echo "<td><input name='f_edit".$i."' type='checkbox'></td>";
- echo "<td><textarea name='f_form_element_html".$i."' cols='15' rows='1' ></textarea></td>";
+ echo "<td><textarea name='f_form_element_html".$i."' cols='15' rows='1'></textarea></td>";
echo "<td><input name='f_auth_varname".$i."' type='text' size='8' value=''></td>";
echo "</tr>";
}
Modified: branches/2.5/http/php/mod_wfs_edit.php
===================================================================
--- branches/2.5/http/php/mod_wfs_edit.php 2008-02-14 14:40:34 UTC (rev 2087)
+++ branches/2.5/http/php/mod_wfs_edit.php 2008-02-15 08:24:37 UTC (rev 2088)
@@ -41,6 +41,18 @@
function validate(){
return true;
}
+function openwindow(Adresse) {
+ Fenster1 = window.open(Adresse, "GeoPortal Rheinland-Pfalz - Metadaten", "width=500,height=500,left=100,top=100,scrollbars=yes,resizable=no");
+ Fenster1.focus();
+}
+
+function removeChildNodes(node) {
+ while (node.childNodes.length > 0) {
+ var childNode = node.firstChild;
+ node.removeChild(childNode);
+ }
+}
+
</script>
</head>
@@ -56,99 +68,92 @@
$con = db_connect($DBSERVER,$OWNER,$PW);
db_select_db($DB,$con);
-if (isset($_REQUEST["save"])) {
+if(isset($_REQUEST["save"])){
$sql = "UPDATE wfs_conf SET ";
- $sql .= "wfs_conf_abstract = $1, wfs_conf_description = $2, g_label = $3, ";
- $sql .= "g_label_id = $4, g_button = $5, g_button_id = $6, g_style = $7, ";
- $sql .= "g_buffer = $8, g_res_style = $9, g_use_wzgraphics = ";
- if (!empty($_REQUEST["g_use_wzgraphics"])) {
- $sql .= "1";
- }
- else {
- $sql .= "0";
- }
- $sql .= " WHERE wfs_conf_id = $10;";
+ $sql .= "wfs_conf_abstract = '".$_REQUEST["wfs_conf_abstract"]."',";
+ $sql .= "wfs_conf_description = '".$_REQUEST["wfs_conf_description"]."',";
+ $sql .= "g_label = '".$_REQUEST["g_label"]."',";
+ $sql .= "g_label_id = '".$_REQUEST["g_label_id"]."',";
+ $sql .= "g_button = '".$_REQUEST["g_button"]."',";
+ $sql .= "g_button_id = '".$_REQUEST["g_button_id"]."',";
+ $sql .= "g_style = '".$_REQUEST["g_style"]."',";
+ $sql .= "g_buffer = '".$_REQUEST["g_buffer"]."',";
+ $sql .= "g_res_style = '".$_REQUEST["g_res_style"]."',";
+ $sql .= "g_use_wzgraphics = ";
+ if(!empty($_REQUEST["g_use_wzgraphics"])){
+ $sql .= '1';
+ }else{$sql .= '0';}
+ $sql .= " WHERE wfs_conf_id = ".$_REQUEST["gaz"].";";
- $v = array($_REQUEST["wfs_conf_abstract"], $_REQUEST["wfs_conf_description"], $_REQUEST["g_label"], $_REQUEST["g_label_id"], $_REQUEST["g_button"], $_REQUEST["g_button_id"], $_REQUEST["g_style"], $_REQUEST["g_buffer"], $_REQUEST["g_res_style"], $_REQUEST["gaz"]);
- $t = array("s", "s", "s", "s", "s", "s", "s", "i", "s", "i");
- $res = db_prep_query($sql, $v, $t);
+ $res = db_query($sql);
if (isset($_REQUEST["f_geom"])) {
- $sql = "UPDATE wfs_conf_element SET f_geom = 1 ";
- $sql .= "WHERE fkey_wfs_conf_id = $1 AND f_id = $2;";
- $v = array($_REQUEST["gaz"], $_REQUEST["f_geom"]);
- $t = array("i", "s");
- $res = db_prep_query($sql);
+ $sql = "UPDATE wfs_conf_element SET ";
+ $sql .= "f_geom = 1";
+ $sql .= " WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"]." AND f_id = ".$_REQUEST["f_geom"].";";
+ $res = db_query($sql);
- $sql = "UPDATE wfs_conf_element SET f_geom = 0 ";
- $sql .= "WHERE fkey_wfs_conf_id = $1 AND f_id <> $2;";
- $v = array($_REQUEST["gaz"], $_REQUEST["f_geom"]);
- $t = array("i", "s");
- $res = db_prep_query($sql);
+ $sql = "UPDATE wfs_conf_element SET ";
+ $sql .= "f_geom = 0";
+ $sql .= " WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"]." AND f_id <> ".$_REQUEST["f_geom"].";";
+ $res = db_query($sql);
}
else {
- $sql = "UPDATE wfs_conf_element SET f_geom = 0 ";
- $sql .= "WHERE fkey_wfs_conf_id = $1;";
- $v = array($_REQUEST["gaz"]);
- $t = array("i");
- $res = db_prep_query($sql);
+ $sql = "UPDATE wfs_conf_element SET ";
+ $sql .= "f_geom = 0";
+ $sql .= " WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"].";";
+ $res = db_query($sql);
}
for($i=0; $i<$_REQUEST["num"]; $i++){
- $sql = "UPDATE wfs_conf_element SET f_search = '";
- if (!empty($_REQUEST["f_search".$i])) {
- $sql .= "1";
- }
- else {
- $sql .= "0";
- }
- $sql .= "', f_pos = $1, f_style_id = $2,";
+ $sql = "UPDATE wfs_conf_element SET ";
+ $sql .= "f_search = '";
+ if(!empty($_REQUEST["f_search".$i])){
+ $sql .= '1';
+ }else{$sql .= '0';}
+ $sql .= "',";
+ $sql .= "f_pos = '".$_REQUEST["f_pos".$i]."',";
+ $sql .= "f_style_id = '".$_REQUEST["f_style_id".$i]."',";
$sql .= "f_toupper = '" ;
- if (!empty($_REQUEST["f_toupper".$i])) {
- $sql .= "1";
- }
- else {
- $sql .= "0";
- }
- $sql .= "',f_label = $3, f_label_id = $4,";
+ if(!empty($_REQUEST["f_toupper".$i])){
+ $sql .= '1';
+ }else{$sql .= '0';}
+ $sql .= "',";
+ $sql .= "f_label = '".$_REQUEST["f_label".$i]."',";
+ $sql .= "f_label_id = '".$_REQUEST["f_label_id".$i]."',";
$sql .= "f_show = '";
- if (!empty($_REQUEST["f_show".$i])) {
- $sql .= "1";
- }
- else {
- $sql .= "0";
- }
- $sql .= "',f_respos = $5,";
+ if(!empty($_REQUEST["f_show".$i])){
+ $sql .= '1';
+ }else{$sql .= '0';}
+ $sql .= "',";
+ $sql .= "f_respos = '".$_REQUEST["f_respos".$i]."' ";
+ $sql .= ",";
$sql .= "f_edit = '";
- if (!empty($_REQUEST["f_edit".$i])) {
- $sql .= "1";
- }
- else {
- $sql .= "0";
- }
- $sql .= "', f_form_element_html = $6,";
+ if(!empty($_REQUEST["f_edit".$i])){
+ $sql .= '1';
+ }else{$sql .= '0';}
+ $sql .= "',";
+ $sql .= "f_form_element_html = '".addslashes($_REQUEST["f_form_element_html".$i]);
+ $sql .= "',";
$sql .= "f_mandatory = '";
- if (!empty($_REQUEST["f_mandatory".$i])) {
+ if(!empty($_REQUEST["f_mandatory".$i])){
$sql .= "1";
- }
- else {
- $sql .= "0";
- }
- $sql .= "', f_auth_varname = $7,";
- $sql .= "f_show_detail = '";
- if (!empty($_REQUEST["f_show_detail".$i])) {
- $sql .= "1";
- }
- else {
- $sql .= "0";
- }
- $sql .= "' WHERE fkey_wfs_conf_id = $8 AND f_id = $9;";
-
- $v = array($_REQUEST["f_pos".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], addslashes($_REQUEST["f_form_element_html".$i]), $_REQUEST["f_auth_varname".$i], $_REQUEST["gaz"], $_REQUEST["f_id".$i]);
- $t = array("s", "s", "s", "s", "s", "s", "s", "i", "s");
- $res = db_prep_query($sql, $v, $t);
+ }else{$sql .= "0";}
+ $sql .= "'";
+ $sql .= ", ";
+ $sql .= "f_auth_varname = '".$_REQUEST["f_auth_varname".$i];
+ $sql .= "'";
+ $sql .= ", ";
+ $sql .= "f_show_detail = '";
+ if(!empty($_REQUEST["f_show_detail".$i])){
+ $sql .= '1';
+ }else{$sql .= '0';}
+ $sql .= "'";
+ $sql .= " WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"]." AND f_id = ".$_REQUEST["f_id".$i].";";
+
+ $res = db_query($sql);
}
}
@@ -185,13 +190,12 @@
}
/* configure elements */
-if (isset($_REQUEST["gaz"])) {
- $sql = "SELECT * FROM wfs_conf WHERE wfs_conf_id = $1";
- $v = array($_REQUEST["gaz"]);
- $t = array("i");
- $res = db_prep_query($sql, $v, $t);
+if(isset($_REQUEST["gaz"])){
+ $sql = "SELECT * FROM wfs_conf WHERE wfs_conf_id = ".$_REQUEST["gaz"];
+ $res = db_query($sql);
if($row = db_fetch_array($res)){
echo "<table>";
+ #echo "<tr><td><a onclick='openwindow(this.href); return false' target='_blank' href='../x_geoportal/mod_featuretypeMetadata.php?wfs_conf_id=".$row["wfs_conf_id"]."'>Link zum WFS</a></td></tr>";
echo "<tr><td>GazetterID:</td><td>".$row["wfs_conf_id"]."</td></tr>" ;
echo "<tr><td>Title:</td><td><input type='text' name='wfs_conf_abstract' value='".$row["wfs_conf_abstract"]."'></td></tr>" ;
echo "<tr><td>Description:</td><td><input type='text' name='wfs_conf_description' value='".$row["wfs_conf_description"]."'></td></tr>" ;
@@ -211,10 +215,9 @@
/* set element options */
$sql = "SELECT * FROM wfs_conf_element ";
$sql .= "JOIN wfs_element ON wfs_conf_element.f_id = wfs_element.element_id ";
- $sql .= "WHERE fkey_wfs_conf_id = $1 ORDER BY f_id";
- $v = array($_REQUEST["gaz"]);
- $t = array("i");
- $res = db_prep_query($sql, $v, $t);
+ $sql .= "WHERE fkey_wfs_conf_id = ".$_REQUEST["gaz"]." ORDER BY f_id";
+
+ $res = db_query($sql);
echo "<table border='1'>";
echo "<tr valign = bottom>";
@@ -234,6 +237,7 @@
echo "<td>" . toImage('edit') . "</td>";
echo "<td>" . toImage('html') . "</td>";
echo "<td>" . toImage('auth') . "</td>";
+
echo "</tr>";
$cnt = 0;
while($row = db_fetch_array($res)){
More information about the Mapbender_commits
mailing list