[Mapbender-commits] r2872 - branches/nimix_dev/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 18 12:19:30 EDT 2008


Author: nimix
Date: 2008-08-18 12:19:30 -0400 (Mon, 18 Aug 2008)
New Revision: 2872

Modified:
   branches/nimix_dev/http/php/mod_logout.php
   branches/nimix_dev/http/php/mod_map1.php
   branches/nimix_dev/http/php/mod_mapOV.php
   branches/nimix_dev/http/php/mod_meetingPoint.php
   branches/nimix_dev/http/php/mod_setLocale.php
   branches/nimix_dev/http/php/mod_wfs.php
   branches/nimix_dev/http/php/mod_wfs_edit.php
   branches/nimix_dev/http/php/mod_wfs_server.php
   branches/nimix_dev/http/php/nestedSets.php
Log:
merge

Modified: branches/nimix_dev/http/php/mod_logout.php
===================================================================
--- branches/nimix_dev/http/php/mod_logout.php	2008-08-18 16:15:56 UTC (rev 2871)
+++ branches/nimix_dev/http/php/mod_logout.php	2008-08-18 16:19:30 UTC (rev 2872)
@@ -22,22 +22,36 @@
 ob_start();
 
 require_once(dirname(__FILE__)."/../include/dyn_php.php");
+
 ignore_user_abort();
+
 if (isset($_COOKIE[session_name()])) {
     setcookie(session_name(), '', time()-42000, '/');
 }
+
 session_destroy();
+
 $dir = preg_replace("/\\\/","/", dirname($_SERVER['PHP_SELF']));
 
 if (isset($logout_location) && $logout_location != ''){
 	header("Location: ".$logout_location);     
 }
 else {
-   if (is_file(dirname($_SERVER['PHP_SELF'])."/login.php")) {
-      header("Location: http://".$_SERVER['HTTP_HOST'].$dir."/login.php");      
-   }
-   else {
-      header("Location: http://".$_SERVER['HTTP_HOST'].preg_replace("/\/php/","/frames",$dir)."/login.php");
-   }
+	if (is_file(dirname($_SERVER['PHP_SELF'])."/login.php")) {
+		if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
+			header("Location: https://".$_SERVER['HTTP_HOST'].$dir."/login.php");      
+		}
+		else {
+			header("Location: http://".$_SERVER['HTTP_HOST'].$dir."/login.php");      
+		}
+	}
+	else {
+		if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
+			header("Location: https://".$_SERVER['HTTP_HOST'].preg_replace("/\/php/","/frames",$dir)."/login.php");
+		}
+		else {
+			header("Location: http://".$_SERVER['HTTP_HOST'].preg_replace("/\/php/","/frames",$dir)."/login.php");
+		}
+	}
 }
-?>
\ No newline at end of file
+?>

Modified: branches/nimix_dev/http/php/mod_map1.php
===================================================================
--- branches/nimix_dev/http/php/mod_map1.php	2008-08-18 16:15:56 UTC (rev 2871)
+++ branches/nimix_dev/http/php/mod_map1.php	2008-08-18 16:19:30 UTC (rev 2872)
@@ -41,6 +41,7 @@
    $e_height = $row["e_height"];
    $cnt++;
 }
+session_write_close();
 if($cnt > 1){ echo "alert('mapframe1: ID not unique!');";}
 echo '<script type="text/javascript">';
 echo "\n";
@@ -122,7 +123,6 @@
 <body leftmargin='0' topmargin='0' onload="init()" bgcolor='#ffffff'>
 <div id='markResult' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:26'> </div>
 <div id='maps' name='maps' style ='position: absolute; left: 0px; top: 0px; width: 0px; height: 0px; z-index:2;'> </div>
-
 <div id='highlight' style="position:absolute;top:-10px;left:-10px;width:14px;height:14px;z-index:3;visibility:visible"><img src="../img/redball.gif"/></div>
 <div id='l_right' name='l_right' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:10;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>
 <div id='l_bottom'  name='l_bottom' style="position:absolute;top:0px;left:0px;width:0px;height:0px;overflow:hidden;z-index:11;visibility:hidden;background-color:#ff0000;cursor: crosshair;"></div>

Modified: branches/nimix_dev/http/php/mod_mapOV.php
===================================================================
--- branches/nimix_dev/http/php/mod_mapOV.php	2008-08-18 16:15:56 UTC (rev 2871)
+++ branches/nimix_dev/http/php/mod_mapOV.php	2008-08-18 16:19:30 UTC (rev 2872)
@@ -71,8 +71,6 @@
 		
 		var ind = parent.getMapObjIndexByName('overview');
 		var ov_extent = parent.mb_mapObj[ind].getExtentInfos();
