[Mapbender-commits] r4027 - in trunk/mapbender/http: classes php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Jun 17 05:09:26 EDT 2009


Author: christoph
Date: 2009-06-17 05:09:26 -0400 (Wed, 17 Jun 2009)
New Revision: 4027

Modified:
   trunk/mapbender/http/classes/class_wfs_configuration.php
   trunk/mapbender/http/php/mod_wfs.php
   trunk/mapbender/http/php/mod_wfs_conf_featuretype_elements.html
   trunk/mapbender/http/php/mod_wfs_conf_interface.js
Log:
bug fixes

Modified: trunk/mapbender/http/classes/class_wfs_configuration.php
===================================================================
--- trunk/mapbender/http/classes/class_wfs_configuration.php	2009-06-17 07:43:29 UTC (rev 4026)
+++ trunk/mapbender/http/classes/class_wfs_configuration.php	2009-06-17 09:09:26 UTC (rev 4027)
@@ -246,22 +246,22 @@
 			// TO DO: check if access is allowed!
 			// (use the new WFS classes for this)
 			$wfsConf->wfsId = intval($obj->wfsId);
-			$wfsConf->featureTypeId = intval($obj->wfsFeaturetypeId);
+			$wfsConf->featureTypeId = intval($obj->featuretypeId);
 		}
 	 
 		$wfsConf->type = intval($obj->type);
 		$wfsConf->label = $obj->label;
-		$wfsConf->labelId = $obj->label_id;
+		$wfsConf->labelId = $obj->labelId;
 		$wfsConf->button = $obj->button;
-		$wfsConf->buttonId = $obj->button_id;
+		$wfsConf->buttonId = $obj->buttonId;
 		$wfsConf->style = $obj->style;
 		$wfsConf->buffer = floatval($obj->buffer);
-		$wfsConf->resStyle = $obj->result_style; 
-		$wfsConf->abstr = $obj->title;
+		$wfsConf->resStyle = $obj->resStyle; 
+		$wfsConf->abstr = $obj->abstr;
 		$wfsConf->description = $obj->description;
 
-		for ($i = 0; $i < count($obj->elements); $i++) {
-			$element = WfsConfigurationElement::createFromObject($obj->elements[$i]);
+		for ($i = 0; $i < count($obj->elementArray); $i++) {
+			$element = WfsConfigurationElement::createFromObject($obj->elementArray[$i]);
 			$wfsConf->elementArray[]= $element;
 		}
 		return $wfsConf;
@@ -437,6 +437,7 @@
 			$element->type = $row["element_type"];
 			$element->search = intval($row["f_search"]);
 			$element->pos = intval($row["f_pos"]);
+			$element->edit = intval($row["f_edit"]);
 			$element->styleId = $row["f_style_id"];
 			$element->toUpper = intval($row["f_toupper"]);
 			$element->label = $row["f_label"];
@@ -446,7 +447,7 @@
 			$element->mandatory = intval($row["f_mandatory"]);
 			$element->respos = $row["f_respos"];
 			$element->minInput = $row["f_min_input"];
-			$element->formElementHtmlTemplate = $row["f_html_template"];
+//			$element->formElementHtmlTemplate = $row["f_html_template"];
 			$element->formElementHtml = stripslashes($row["f_form_element_html"]);
 			$element->authVarname = stripslashes($row["f_auth_varname"]);
 			$element->detailPos = $row["f_detailpos"];

Modified: trunk/mapbender/http/php/mod_wfs.php
===================================================================
--- trunk/mapbender/http/php/mod_wfs.php	2009-06-17 07:43:29 UTC (rev 4026)
+++ trunk/mapbender/http/php/mod_wfs.php	2009-06-17 09:09:26 UTC (rev 4027)
@@ -66,6 +66,11 @@
 var iamready = false;
 </script>
 <?php
+
+function myNl2br ($str) {
+	return preg_replace('#\r?\n#', '\\n', $str);
+}
+
 echo "<script language='JavaScript' type='text/javascript'>";
 if(isset($_REQUEST['id']) && $_REQUEST['id']!=""){
 	$wfs = mb_split(",",$_REQUEST['id']);
@@ -160,12 +165,14 @@
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['element_type'] = '".htmlentities($row["element_type"], ENT_QUOTES, "UTF-8")."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_geom'] = '".$row["f_geom"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_gid'] = '".$row["f_gid"]."';";
-			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_form_element_html'] = \"".(preg_replace("/\n/", "", preg_replace("/\r/", "", htmlentities($row["f_form_element_html"], ENT_QUOTES, "UTF-8"))))."\";";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_form_element_html'] = \"".(preg_replace("/\n/", "", preg_replace("/\r/", "", $row["f_form_element_html"])))."\";";
 //			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_form_element_html'] = \"\";";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_edit'] = '".$row["f_edit"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_mandatory'] = '".$row["f_mandatory"]."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_auth_varname'] = '".htmlentities($row["f_auth_varname"], ENT_QUOTES, "UTF-8")."';";
 			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_operator'] = '".$row["f_operator"]."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_helptext'] = '".myNl2br(htmlentities($row["f_helptext"], ENT_QUOTES, "UTF-8"))."';";
