[Mapbender-commits] r2066 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Feb 7 07:30:28 EST 2008


Author: verenadiewald
Date: 2008-02-07 07:30:28 -0500 (Thu, 07 Feb 2008)
New Revision: 2066

Modified:
   trunk/mapbender/http/php/mod_wfs_conf.php
Log:
added field f_operator

Modified: trunk/mapbender/http/php/mod_wfs_conf.php
===================================================================
--- trunk/mapbender/http/php/mod_wfs_conf.php	2008-02-06 20:23:53 UTC (rev 2065)
+++ trunk/mapbender/http/php/mod_wfs_conf.php	2008-02-07 12:30:28 UTC (rev 2066)
@@ -60,6 +60,54 @@
 function validate(){
 	return true;
 }
+
+function removeChildNodes(node) {
+	while (node.childNodes.length > 0) {
+		var childNode = node.firstChild;
+		node.removeChild(childNode);
+	}
+}
+
+function controlOperators(checkVal,operatorField,valType){
+	var opSelect = document.getElementById(operatorField);
+	removeChildNodes(opSelect);
+	option1 = new Option("-----","0");
+	opSelect.options[opSelect.length] = option1;
+	if(checkVal==true){
+		opSelect.disabled = '';
+		if(valType=='string' || valType=='date'){
+			option2 = new Option("%...%","bothside");
+ 			opSelect.options[opSelect.length] = option2;
+ 			option3 = new Option("...%","rightside");
+ 			opSelect.options[opSelect.length] = option3;
+ 			option4 = new Option("equal","equal");
+ 			opSelect.options[opSelect.length] = option4;
+ 		}
+		else if(valType=='int' || valType=='float'){
+			option2 = new Option(">","greater_than");
+ 			opSelect.options[opSelect.length] = option2;
+ 			option3 = new Option("<","less_than");
+ 			opSelect.options[opSelect.length] = option3;
+ 			option4 = new Option("equal","equal");
+ 			opSelect.options[opSelect.length] = option4;
+		}
+		else{
+			option2 = new Option("%...%","bothside");
+ 			opSelect.options[opSelect.length] = option2;
+ 			option3 = new Option("...%","rightside");
+ 			opSelect.options[opSelect.length] = option3;
+ 			option4 = new Option("equal","equal");
+ 			opSelect.options[opSelect.length] = option4;
+ 			option5 = new Option(">","greater_than");
+ 			opSelect.options[opSelect.length] = option5;
+ 			option6 = new Option("<","less_than");
+ 			opSelect.options[opSelect.length] = option6;
+		}		
+	}
+	else{
+		opSelect.disabled = 'disabled';
+	}
+}
 </script>
 
 </head>
@@ -110,7 +158,7 @@
         $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 = "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,f_operator) VALUES(";
                 $sql .= "'".$wfsID."',";
                 $sql .= "'".$_REQUEST["f_id".$i]."',";
                 if(!empty($_REQUEST["f_search".$i])){
@@ -137,11 +185,20 @@
                 }else{$sql .= "'0'";}
                 $sql .= ", ";
                 $sql .= "'".$_REQUEST["f_auth_varname".$i];
-                $sql .= ",";
-              	if(!empty($_REQUEST["f_show_detail".$i])){
+				$sql .= "'";
+				$sql .= ", ";
+				if(!empty($_REQUEST["f_show_detail".$i])){
             		$sql .= "'1'";
                 }else{$sql .= "'0'";}
-				 $sql .= "); ";
+                $sql .= ", ";
+				if(empty($_REQUEST["f_operator".$i])){
+					$sql .= "0";
+				}
+				else{
+					$sql .= "'".$_REQUEST["f_operator".$i];
+					$sql .= "'";
+				}		
+				$sql .= "); ";
 
                 $res = db_query($sql);
         }
@@ -260,6 +317,7 @@
                 echo "<td>" . toImage('edit') . "</td>";
                 echo "<td>" . toImage('html') . "</td>";
                 echo "<td>" . toImage('auth') . "</td>";
+                echo "<td>" . toImage('operator') . "</td>";
         echo "</tr>";
 
         for($i=0; $i<count($aWFS->elements->element_id); $i++){
@@ -267,7 +325,7 @@
                 echo "<td>".$aWFS->elements->element_id[$i]."<input type='hidden' name='f_id".$i."' value='".$aWFS->elements->element_id[$i]."'></td>";
                 echo "<td>".$aWFS->elements->element_name[$i]."<br><div style='font-size:10'>".$aWFS->elements->element_type[$i]."</div></td>";
                 echo "<td><input name='f_geom' type='radio' value='".$aWFS->elements->element_id[$i]."'></td>";
-                echo "<td><input name='f_search".$i."' type='checkbox'></td>";
+                echo "<td><input name='f_search".$i."' type='checkbox' onclick='controlOperators(document.forms[0].f_search".$i.".checked,\"f_operator".$i."\",\"".$aWFS->elements->element_type[$i]."\");'></td>";
                 echo "<td><input name='f_pos".$i."' type='text' size='1' value='0'></td>";
                 echo "<td><input name='f_style_id".$i."' type='text' size='2' value='0'></td>";
                 echo "<td><input name='f_toupper".$i."' type='checkbox'></td>";
@@ -278,8 +336,11 @@
                 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 "<td><select name='f_operator".$i."' id='f_operator".$i."' disabled>";
+                echo "<option value='0'>-----</option>";
+                echo "</select></td>";
                 echo "</tr>";
         }
         echo "</table>";



More information about the Mapbender_commits mailing list