-//		parent.mb_setWmcExtensionData({"ov_minx":ov_extent.minx,"ov_miny":ov_extent.miny,"ov_maxx":ov_extent.maxx,"ov_maxy":ov_extent.maxy});
-	
 		parent.mb_mapObj[ind].isOverview = true;
 	});
 }

Modified: branches/nimix_dev/http/php/mod_meetingPoint.php
===================================================================
--- branches/nimix_dev/http/php/mod_meetingPoint.php	2008-08-18 16:15:56 UTC (rev 2871)
+++ branches/nimix_dev/http/php/mod_meetingPoint.php	2008-08-18 16:19:30 UTC (rev 2872)
@@ -31,7 +31,7 @@
 <!--
 <?php
 include('../include/dyn_js.php');
-echo "var mod_meetingPoint_target = '".$e_target[0]."';";
+echo "var mod_meetingPoint_target = '" . $_REQUEST["e_target"] . "';";
 echo "var meetingPoint_write_to = 'meetingPoint';";
 ?>
 try{

Modified: branches/nimix_dev/http/php/mod_setLocale.php
===================================================================
--- branches/nimix_dev/http/php/mod_setLocale.php	2008-08-18 16:15:56 UTC (rev 2871)
+++ branches/nimix_dev/http/php/mod_setLocale.php	2008-08-18 16:19:30 UTC (rev 2872)
@@ -24,6 +24,6 @@
 $localeObj = new Mb_locale($_SESSION["mb_lang"]);
 session_write_close();
 
-header("Content-type='text/plain';Charset='utf-8'");
+header("Content-type='text/plain';Charset=utf-8");
 echo $localeObj->name;
 ?>

Modified: branches/nimix_dev/http/php/mod_wfs.php
===================================================================
--- branches/nimix_dev/http/php/mod_wfs.php	2008-08-18 16:15:56 UTC (rev 2871)
+++ branches/nimix_dev/http/php/mod_wfs.php	2008-08-18 16:19:30 UTC (rev 2872)
@@ -101,7 +101,9 @@
 			echo "wfs_conf[".$i."]['g_use_wzgraphics']  = '".$row["g_use_wzgraphics"]."';";
 			echo "wfs_conf[".$i."]['fkey_featuretype_id']  = '".$row["fkey_featuretype_id"]."';";
 			echo "wfs_conf[".$i."]['wfs_getfeature']  = '".$row["wfs_getfeature"]."';";
+			echo "wfs_conf[".$i."]['wfs_describefeaturetype']  = '".$row["wfs_describefeaturetype"]."';";
 			echo "wfs_conf[".$i."]['wfs_transaction']  = '".$row["wfs_transaction"]."';";
+			#wfs_describefeaturetype - wfs_describefeaturetype
 			
 		}else{die("wfs_conf data not available");}
 		
@@ -174,4 +176,4 @@
 </head>
 <body leftmargin='0' topmargin='10'  bgcolor='#ffffff' onload='register()'>
 </body>
-</html>
\ No newline at end of file
+</html>

Modified: branches/nimix_dev/http/php/mod_wfs_edit.php
===================================================================
--- branches/nimix_dev/http/php/mod_wfs_edit.php	2008-08-18 16:15:56 UTC (rev 2871)
+++ branches/nimix_dev/http/php/mod_wfs_edit.php	2008-08-18 16:19:30 UTC (rev 2872)
@@ -40,6 +40,44 @@
 function validate(){	
 	return true;
 }
+function openwindow(Adresse) {
+	Fenster1 = window.open(Adresse, "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);
+	}
+}
+
+function controlOperators(checkVal,operator,valType,opValue){
+	var opSelect = document.getElementById(operator);
+	removeChildNodes(opSelect);
+	if(checkVal==true){
+		opSelect.disabled = '';
+		option1 = new Option("-----","0");
+		opSelect.options[opSelect.length] = option1;
+		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;
+		option7 = new Option(">=","greater_equal_than");
+		opSelect.options[opSelect.length] = option7;
+		option8 = new Option("<=","less_equal_than");
+		opSelect.options[opSelect.length] = option8;
+	}
+	else{
+		opSelect.disabled = 'disabled';
+	}
+}
 </script>
 
 </head>