+			echo "wfs_conf[".$i."]['element'][".$cnt."]['f_category_name'] = '".htmlentities($row["f_category_name"], ENT_QUOTES, "UTF-8")."';";
 			$cnt++;
 		}
 		if($cnt == 0){die("wfs_conf data not available");}		

Modified: trunk/mapbender/http/php/mod_wfs_conf_featuretype_elements.html
===================================================================
--- trunk/mapbender/http/php/mod_wfs_conf_featuretype_elements.html	2009-06-17 07:43:29 UTC (rev 4026)
+++ trunk/mapbender/http/php/mod_wfs_conf_featuretype_elements.html	2009-06-17 09:09:26 UTC (rev 4027)
@@ -46,18 +46,19 @@
 			<th class='wfs_conf_geom'>geom</th>
 			<th class='wfs_conf_search'>search</th>
 			<th class='wfs_conf_pos'>pos</th>
-			<th class='wfs_conf_mininput'>minimum_input</th>
-			<th class='wfs_conf_styleid'>style_id</th>
-			<th class='wfs_conf_toupper'>upper</th>
+			<th class='wfs_conf_minInput'>minimum_input</th>
+			<th class='wfs_conf_styleId'>style_id</th>
+			<th class='wfs_conf_toUpper'>upper</th>
 			<th class='wfs_conf_label'>label</th>
-			<th class='wfs_conf_labelid'>label_id</th>
+			<th class='wfs_conf_labelId'>label_id</th>
 			<th class='wfs_conf_show'>show</th>
-			<th class='wfs_conf_showdetail'>show_detail</th>
+			<th class='wfs_conf_showDetail'>show_detail</th>
+			<th class='wfs_conf_detailPos'>show_detail</th>
 			<th class='wfs_conf_respos'>position</th>
 			<th class='wfs_conf_mandatory'>mandatory</th>
 			<th class='wfs_conf_edit'>edit</th>
-			<th class='wfs_conf_formelementhtml'>html</th>
-			<th class='wfs_conf_authvarname'>auth</th>
+			<th class='wfs_conf_formElementHtml'>html</th>
+			<th class='wfs_conf_authVarname'>auth</th>
 			<th class='wfs_conf_operator'>operator</th>
 			<th class='wfs_conf_helptext'>helptext</th>
 			<th class='wfs_conf_category'>category</th>

Modified: trunk/mapbender/http/php/mod_wfs_conf_interface.js
===================================================================
--- trunk/mapbender/http/php/mod_wfs_conf_interface.js	2009-06-17 07:43:29 UTC (rev 4026)
+++ trunk/mapbender/http/php/mod_wfs_conf_interface.js	2009-06-17 09:09:26 UTC (rev 4027)
@@ -12,7 +12,7 @@
 			"def" : 0,
 			"size" : 1
 		}, 
