[Mapbender-commits] r5832 - branches/2.6/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Mar 25 06:33:11 EDT 2010


Author: christoph
Date: 2010-03-25 06:33:10 -0400 (Thu, 25 Mar 2010)
New Revision: 5832

Modified:
   branches/2.6/http/javascripts/mod_digitize_tab.php
Log:


Modified: branches/2.6/http/javascripts/mod_digitize_tab.php
===================================================================
--- branches/2.6/http/javascripts/mod_digitize_tab.php	2010-03-24 16:41:44 UTC (rev 5831)
+++ branches/2.6/http/javascripts/mod_digitize_tab.php	2010-03-25 10:33:10 UTC (rev 5832)
@@ -156,6 +156,60 @@
 
 var eventCloseGeometry;
 
+function toggleTabs(tabId) {
+	if(!initialTab) {
+		return;
+	}
+
+	var tabHeaders = wfsWindow.document.getElementsByTagName('a');
+	var tabs       = wfsWindow.document.getElementsByTagName('div');
+	
+	for(var i = 0; i < tabHeaders.length; i++) {
+		if(tabHeaders[i].id.indexOf('tabheader') != -1) {
+			tabHeaders[i].className = 'tabheader';
+		}
+	}
+	
+	for(var i = 0; i < tabs.length; i++) {
+		if(tabs[i].className === 'tabcontent') {
+			tabs[i].style.visibility = 'hidden';
+			tabs[i].style.display    = 'none';
+		}
+	}
+	
+	wfsWindow.document.getElementById('tabheader_' + tabId).className += ' active';
+	
+	wfsWindow.document.getElementById('tab_' + tabId).style.visibility = 'visible';
+	wfsWindow.document.getElementById('tab_' + tabId).style.display    = 'block';
+	
+	return false;
+}
+
+function showHelptext(helptextId) {
+	hideHelptext();
+	wfsWindow.document.getElementById('helptext' + helptextId).style.visibility = 'visible';
+	wfsWindow.document.getElementById('helptext' + helptextId).style.display    = 'block';
+
+	return false;
+}
+
+function hideHelptext(helptextId) {
+	if(helptextId) {
+		wfsWindow.document.getElementById('helptext' + helptextId).style.visibility = 'hidden';
+		wfsWindow.document.getElementById('helptext' + helptextId).style.display    = 'none';
+	}
+
+	var helptext = wfsWindow.document.getElementsByTagName('div');
+	
+	for(var i = 0; i < helptext.length; i++) {
+		if(helptext[i].className === 'helptext') {
+			helptext[i].style.visibility = 'hidden';
+			helptext[i].style.display    = 'none';
+		}
+	}
+
+	return false;
+}
 function getMousePosition(e) {
 	var ind = parent.getMapObjIndexByName("<?php  echo $e_target;  ?>");
 	currentPos = parent.mb_mapObj[ind].getMousePosition(e);
@@ -1350,19 +1404,26 @@
 function validBoxEntrySelected(form){
 	var isCorrect = true;
 	var errorMessage = "";
+	var name = "";
 	for (var i = 0; i < form.childNodes.length && isCorrect; i++) {
 		if (form.childNodes[i].nodeName.toUpperCase() == "SELECT") {
-			if (parseInt(form.childNodes[i].selectedIndex) == 0) {
-				return {"isCorrect":false, "errorMessage":errorMessage};
+			name += form.childNodes[i].name;
+			if (parseInt(form.childNodes[i].selectedIndex) == 0 && $(form.childNodes[i]).hasClass("mandatory")) {
+				var msg = name + ": " + msgObj.messageSelectAnOption + "\n"
+				var categ = form.childNodes[i].getAttribute("category");
+				if (typeof(categ) != "undefined") {
+					msg = categ + " => " + msg;
+				}
+				return {"isCorrect":false, "errorMessage":msg};
 			}
 		}
 		else if (form.childNodes[i].hasChildNodes()) {
-			isCorrect = validBoxEntrySelected(form.childNodes[i]).isCorrect;
+			var res = validBoxEntrySelected(form.childNodes[i]);
+			errorMessage = res.errorMessage + errorMessage;
+			isCorrect = res.isCorrect;
+			
 		}
 	}
-	if (!isCorrect) {
-		errorMessage = msgObj.messageSelectAnOption + "\n";
-	}
 	return {"isCorrect":isCorrect, "errorMessage":errorMessage};
 }
 
@@ -1370,32 +1431,25 @@
 	var isCorrect = true;
 	var errorMessage = "";
 	
-	nodeArray = doc.getElementsByName("mandatory");
-	for (var i = 0; i < nodeArray.length && isCorrect; i++) {
-		if (nodeArray[i].nodeName.toUpperCase() == "INPUT" && nodeArray[i].type == "hidden" && nodeArray[i].id.substr(0,10) == "mandatory_") {
-			var nodeId = nodeArray[i].id.substr(10);
-			if (nodeArray[i].value == "true") {
-				if (doc.getElementById(nodeId).value == "") {
-					isCorrect = false;
-					errorMessage += "'"+ doc.getElementById(nodeId).name +"': "+ msgObj.messageErrorFieldIsEmpty +"\n";
-				}
-			}
+	var $nodeArray = $(".mandatory", doc);
+	for (var i = 0; i < $nodeArray.size() && isCorrect; i++) {
+		var $currentNode = $nodeArray.eq(i);
+		var tagName = $currentNode.get(0).nodeName.toUpperCase();
+		if (tagName == "INPUT" && $currentNode.val() == "") {
+			isCorrect = false;
+			errorMessage += "'"+ $currentNode.attr("name") +"': "+ msgObj.messageErrorFieldIsEmpty +"\n";
 		}
-		if (nodeArray[i].nodeName.toUpperCase() == "SELECT" && nodeArray[i].type == "hidden" && nodeArray[i].id.substr(0,10) == "mandatory_") {
-			var nodeId = nodeArray[i].id.substr(10);
-			if (nodeArray[i].value == "true") {
-				if (parseInt(form.childNodes[i].selectedIndex) == 0) {
-					isCorrect = false;
-					errorMessage += "'"+ doc.getElementById(nodeId).name +"': "+ msgObj.messageErrorFieldIsEmpty +"\n";
-				}
-			}
+		
+		if (tagName == "SELECT" && parseInt($currentNode.get(0).selectedIndex) == 0) {
+			isCorrect = false;
+			errorMessage += "'"+ $currentNode.attr("name") +"': "+ msgObj.messageErrorFieldIsEmpty +"\n";
 		}
 	}
 	return {"isCorrect":isCorrect, "errorMessage":errorMessage};
 }
 
 function isInteger(str) {
-	if (str.match(/^\d*$/)) {
+	if (str.match(/^[0-9]{0,8}$/) || str == "" ) { //will be better ;-)
 		return true;
 	}
 	return false;
@@ -1455,6 +1509,7 @@
 
 function getAvailableWfsForGeom(geom, wfsConf) {
 	var wfsConfIndices = [];
+	
 	for (var attr in wfsConf) {
 		var isTrans = (wfsConf[attr]['wfs_transaction'] != "");
 		if (!isTrans) {
@@ -1579,7 +1634,6 @@
 	
 	wfsWindow = open("", "wfsattributes", "width="+wfsWindowWidth+", height="+wfsWindowHeight+", resizable, dependent=yes, scrollbars=yes");
 	wfsWindow.document.open("text/html");
-
 	setTimeout(function () {
 		wfsWindow.focus();
 	}, 100);
@@ -1595,9 +1649,19 @@
 	//
 
 	var onChangeText = "document.getElementById('elementForm').innerHTML = ";
-	onChangeText += "window.opener.buildElementForm(this.value , " + geometryIndex + ");";
+	onChangeText += "window.opener.buildElementForm(this.value, " + geometryIndex + ");";
 	onChangeText += "window.opener.setWfsWindowStyle(this.value);";
+
+	var datePickerText = "$('.hasDatepicker').each(function () { " + 
+		"var data = $.parseJSON($(this).attr('data'));" +
+		"var defaults = {};" +
+		"var settings = $.extend({}, defaults, data);" + 
+		"alert(settings);" +
+		"$(this).datepicker(settings);" + 
+		"});";
 	
+	onChangeText += datePickerText;
+	
 	str += "\t<select name='wfs' size='" + wfsConf.length + "'";
 	str += " onChange=\""+ onChangeText +"\"";
 	str += ">\n\t\t";
@@ -1618,25 +1682,161 @@
 
 	
 	str += "</select>\n\t\t</form>\n\t";
-	str += "<div id='elementForm'>\n</div>";
 	
+	var elForm = "";
 	if (defaultIndex != -1) {
-		wfsWindow.document.writeln("<html><head><meta http-equiv='Content-Type' content='text/html; charset=<?php echo CHARSET;?>'><style type='text/css'>"+wfsConf[defaultIndex]['g_style']+"</style></head><body></body></html>");
-		wfsWindow.document.write(str);
-		wfsWindow.document.close();
-		wfsWindow.document.getElementById("elementForm").innerHTML = buildElementForm(defaultIndex, geometryIndex);
+		elForm = buildElementForm(defaultIndex, geometryIndex);
+
+		var headStr = "<html><head><meta http-equiv='Content-Type' content='text/html; charset=<?php echo CHARSET;?>'><style type='text/css'>" + wfsConf[defaultIndex]['g_style'] + "</style>";
+		headStr += '<link rel="stylesheet" type="text/css" href="../extensions/jquery-ui-1.7.2.custom/development-bundle/themes/base/ui.all.css" />';
+		headStr += '<style type="text/css">'
+		headStr += 'a.tabheader { margin: 0 3px 0 0;padding: 1px 5px;text-decoration: none;color: #999;background-color: #F5F5F5;border: 1px solid #999;border-bottom: 0; }';
+		headStr += 'a.tabheader.active { color: #666;background-color: transparent;border-color: #666;border-bottom: 1px solid #FFF;cursor: default; }';
+		headStr += 'div.tabcontent { visibility: hidden;display: none;margin: 1px 0 5px 0;padding: 5px;border: 1px solid #666; }';
+		headStr += 'div.helptext { visibility: hidden;display: none;position: absolute;top: 5%;left: 5%;width: 85%;padding: 5px;color: #000;background-color: #EEEEEE;border: 1px solid #000;-moz-border-radius: 10px;-webkit-border-radius: 10px;}';
+		headStr += 'div.helptext p { margin: 0 ; }';
+		headStr += 'div.helptext p a.close { display: block;margin: 5px auto;text-align: center; }';
+		headStr += 'a img { vertical-align: middle;border: 0; }';
+		headStr += '.mandatory { border:1px solid red; }';
+		headStr += '</style>';
+		headStr += '</head><body onload="window.opener.toggleTabs(\''+initialTab+'\'); ' + datePickerText + '">';
+		wfsWindow.document.write(headStr);
 	}
 	else {
-		wfsWindow.document.writeln("<html><head><meta http-equiv='Content-Type' content='text/html; charset=<?php echo CHARSET;?>'><style type='text/css'></style></head><body></body></html>");
-		wfsWindow.document.write(str);
-		wfsWindow.document.close();
+		var headStr = "<html><head><style type='text/css'></style></head><body>";
+		wfsWindow.document.write(headStr);
 	}
+	str += "<div id='elementForm'>\n" + elForm + "</div>";
+	str += "<script type='text/javascript' src='../extensions/jquery-ui-1.7.2.custom/js/jquery-1.3.2.min.js'><\/script>";
+	str += "<script type='text/javascript' src='../extensions/jquery-ui-1.7.1.w.o.effects.min.js'><\/script>";
+	str += "<script type='text/javascript' src='../extensions/jqjson.js'><\/script>";
+	str += "</body></html>";
+	wfsWindow.document.write(str);
+	wfsWindow.document.close();
+
+//	toggleTabs(initialTab);
+
 }
 
 function setWfsWindowStyle(wfsConfIndex) {
 	wfsWindow.document.getElementsByTagName("style")[0].innerHTML = wfsConf[wfsConfIndex]['g_style'];
 }
 
+function prepareSelectBox (formElementHtml, categoryName, isMandatory, elementLabel, elementValue, styleId) {
+	var classString = (styleId == '0') ? "" : styleId;
+	var patternString = "<select";
+	var pattern = new RegExp(patternString);
+	// set category
+	if (categoryName) {
+		formElementHtml = formElementHtml.replace(pattern, patternString + " category='" + categoryName + "' ");
+	}
+
+	if (isMandatory) {
+		// set border if mandatory
+		classString += " mandatory";
+	}
+	classString = (classString !== "") ? " class='"+classString+"' " : " ";
+	formElementHtml = formElementHtml.replace(pattern, patternString + classString);
+
+	// set name of select box to elementlabel
+	patternString = "name\s*=\s*\\*'\w+\\*'";
+	pattern = new RegExp(patternString);
+	if (pattern.test(formElementHtml)) {
+		formElementHtml = formElementHtml.replace(pattern, "name='" + elementLabel + "'");
+	}
+	else {
+		patternString = "<select";
+		pattern = new RegExp(patternString);
+		formElementHtml = formElementHtml.replace(pattern, "<select name='" + elementLabel + "'");
+	}
+	
+	// preselect the correct entry of the box
+	patternString = "option( )+value( )*=( )*('|\")"+elementValue+"('|\")";
+	pattern = new RegExp(patternString);
+	var patternStringForReplace = "option value = '"+elementValue+"'";
+	formElementHtml = formElementHtml.replace(pattern, patternStringForReplace+" selected");
+	return formElementHtml;
+}
+
+function prepareDatepicker (formElementHtml, categoryName, isMandatory, elementLabel, elementValue, styleId) {
+	var classString = (styleId == '0') ? "" : styleId;
+	var patternString = "<input";
+	var pattern = new RegExp(patternString);
+		
+	// set category
+	if (categoryName) {
+		formElementHtml = formElementHtml.replace(pattern, patternString + " category='" + categoryName + "' ");
+	}
+
+	if (isMandatory) {
+		// set border if mandatory
+		classString += " mandatory";
+	}
+	classString = (classString !== "") ? " class='"+classString+" hasdatepicker' " : " ";
+	formElementHtml = formElementHtml.replace(pattern, patternString + classString);
+
+	// set name of select box to elementlabel
+	patternString = "name\s*=\s*\\*('|\")\w+\\*('|\")";
+	pattern = new RegExp(patternString);
+	if (pattern.test(formElementHtml)) {
+		formElementHtml = formElementHtml.replace(pattern, "name='" + elementLabel + "'");
+	}
+	else {
+		patternString = "<input";
+		pattern = new RegExp(patternString);
+		formElementHtml = formElementHtml.replace(pattern, "<input name='" + elementLabel + "'");
+	}
+	
+	// preselect the correct entry of the box
+	patternString = "<input";
+	pattern = new RegExp(patternString);
+	formElementHtml = formElementHtml.replace(pattern, patternString + " value='"+elementValue+"'");
+
+	return formElementHtml;
+}
+
+function prepareTextArea (formElementHtml, categoryName, isMandatory, elementLabel, elementValue, styleId) {
+	var classString = (styleId == '0') ? "" : styleId;
+	var patternString = "<textarea";
+	var pattern = new RegExp(patternString);
+	// set category
+	if (categoryName) {
+		formElementHtml = formElementHtml.replace(pattern, patternString + " category='" + categoryName + "' ");
+	}
+
+	if (isMandatory) {
+		// set border if mandatory
+		classString += " mandatory";
+	}
+	classString = (classString !== "") ? " class='"+classString+"' " : " ";
+	formElementHtml = formElementHtml.replace(pattern, patternString + classString);
+
+	// set name of select box to elementlabel
+	patternString = "name\s*=\s*\\*('|\")\w+\\*('|\")";
+	pattern = new RegExp(patternString);
+	if (pattern.test(formElementHtml)) {
+		formElementHtml = formElementHtml.replace(pattern, "name='" + elementLabel + "'");
+	}
+	else {
+		patternString = "<textarea";
+		pattern = new RegExp(patternString);
+		formElementHtml = formElementHtml.replace(pattern, "<textarea name='" + elementLabel + "'");
+	}
+	
+	// preselect the correct entry of the box
+	patternString = "<\/textarea>";
+	pattern = new RegExp(patternString);
+	formElementHtml = formElementHtml.replace(pattern, elementValue + patternString);
+
+	return formElementHtml;
+}
+
+
+
+// Returns a form with the elements of a selected WFS grouped in tabs
+// (if the original WFS is the selected WFS, the values are set too)
+var initialTab = false;
+
 // returns a form with the elements of a selected wfs
 // (if the original wfs is the selected wfs, the values are set too)
 function buildElementForm(wfsConfIndex, memberIndex){
@@ -1654,78 +1854,167 @@
 	}
 	
 	if (typeof(featureTypeArray["element"]) !== "undefined") {
-
-		str += "<form id='"+featureTypeElementFormId+"'>\n\t<table>\n";
 		featureTypeElementArray = featureTypeArray["element"];
-		
-		//
-		// 2. add rows to form 
-		//
-		for (var i = 0 ; i < featureTypeElementArray.length ; i ++) {
-			var featureTypeElement = featureTypeElementArray[i];
 
-			var elementName = featureTypeElement['element_name'];
-			var elementType = featureTypeElement['element_type'];
-			var isEditable = (parseInt(featureTypeElement['f_edit']) == 1); 
-			var isMandatory = (parseInt(featureTypeElement['f_mandatory']) == 1); 
-			var isGeomColumn = (parseInt(featureTypeElement['f_geom']) == 1); 
 
-			var elementLabelExists = (featureTypeElement['f_label'] != "");
-			var elementLabel = ""; 
-			if (elementLabelExists) {
-				elementLabel = featureTypeElement['f_label'];
+		// Check if there are categories given and
+		// build the form in tabs if necessary
+		var elementCategories = [];
+		for(var i = 0; i < featureTypeElementArray.length; i++){
+			var categoryName         = featureTypeElementArray[i].f_category_name;
+			var categoryNameIsUnique = true;
+			
+			if(categoryName.length === 0) { continue; }
+			
+			for(var j = 0; j < elementCategories.length; j++) {
+				if(elementCategories[j] == categoryName) {
+					categoryNameIsUnique = false;
+				}
 			}
-			var elementLabelStyle = featureTypeElement['f_label_id'];
+			
+			if(categoryNameIsUnique) {
+				elementCategories.push(categoryName);
+			}
+		}
 
-			if (!isGeomColumn) {
-				if (isEditable) {
-					str += "\t\t<tr>\n";
-					str += "\t\t\t<td>\n\t\t\t\t<div class = '"+elementLabelStyle+"''>" + elementLabel + "</div>\n\t\t\t</td>\n";
-					str += "\t\t\t<td>\n";
+		str += "<form id='"+featureTypeElementFormId+"'>\n\t";
+		
+		var hasCategories = (elementCategories.length > 0);
+		if (hasCategories) {
+			elementCategories.sort();
+			
+			initialTab = elementCategories[0];
+			for (var currentCategory = 0; currentCategory < elementCategories.length; currentCategory++) {
+				str += '<a href="#" id="tabheader_' + elementCategories[currentCategory] + '" class="tabheader" onclick="return window.opener.toggleTabs(\'' + elementCategories[currentCategory] + '\')">' + elementCategories[currentCategory] + '</a>';
+			}
+		}
+			
+		for (var currentCategory = 0; currentCategory < elementCategories.length || !hasCategories; currentCategory++) {
+			if (hasCategories) {
+				str += '<div id="tab_' + elementCategories[currentCategory] + '" class="tabcontent">';
+			}
+			str += '<table>';
 
-					var elementValue = "";
-					if (!featureTypeMismatch) {
-						for (var j = 0 ; j < memberElements.count() ; j ++) {
-							if (memberElements.getName(j) == featureTypeElement['element_name']) {
-								elementValue = memberElements.getValue(j);
+			//
+			// 2. add rows to form 
+			//
+			for (var i = 0 ; i < featureTypeElementArray.length ; i++) {
+				var featureTypeElement = featureTypeElementArray[i];
+
+				var elementName = featureTypeElement['element_name'];
+				var elementType = featureTypeElement['element_type'];
+				var isEditable = (parseInt(featureTypeElement['f_edit']) == 1); 
+				var isMandatory = (parseInt(featureTypeElement['f_mandatory']) == 1); 
+				var isGeomColumn = (parseInt(featureTypeElement['f_geom']) == 1); 
+
+				if(hasCategories && featureTypeElement.f_category_name != elementCategories[currentCategory] && !isGeomColumn) {
+					continue;
+				}
+			
+
+				var elementLabelExists = (featureTypeElement['f_label'] != "");
+				var elementLabel = ""; 
+				if (elementLabelExists) {
+					elementLabel = featureTypeElement['f_label'];
+				}
+				var elementLabelStyle = featureTypeElement['f_label_id'];
+
+				if (!isGeomColumn) {
+					if (isEditable) {
+						str += "\t\t<tr>\n";
+						if(elementLabelExists) {
+							str += "\t\t\t<td>\n\t\t\t\t<div class = '"+elementLabelStyle+"''>" + elementLabel + "</div>\n\t\t\t</td>\n";
+							str += "\t\t\t<td>\n";
+						}
+						else {
+							str += '<td colspan="2">';
+						}
+
+						var elementValue = "";
+						if (!featureTypeMismatch) {
+							for (var j = 0 ; j < memberElements.count() ; j ++) {
+								if (memberElements.getName(j) == featureTypeElement['element_name']) {
+									elementValue = memberElements.getValue(j);
+								}
 							}
 						}
-					}
-					var formElementHtml = featureTypeElement['f_form_element_html']; 
-					if (!formElementHtml || !formElementHtml.match(/&lt;select/)) {
-						str += "\t\t\t\t<input id = 'datatype_mb_digitize_form_" + elementName + "' name='datatype' type='hidden' value = '" + elementType + "'>\n";
-						str += "\t\t\t\t<input id = 'mandatory_mb_digitize_form_" + elementName + "' name='mandatory' type='hidden' value = '" + isMandatory + "'>\n";
-						str += "\t\t\t\t<input id = 'mb_digitize_form_" + elementName + "' name='" + elementLabel + "' type='text' class = '"+featureTypeElement['f_style_id']+"' size=20 value = '" + elementValue + "'>\n";
-					}
-					else {
+						var formElementHtml = featureTypeElement['f_form_element_html']; 
+						if (!formElementHtml) {
+							var classString = (styleId == '0') ? "" : featureTypeElement['f_style_id'];
+							if (parseInt(featureTypeElement['f_mandatory']) == 1) {
+								classString += " mandatory";
+							}
+
+							classString = (classString !== "") ? " class='"+classString+"' " : " ";
+							
+							str += "\t\t\t\t<input id = 'datatype_mb_digitize_form_" + elementName + "' name='datatype' type='hidden' value = '" + elementType + "'>\n";
+							if (!hasCategories) {
+								str += "\t\t\t\t<input id = 'mb_digitize_form_" + elementName + "' name='" + elementLabel + "' type='text' "+classString+" size=20 value = '" + elementValue + "'>\n";
+							}
+							else {
+								str += "\t\t\t\t<input category='"+elementCategories[currentCategory]+"' id = 'mb_digitize_form_" + elementName + "' name='" + elementLabel + "' type='text' "+classString+" size=20 value = '" + elementValue + "'>\n";
+							}
+						}
+						else {
 							while (formElementHtml.match(/\\/)) {
 								formElementHtml = formElementHtml.replace(/\\/, "");
-								
 							} 
-							formElementHtml = formElementHtml.replace(/&lt;/g,'<');
-							formElementHtml = formElementHtml.replace(/&gt;/g,'>');
-							formElementHtml = formElementHtml.replace(/&#039;/g,'\'');
-							str += "\t\t\t\t<input id = 'datatype_" + elementName + "' name='datatype' type='hidden' value = '" + elementType + "'>\n";
-							str += "\t\t\t\t<input id = 'mandatory_" + elementName + "' name='mandatory' type='hidden' value = '" + isMandatory + "'>\n";
-							// preselect the correct entry of the box
-							var	patternString = "option( )+value( )*=( )*('|\")"+elementValue+"('|\")";
-							var pattern = new RegExp(patternString);
-							var patternStringForReplace = "option value = '"+elementValue+"'";
-							formElementHtml = formElementHtml.replace(pattern, patternStringForReplace+" selected");
+
+							var isMandatory = (parseInt(featureTypeElement['f_mandatory']) == 1);
+
+							var patternString = "<select";
+							pattern = new RegExp(patternString);
+							var styleId = featureTypeElement['f_style_id'];
+							if (pattern.test(formElementHtml)) {
+								formElementHtml = prepareSelectBox(formElementHtml, "", isMandatory, elementLabel, elementValue, styleId);
+							}
+							var patternString = "hasdatepicker";
+							pattern = new RegExp(patternString);
+							if (pattern.test(formElementHtml)) {
+								formElementHtml = prepareDatepicker(formElementHtml, "", isMandatory, elementLabel, elementValue, styleId);
+							}
+							var patternString = "<textarea";
+							pattern = new RegExp(patternString);
+							if (pattern.test(formElementHtml)) {
+								formElementHtml = prepareTextArea(formElementHtml, "", isMandatory, elementLabel, elementValue, styleId);
+							}
 							str += formElementHtml;
+						}
+						
+						if(featureTypeElement.f_helptext.length > 0) {
+							str += ' <a href="#" onclick="return window.opener.showHelptext(' + i + ')"><img src="../img/help.png" width="16" height="16" alt="?" /></a> ';
+							str += '<div id="helptext' +i+ '" class="helptext">';
+							str += '<p>';
+							str += featureTypeElement.f_helptext.replace(/(http:\/\/\S*)/g,'<a href="$1" target="blank">$1<\/a>');
+							str += '<a href="#" class="close" onclick="return window.opener.hideHelptext(' + i + ')">close</a>';
+							str += '</p>';
+							str += '</div>';
+						}
+						
+						str += "\t\t\t</td>\n\t\t</tr>\n";
 					}
-					str += "\t\t\t</td>\n\t\t</tr>\n";
 				}
+				else {
+					hasGeometryColumn = true;
+				}
 			}
-			else {
-				hasGeometryColumn = true;
+
+			str += '</table>';
+			if (hasCategories) {
+				str += '</div>';
 			}
+
+			// if no categories exist, the for loop would be 
+			// infinite without this break
+			if (!hasCategories) {
+				break;
+			}
 		}
 
 		//
 		// 3. add buttons "save", "update", "delete"
 		//
-		str += "</table><table>";
+		str += "<table>";
 		var isTransactional = (featureTypeArray['wfs_transaction']); 
 		if (isTransactional) {
 			str += "\t\t<tr>\n";
@@ -1974,6 +2263,6 @@
 	</head>
 	<body onload="registerFunctions();displayButtons();">
 		<div id='digButtons'></div>
-		<div id='listOfGeometries' class='digitizeGeometryList'></div>
+		<div style='position:absolute;top:60px;left:5px' id='listOfGeometries' class='digitizeGeometryList'></div>
 	</body>
 </html>



More information about the Mapbender_commits mailing list