@@ -68,7 +106,7 @@
         $sql .= " WHERE wfs_conf_id = $9;";
         
         $v = array($_REQUEST["wfs_conf_abstract"], $_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");
+        $t = array("s", "s", "s", "s", "s", "s", "s", "s", "s");
         $res = db_prep_query($sql, $v, $t);
 		        
 		if (isset($_REQUEST["f_geom"])) {
@@ -101,7 +139,7 @@
                 else {
                 	$sql .= "0";
                 }
-                $sql .= "', f_pos = $1, f_style_id = $2,";
+                $sql .= "', f_pos = $1, f_min_input = $2, f_style_id = $3,";
                 $sql .= "f_toupper = '" ;
                 if (!empty($_REQUEST["f_toupper".$i])) {
                 	$sql .= "1";
@@ -109,7 +147,7 @@
                 else { 
                 	$sql .= "0";
                 }
-                $sql .= "',f_label = $3, f_label_id = $4,";
+                $sql .= "',f_label = $4, f_label_id = $5,";
                 $sql .= "f_show = '";
                 if (!empty($_REQUEST["f_show".$i])) {
                 	$sql .= "1";
@@ -117,7 +155,7 @@
                 else {
                 	$sql .= "0";
                 }
-				$sql .= "',f_respos = $5,";
+				$sql .= "',f_respos = $6,";
                 $sql .= "f_edit = '";
                 if (!empty($_REQUEST["f_edit".$i])) {
                 	$sql .= "1";
@@ -125,7 +163,7 @@
                 else {
                 	$sql .= "0";
                 }
-				$sql .= "', f_form_element_html = $6,";
+				$sql .= "', f_form_element_html = $7,";
                 $sql .= "f_mandatory = '";
                 if (!empty($_REQUEST["f_mandatory".$i])) {
                 	$sql .= "1";
@@ -133,11 +171,20 @@
                 else {
                 	$sql .= "0";
                 }
-				$sql .= "', f_auth_varname = $7";
-				$sql .= " WHERE fkey_wfs_conf_id = $8 AND f_id = $9;";
+				$sql .= "', f_auth_varname = $8";
+			   	$sql .= ", f_show_detail = '";
+                if(!empty($_REQUEST["f_show_detail".$i])){
+                	$sql .= "1";
+                }
+                else {
+                	$sql .= "0";
+                }
+                $sql .= "', f_detailpos = $9";
+                $sql .= ", f_operator = $10";
+				$sql .= " WHERE fkey_wfs_conf_id = $11 AND f_id = $12;";
 
-				$v = array($_REQUEST["f_pos".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], stripslashes($_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");
+				$v = array($_REQUEST["f_pos".$i], $_REQUEST["f_min_input".$i], $_REQUEST["f_style_id".$i], $_REQUEST["f_label".$i], $_REQUEST["f_label_id".$i], $_REQUEST["f_respos".$i], stripslashes($_REQUEST["f_form_element_html".$i]), $_REQUEST["f_auth_varname".$i], $_REQUEST["f_detailpos".$i], $_REQUEST["f_operator".$i], $_REQUEST["gaz"], $_REQUEST["f_id".$i]);
+				$t = array("s", "i", "s", "s", "s", "s", "s", "s", "i", "s", "i", "s");
                 $res = db_prep_query($sql, $v, $t);
         }
 }
@@ -146,7 +193,7 @@
 
 /* select wfs */
 
-$sql = "SELECT * FROM wfs_conf";
+$sql = "SELECT * FROM wfs_conf ORDER BY wfs_conf_id";
 $res = db_query($sql);
 echo "<select size='10' name='gaz' onchange='submit()'>";
 $cnt = 0;
@@ -189,9 +236,9 @@
                 echo "<tr><td>Style:</td><td><textarea cols=50 rows=5 name='g_style'>".$row["g_style"]."</textarea></td></tr>" ;
                 echo "<tr><td>Buffer:</td><td><input type='text' size='4' name='g_buffer' value='".$row["g_buffer"]."'></td></tr>" ;
                 echo "<tr><td>ResultStyle:</td><td><textarea cols=50 rows=5 name='g_res_style'>".$row["g_res_style"]."</textarea></td></tr>" ;
-                echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'";
-                if($row["g_use_wzgraphics"] == 1){ echo " checked"; }
-                echo "></td></tr>";
+//                echo "<tr><td>WZ-Graphics:</td><td><input name='g_use_wzgraphics' type='checkbox'";
+//                if($row["g_use_wzgraphics"] == 1){ echo " checked"; }
+//                echo "></td></tr>";
                 echo "</table>";
         }
 
@@ -210,15 +257,20 @@
                 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>";
+                echo "<td>" . toImage('detail_position') . "</td>";
                 echo "<td>" . toImage('mandatory') . "</td>";
                 echo "<td>" . toImage('edit') . "</td>";
                 echo "<td>" . toImage('html') . "</td>";
+                echo "<td>" . toImage('auth') . "</td>";
+                echo "<td>" . toImage('operator') . "</td>";
         echo "</tr>";
         $cnt = 0;
         while($row = db_fetch_array($res)){
@@ -234,8 +286,23 @@
 				echo "></td>";
                 echo "<td><input name='f_search".$cnt."' type='checkbox'";
                 if($row["f_search"] == 1){ echo " checked"; }
-                echo "></td>";
+                echo " onclick='controlOperators(document.forms[0].f_search".$cnt.".checked,\"f_operator".$cnt."\",\"".$row["element_type"]."\",\"".$row["f_operator"]."\");'></td>";
                 echo "<td><input name='f_pos".$cnt."' type='text' size='1' value='".$row["f_pos"]."'></td>";
+                echo "<td><select name='f_min_input".$cnt."' id='f_min_input".$cnt."' ";
+                echo ">";
+                echo "<option value='0' ";
+                if($row["f_min_input"] == 0){ echo " selected"; } echo ">-----</option>";
+                echo "<option value='1' ";
+                if($row["f_min_input"] == 1){ echo " selected"; } echo ">1</option>";
+                echo "<option value='2' ";
+                if($row["f_min_input"] == 2){ echo " selected"; } echo ">2</option>";
+                echo "<option value='3' ";
+                if($row["f_min_input"] == 3){ echo " selected"; } echo ">3</option>";
+                echo "<option value='4' ";
+                if($row["f_min_input"] == 4){ echo " selected"; } echo ">4</option>";
+                echo "<option value='5' ";
+                if($row["f_min_input"] == 5){ echo " selected"; } echo ">5</option>";
+                echo "</select></td>";				
                 echo "<td><input name='f_style_id".$cnt."' type='text' size='2' value='".$row["f_style_id"]."'></td>";
                 echo "<td><input name='f_toupper".$cnt."' type='checkbox'";
                 if($row["f_toupper"] == 1){ echo " checked"; }
@@ -246,6 +313,10 @@
                 if($row["f_show"] == 1){ echo " checked"; }
                 echo "></td>";
                 echo "<td><input name='f_respos".$cnt."' type='text' size='1' value='".$row["f_respos"]."'></td>";
+                echo "<td><input name='f_show_detail".$cnt."' type='checkbox'";
+                if($row["f_show_detail"] == 1){ echo " checked"; }
+                echo "></td>";
+                echo "<td><input name='f_detailpos".$cnt."' type='text' size='1' value='".$row["f_detailpos"]."'></td>";
                 echo "<td><input name='f_mandatory".$cnt."' type='checkbox'";
                 if($row["f_mandatory"] == 1){ echo " checked"; }
                 echo "></td>";
@@ -253,6 +324,38 @@
                 if($row["f_edit"] == 1){ echo " checked"; }
                 echo "></td>";
                 echo "<td><textarea name='f_form_element_html".$cnt."' cols='15' rows='1' >".$row["f_form_element_html"]."</textarea></td>";
+                echo "<td><input name='f_auth_varname".$cnt."' type='text' size='8' value='".$row["f_auth_varname"]."'></td>";
+                echo "<td><select name='f_operator".$cnt."' id='f_operator".$cnt."' ";
+                if($row["f_search"] != 1){
+                	echo "disabled";
+                }
+                echo ">";
+                echo "<option value='0' ";
+                if($row["f_operator"] == 0){ echo " selected"; }
+				echo ">-----</option>";
+				echo "<option value='bothside' ";
+                if($row["f_operator"] == 'bothside'){ echo " selected"; }
+				echo ">%...%</option>";
+				echo "<option value='rightside' ";
+                if($row["f_operator"] == 'rightside'){ echo " selected"; }
+				echo ">...%</option>";
+				echo "<option value='equal' ";
+                if($row["f_operator"] == 'equal'){ echo " selected"; }
+				echo ">equal</option>";
+				echo "<option value='greater_than' ";
+                if($row["f_operator"] == 'greater_than'){ echo " selected"; }
+				echo ">></option>";
+				echo "<option value='less_than' ";
+                if($row["f_operator"] == 'less_than'){ echo " selected"; }
+				echo "><</option>";
+				echo "<option value='less_equal_than' ";
+                if($row["f_operator"] == 'less_equal_than'){ echo " selected"; }
+				echo "><=</option>";
+				echo "<option value='greater_equal_than' ";
+                if($row["f_operator"] == 'greater_equal_than'){ echo " selected"; }
+				echo ">>=</option>";
+				
+     			echo "</select></td>";
                 echo "</tr>";
                 $cnt++;
         }

Modified: branches/nimix_dev/http/php/mod_wfs_server.php
===================================================================
--- branches/nimix_dev/http/php/mod_wfs_server.php	2008-08-18 16:15:56 UTC (rev 2871)
+++ branches/nimix_dev/http/php/mod_wfs_server.php	2008-08-18 16:19:30 UTC (rev 2872)
@@ -24,27 +24,27 @@
 	case 'getAssignedConfs':
 		$obj->assignedConfs = getAssignedConfs($obj);
 		sendOutput($obj);
-	break;
-	case 'getUpdateUrl':
-		$obj->url = getUpdateUrl($obj);
-		sendOutput($obj);	
-	break;
+	break;
+	case 'getUpdateUrl':
+		$obj->url = getUpdateUrl($obj);
+		sendOutput($obj);
+	break;
 		case 'add':
 		addConfsToGui($obj);
 		sendOutput($obj);
 	break;
 	case 'remove':
 		removeConfsFromGui($obj);
-		sendOutput($obj);
-	break;
-	case 'updateWfs':
-		updateWfs($obj);
 		sendOutput($obj);
-	break;
-	case 'deleteWfs':
-		deleteWfs($obj);
-		sendOutput($obj);
 	break;
+	case 'updateWfs':
+		updateWfs($obj);
+		sendOutput($obj);
+	break;
+	case 'deleteWfs':
+		deleteWfs($obj);
+		sendOutput($obj);
+	break;
 	case 'setOwsproxy':
 		$ows = array();
 		$ows['string'] = setOwsproxy($obj);
@@ -70,7 +70,7 @@
 
 /*
  * Get all services (ids and titles) where the current user is owner
- * 
+ *
  * @return mixed[] services the ids and titles of the services
  */
 function getServices(){
@@ -81,11 +81,11 @@
 	$adm = new administration();
 	$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
 	if(count($serviceList) == 0){
-		return false;	
+		return false;
 	}
 	$sql = "SELECT * FROM wfs WHERE wfs_id IN (";
 	$v = $serviceList;
-	$t = array(); 
+	$t = array();
 	for ($i = 1; $i <= count($serviceList); $i++) {
 		if ($i > 1) {
 			$sql .= ", ";
@@ -103,13 +103,13 @@
 }
 
 /*
- * Get all configurations of the selcted wfs if the current user is owner 
- * 
- * @return mixed[] 
+ * Get all configurations of the selcted wfs if the current user is owner
+ *
+ * @return mixed[]
  */
 function getWfsConfData($wfsID){
 	global $con;
-	// re-check permission 
+	// re-check permission
 	$adm = new administration();
 	$serviceList = $adm->getWfsByOwner($_SESSION['mb_user_id']);
 	if(in_array($wfsID, $serviceList)){
@@ -127,41 +127,41 @@
 			$cnt++;
 		}
 		if($cnt == 0){
-			return false;	
+			return false;
 		}
 		else{
 			return $wfsConf;
 		}
-	}
-	else if($wfsID==="gui_confs"){
-		$wfsConf = array();
-		$wfsConf['id'] = array();
-		$wfsConf['abstract'] = array();
-		$wfsConf['id'] = $adm->getWfsConfByPermission($_SESSION['mb_user_id']);
-		$cnt = 0;
-		foreach($wfsConf['id'] as $wfscid){
-			$sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
-			$v = array($wfscid);
-			$t = array('i');
-			$res = db_prep_query($sql,$v,$t);
-			while($row = db_fetch_array($res)){
-				array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
-			}	
-			$cnt++;
-		}
-		if($cnt == 0){
-			return false;	
-		}
-		else{
-			return $wfsConf;
-		}
 	}
+	else if($wfsID==="gui_confs"){
+		$wfsConf = array();
+		$wfsConf['id'] = array();
+		$wfsConf['abstract'] = array();
+		$wfsConf['id'] = $adm->getWfsConfByPermission($_SESSION['mb_user_id']);
+		$cnt = 0;
+		foreach($wfsConf['id'] as $wfscid){
+			$sql = "SELECT wfs_conf_abstract FROM wfs_conf WHERE wfs_conf_id = $1";
+			$v = array($wfscid);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+			while($row = db_fetch_array($res)){
+				array_push($wfsConf['abstract'], $row['wfs_conf_abstract']);
+			}
+			$cnt++;
+		}
+		if($cnt == 0){
+			return false;
+		}
+		else{
+			return $wfsConf;
+		}
+	}
 }
 /*
  * Get all GUIs where the current user is owner. This are the GUIs where the user could publish his
  * wfs configurations
- * 
- * @return mixed[] 
+ *
+ * @return mixed[]
  */
 function getGuis(){
 	$adm = new administration();
@@ -175,19 +175,19 @@
 
 /*
  * get all wfs_confs of the selected WFS which are assigned to the selected gui
- * @param 
- * @return mixed[] 
+ * @param
+ * @return mixed[]
  */
 function getAssignedConfs($obj){
 	global $con;
 	$assignedConfs = array();
 	$confs = getWfsConfData($obj->selectedWfs);
 	if($confs === false){
-		return false;	
+		return false;
 	}
 	$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id IN (".join(",",$confs['id']).")";
 	$v = array($obj->selectedGui);
-	$t = array('s');	
+	$t = array('s');
 	$res = db_prep_query($sql,$v,$t);
 	if(!$res){
 		$e = new mb_exception("Error: SQL: " . $sql . " -> Gui: " .$obj->selectedGui);
@@ -205,7 +205,7 @@
 		$sql = "SELECT * FROM gui_wfs_conf WHERE fkey_gui_id = $1 AND fkey_wfs_conf_id = $2";
 		$v = array($obj->gui,$obj->confs->$i);
 		$t = array('s','i');
-		$res = db_prep_query($sql,$v,$t);		
+		$res = db_prep_query($sql,$v,$t);
 		if(!$row = db_fetch_array($res)){
 			$sql1 = "INSERT INTO gui_wfs_conf (fkey_gui_id,fkey_wfs_conf_id) VALUES ($1,$2)";
 			$v1 = array($obj->gui, $obj->confs->$i);
@@ -224,82 +224,90 @@
 		$res = db_prep_query($sql,$v,$t);
 	}
 }
-/*
- * updates an WFS
- * 
- * @param object the un-encoded object 
- * @return boolean success
- */
-function updateWfs($obj){
-	$obj->success = false;
-	$mywfs = new wfs();
-	$mywfs->createObjFromDB($obj->wfs);
-	if(!$mywfs->updateObjFromXML($obj->url)){
-		return false;
-	}
-	if(!$mywfs->wfs2db("")){
-		return false;
-	}		
-	$obj->success = true;
-	return true;
-}
-/*
- * deletes an WFS
- * 
- * @param object the un-encoded object 
- * @return boolean success
- */
-function deleteWfs($obj){
-	//$obj->success = false;
-	$sql = "DELETE FROM wfs WHERE wfs_id = $1";
-	$v = array($obj->wfs);
-	$t = array('i');	
-	$res = db_prep_query($sql,$v,$t);
-	$obj->success = true;
-	return true;
-}
-
-/*
- * gets the specified url column from db
- * 
- * @param object the un-encoded object
- * @return string requested url
- */
-
-function getUpdateUrl($obj){
-	global $con;
-	$sql = "SELECT * FROM wfs WHERE wfs_id = $1;";
-	$v = array($obj->wfs);
-	$t = array('i');
-	$res = db_prep_query($sql,$v,$t);
-	while($row = db_fetch_array($res)){
-		return $row[$obj->column];
-	}
-	return "";
-}
+/*
+ * updates an WFS
+ *
+ * @param object the un-encoded object
+ * @return boolean success
+ */
+function updateWfs($obj){
+	$obj->success = false;
+	$mywfs = new wfs();
+	$mywfs->createObjFromDB($obj->wfs);
+	if(!$mywfs->updateObjFromXML($obj->url)){
+		return false;
+	}
+	if(!$mywfs->wfs2db("")){
+		return false;
+	}
+	$obj->success = true;
+	return true;
+}
+/*
+ * deletes an WFS
+ *
+ * @param object the un-encoded object
+ * @return boolean success
+ */
+function deleteWfs($obj){
+	//$obj->success = false;
+	$sql = "DELETE FROM wfs WHERE wfs_id = $1";
+	$v = array($obj->wfs);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	$obj->success = true;
+	return true;
+}
 
+/*
+ * gets the specified url column from db
+ *
+ * @param object the un-encoded object
+ * @return string requested url
+ */
+
+function getUpdateUrl($obj){
+	global $con;
+	$sql = "SELECT * FROM wfs WHERE wfs_id = $1;";
+	$v = array($obj->wfs);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+	while($row = db_fetch_array($res)){
+		$ContentOfColumn = $row[$obj->column];
+		if($obj->column == 'wfs_getcapabilities'){
+										$n = new administration();
+										$updateUrl = $n->checkURL($ContentOfColumn)."Version=".$row['wfs_version']."&Request=getCapabilities&SERVICE=WFS";
+		}else{
+					$updateUrl = $ContentOfColumn;
+		}
+			
+		return $updateUrl;
+	}
+	return "";
+}
+
 function getOwsproxy($obj){
-	$n = new administration();
-	if($obj->wfs=="gui_confs")
+	$n = new administration();
+	if($obj->wfs=="gui_confs")
 		return false;
-	return $n->getWfsOwsproxyString($obj->wfs); 
+	return $n->getWfsOwsproxyString($obj->wfs);
 }
 function setOwsproxy($obj){
 	$n = new administration();
-	if($obj->wfs=="gui_confs")
-		return false;
+	if($obj->wfs=="gui_confs")
+		return false;
 	return $n->setWfsOwsproxyString($obj->wfs,true);
 }
 function removeOwsproxy($obj){
 	$n = new administration();
-	if($obj->wfs=="gui_confs")
-		return false;
+	if($obj->wfs=="gui_confs")
+		return false;
 	return $n->setWfsOwsproxyString($obj->wfs,false);
 }
 /*
  * encodes and delivers the data
- * 
- * @param object the un-encoded object 
+ *
+ * @param object the un-encoded object
  */
 function sendOutput($out){
 	global $json;
@@ -307,4 +315,4 @@
 	header("Content-Type: text/x-json");
 	echo $output;
 }
-?>
\ No newline at end of file
+?>

Modified: branches/nimix_dev/http/php/nestedSets.php
===================================================================
--- branches/nimix_dev/http/php/nestedSets.php	2008-08-18 16:15:56 UTC (rev 2871)
+++ branches/nimix_dev/http/php/nestedSets.php	2008-08-18 16:19:30 UTC (rev 2872)
@@ -54,16 +54,16 @@
 	if(value == 'insert'){
 		/*
 		if(document.forms[0].title.value == ''){alert("Bitte geben Sie einen Titel an."); permission = false; return;}
-		if(document.forms[0].left.value == ''){alert("W�hlen Sie eine Position."); permission = false; return;}
+		if(document.forms[0].left.value == ''){alert("Wählen Sie eine Position."); permission = false; return;}
       	*/
-      	if(document.forms[0].title.value == ''){alert("Please insert a title."); permission = false; return;}
+      	if(document.forms[0].title.value == ''){alert("<?php echo _mb("Please insert a title.") ?>"); permission = false; return;}
 		if(document.forms[0].left.value == ''){alert("Please choose a position."); permission = false; return;}
       
-      if(document.forms[0].wmsList.selectedIndex > 0 && document.forms[0].layer.selectedIndex == 0){alert("W�hlen Sie einen Layer."); permission = false; return;}
+      if(document.forms[0].wmsList.selectedIndex > 0 && document.forms[0].layer.selectedIndex == 0){alert("Wählen Sie einen Layer."); permission = false; return;}
 		if(permission == true){document.forms[0].action.value = "insert"; document.forms[0].submit();}
 	}
 	if(value == 'delete'){
-		//permission = confirm("Soll das Objekt mit Inhalten gel�scht werden?");
+		//permission = confirm("Soll das Objekt mit Inhalten gelöscht werden?");
 		permission = confirm("Do you want to delete the object and the content of the object?");
 		if(permission == true){
 		document.forms[0].action.value = "delete"; 
@@ -73,7 +73,7 @@
 	if(value == 'update'){
 		/*
 		if(document.forms[0].title.value == ''){alert("Bitte geben Sie einen Titel an."); permission = false; return;}
-		if(document.forms[0].left.value == ''){alert("Bitte w�hlen Sie eine Position."); permission = false; return;}
+		if(document.forms[0].left.value == ''){alert("Bitte wählen Sie eine Position."); permission = false; return;}
 		*/
 		
 		if(document.forms[0].title.value == ''){alert("Please fill in a labeling."); permission = false; return;}
@@ -83,10 +83,10 @@
 	}
 	if(value == 'add'){
 		/*
-		if(document.forms[0].left.value == ''){alert("Bitte w�hlen Sie eine Position."); permission = false; return;}
-		if(document.forms[0].guiList.selectedIndex == 0){alert("Bitte w�hlen Sie eine GUI."); permission = false; return;}
-		if(document.forms[0].wmsList.selectedIndex == 0){alert("Bitte w�hlen Sie einen WMS."); permission = false; return;}
-		if(document.forms[0].layer.selectedIndex == 0){alert("Bitte w�hlen Sie eine Ebene."); permission = false; return;}
+		if(document.forms[0].left.value == ''){alert("Bitte wählen Sie eine Position."); permission = false; return;}
+		if(document.forms[0].guiList.selectedIndex == 0){alert("Bitte wählen Sie eine GUI."); permission = false; return;}
+		if(document.forms[0].wmsList.selectedIndex == 0){alert("Bitte wählen Sie einen WMS."); permission = false; return;}
+		if(document.forms[0].layer.selectedIndex == 0){alert("Bitte wählen Sie eine Ebene."); permission = false; return;}
 		*/
 		
 		if(document.forms[0].left.value == ''){alert("Please fill in a position."); permission = false; return;}
@@ -112,7 +112,7 @@
 }
 if(isset($action) && $action == "insert"){
 	$temp = explode("###", $layer);
-	$sql = "SELECT rgt FROM gui_treegde WHERE lft = $1 AND fkey_gui_id = $1";
+	$sql = "SELECT rgt FROM gui_treegde WHERE lft = $1 AND fkey_gui_id = $2";
 	$v = array($left, $guiList);
 	$t = array("i", "s");
 	$res = db_prep_query($sql, $v, $t);
@@ -124,15 +124,16 @@
 	$v = array($left, $guiList);
 	$t = array("i", "s");
 	db_prep_query($sql, $v, $t);
-	
+#echo $sql . " 1: ".$left." 2:".$guiList."<br>";
 	$sql = "UPDATE gui_treegde SET lft=lft+2 WHERE lft >= $1 AND fkey_gui_id = $2";
 	$v = array($left, $guiList);
 	$t = array("i", "s");
 	db_prep_query($sql, $v, $t);
+#echo $sql . " 1: ".$left." 2:".$guiList."<br>";
 
 	$sql = "INSERT INTO gui_treegde(fkey_gui_id, fkey_layer_id, lft,rgt, ";
 	$sql .= "my_layer_title, layer, wms_id) VALUES($1, $2, $3, $4, $5, $6, $7)";
-		#echo $sql . "<br>";
+#echo $sql . "<br>";
 	$v = array($guiList, $temp[0], $left, ($left+1), $name, $temp[1], $wmsList);
 	$t = array("s", "s", "i", "i", "s", "s", "s");		
 	db_prep_query($sql, $v, $t);
@@ -146,7 +147,7 @@
 		db_query($sql);
 		#hier ist noch was falsch
 		$sql = "INSERT INTO gui_treegde(fkey_gui_id,my_layer_title,lft,rgt,layer) VALUES('".$guiList."','new',".$left.",".($left+1).",'new')";
-		echo $sql . "<br />";
+		#echo $sql . "<br />";
 		db_query($sql);      
 	}
 	*/
@@ -164,14 +165,15 @@
 		$t = array("i", "i", "s");
 		db_prep_query($sql, $v, $t);
 
-		$sql = "UPDATE gui_treegde SET lft=lft-(($1 - $2 + 1)) WHERE lft > $3 AND fkey_gui_id = $4";
-		$v = array($right, $left, $right, $guiList);
-		$t = array("i", "i", "i", "s");
+		$sql = "UPDATE gui_treegde SET lft=lft-$1 WHERE lft > $2 AND fkey_gui_id = $3";
+		$v = array($right-$left+1, $right, $guiList);
+		$t = array("i", "i", "s");
 		db_prep_query($sql, $v, $t);
-
-		$sql = "UPDATE gui_treegde SET rgt=rgt-(($1 - $2 + 1)) WHERE rgt > $3 AND fkey_gui_id = $4";
-		$v = array($right, $left, $right, $guiList);
-		$t = array("i", "i", "i", "s");
+#echo $sql . " r:".$right." l:".$left." 2:".$guiList."<br>";
+		$sql = "UPDATE gui_treegde SET rgt=rgt-$1 WHERE rgt > $2 AND fkey_gui_id = $3";
+		$v = array($right-$left+1, $right, $guiList);
+		$t = array("i", "i", "s");
+#echo $sql . " r:".$right." l:".$left." 2:".$guiList."<br>";
 		db_prep_query($sql, $v, $t);
 	}
 }
@@ -193,12 +195,12 @@
 	$sql_val = "SELECT * FROM gui_treegde WHERE lft = $1 AND fkey_gui_id = $2";
 	$v = array($left, $guiList);
 	$t = array("i", "s");
-	$res = db_prep_query($sql_val, $v, $t);
+	$res_val = db_prep_query($sql_val, $v, $t);
 	
 	$sql = "UPDATE gui_treegde SET ";
 	$sql .= "fkey_layer_id = $1, layer = $2, wms_id =  $3 ";
 	$sql .= "WHERE lft = $4 AND fkey_gui_id = $5";
-	
+
 	$v = array();
 	$t = array("s", "s", "s", "i", "s");	
 
@@ -222,7 +224,6 @@
 	else {
 		array_push($v, $wmsList);
 	}
-
 	array_push($v, $left);	
 	array_push($v, $guiList);	
 	db_prep_query($sql, $v, $t);



More information about the Mapbender_commits mailing list