-		"mininput" : {
+		"minInput" : {
 			"type" : "select",
 			"def" : {
 				"0" : "...", 
@@ -23,19 +23,19 @@
 				"5" : "5"
 			}
 		}, 
-		"styleid" : {
+		"styleId" : {
 			"type" : "text",
 			"def" : 0,
 			"size" : 1
 		},
-		"toupper" : {
+		"toUpper" : {
 			"type" : "checkbox"
 		}, 
 		"label" : {
 			"type" : "text",
 			"size" : 2
 		},
-		"labelid" : {
+		"labelId" : {
 			"type" : "text",
 			"def" : 0,
 			"size" : 1
@@ -43,9 +43,14 @@
 		"show" : {
 			"type" : "checkbox"
 		}, 
-		"showdetail" : {
+		"showDetail" : {
 			"type" : "checkbox"
 		}, 
+		"detailPos" : {
+			"type" : "text",
+			"def" : 0,
+			"size" : 1
+		}, 
 		"respos" : {
 			"type" : "text",
 			"def" : 0,
@@ -57,10 +62,10 @@
 		"edit" : {
 			"type" : "checkbox"
 		}, 
-		"formelementhtml" : {
+		"formElementHtml" : {
 			"type" : "htmlTemplate"
 		}, 
-		"authvarname" : {
+		"authVarname" : {
 			"type" : "text",
 			"size" : 8
 		}, 
@@ -125,7 +130,7 @@
 			"title" : "Download",
 			"icon" : "someicon.png",
 			"columns" : [
-				"geom", "pos", "show", "showdetail", "respos", "helptext"
+				"geom", "pos", "show", "showDetail", "respos", "helptext"
 			]
 		},
 		{
@@ -134,9 +139,9 @@
 			"title" : "Search",
 			"icon" : "someicon.png",
 			"columns" : [
-				"geom", "search", "pos", "mininput", "styleid", "toupper", 
-				"label", "labelid", "show", "showdetail", "respos",
-				"authvarname", "operator", "helptext"
+				"geom", "search", "pos", "minInput", "styleId", "toUpper", 
+				"label", "labelId", "show", "showDetail", "detailPos", "respos",
+				"authVarname", "operator", "helptext"
 			]
 		},
 		{
@@ -145,9 +150,9 @@
 			"title" : "Digitize",
 			"icon" : "someicon.png",
 			"columns" : [
-				"geom", "pos", "styleid", "label", "labelid", "show", 
-				"showdetail", "respos", "mandatory", "edit", "formelementhtml", 
-				"authvarname", "helptext",	"category"
+				"geom", "pos", "styleId", "label", "labelId", "show", 
+				"showDetail", "respos", "mandatory", "edit", "formElementHtml", 
+				"authVarname", "helptext",	"category"
 			]
 		}
 	];
@@ -260,6 +265,16 @@
 		return null;
 	};
 	
+	var getWfsConfIndex = function (id) {
+		// find WFS Conf in WFS Conf array
+		for (var i = 0; i < wfsConfArray.length; i++) {
+			if (wfsConfArray[i].id === id) {
+				return i;
+			}
+		}
+		return null;
+	};
+	
 
 	//
 	// FORMS
@@ -622,18 +637,18 @@
 			return {
 				"id": wfsConfId,
 				"wfsId" : wfsId,
-				"wfsFeaturetypeId" : wfsFeaturetypeId,
+				"featuretypeId" : wfsFeaturetypeId,
 				"type" : wfsConfType,
-				"title": $('#wfs_conf_title').val(),
+				"abstr": $('#wfs_conf_title').val(),
 				"description": $('#wfs_conf_description').val(),
 				"label": $('#wfs_conf_label').val(),
-				"label_id": $('#wfs_conf_label_id').val(),
+				"labelId": $('#wfs_conf_label_id').val(),
 				"button": $('#wfs_conf_button').val(),
-				"button_id": $('#wfs_conf_button_id').val(),
+				"buttonId": $('#wfs_conf_button_id').val(),
 				"style": $('#wfs_conf_style').val(),
 				"buffer": $('#wfs_conf_buffer').val(),
-				"result_style": $('#wfs_conf_resultstyle').val(),
-				"elements": ftElements
+				"resStyle": $('#wfs_conf_resultstyle').val(),
+				"elementArray": ftElements
 			};
 		
 	};
@@ -718,7 +733,7 @@
 					var $tr = $("#" + prefix + "wfs_conf_form_tr_" + el.id);
 					for (var attr in el) {
 						for (var column in ALL_WFS_CONF_ATTRIBUTES) {
-							if (attr.toLowerCase() === column) {
+							if (attr === column) {
 								var $td = $tr.children("TD.wfs_conf_" + column);
 								fillWfsConfFormElement(column, $td, el[attr]);
 								break;
@@ -884,6 +899,12 @@
 				var wfsConf = getWfsConfFromHtml(prefix);
 				if (wfsConf.id !== null) {
 					updateWfsConfInDb(wfsConf);
+					var index = getWfsConfIndex(wfsConf.id);
+					if (index !== null) {
+						console.log(index);
+						wfsConfArray[index] = wfsConf;
+						console.log(wfsConf);
+					}
 				}
 				else {
 					insertWfsConfIntoDb(wfsConf);
@@ -964,6 +985,7 @@
 	};
 	
 	var onSelectWfsConf = function (wfsConf) {
+		console.log(wfsConf);
 		isBusy.trigger();
 		setTimeout(function () {
 			for (var i in WFS_CONF_TYPES) {



More information about the Mapbender_commits mailing list