[Mapbender-commits] r1610 - trunk/mapbender/http/javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Aug 6 05:55:51 EDT 2007


Author: christoph
Date: 2007-08-06 05:55:51 -0400 (Mon, 06 Aug 2007)
New Revision: 1610

Modified:
   trunk/mapbender/http/javascripts/mod_digitize_tab.php
Log:
i18nized

Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php	2007-08-06 09:54:23 UTC (rev 1609)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php	2007-08-06 09:55:51 UTC (rev 1610)
@@ -81,6 +81,7 @@
 
 var digitizeDivTag;
 
+var msgObj;
 var featureTypeElementFormId = "featureTypeElementForm";
 
 try {if(mod_digitize_elName){}}catch(e) {mod_digitize_elName = "digitize";}
@@ -129,7 +130,7 @@
 	if (d.getGeometry(-1,-1).isComplete() || d.count() == 0){
 		
 		if (mod_digitizeEvent != false) {
-			alert(errorMessageNoGeometrySelected[selectedLanguage]);
+			alert(msgObj.errorMessageNoGeometrySelected);
 		}
 		return false;
 	}
@@ -366,9 +367,11 @@
 	registerDigitizeSubFunctions("updateListOfGeometries()");
 	registerDigitizeSubFunctions("drawDashedLine()");
 	registerDigitizeSubFunctions("updateMeasureTag()");
+	parent.mb_registerInitFunctions("window.frames['"+ mod_digitize_elName + "'].getMessages()");
 	parent.mb_registerInitFunctions("window.frames['"+ mod_digitize_elName + "'].setStyleForTargetFrame()");
 	parent.mb_registerInitFunctions("window.frames['"+ mod_digitize_elName + "'].checkDigitizeTag()");
 	parent.mb_registerInitFunctions("window.frames['"+ mod_digitize_elName + "'].initialiseSnapping()");
+	parent.mb_registerL10nFunctions("window.frames['"+ mod_digitize_elName + "'].getMessages()");
 	if (!nonTransactionalEditable) {
 		parent.mb_registerInitFunctions("window.frames['"+ mod_digitize_elName + "'].initialiseHighlight()");
 	}
@@ -417,8 +420,8 @@
 			if (d.getGeometry(-1, -1).count() > 0) {
 				if (mod_digitizeEvent == button_line || mod_digitizeEvent == button_polygon) {
 					var measureString = "";
-					measureString += measureTagLabelCurrent[selectedLanguage] + d.getGeometry(-1, -1).getCurrentDist(measureNumberOfDigits) + "<br>";
-					measureString += measureTagLabelTotal[selectedLanguage] + d.getGeometry(-1, -1).getTotalDist(measureNumberOfDigits);
+					measureString += msgObj.measureTagLabelCurrent + d.getGeometry(-1, -1).getCurrentDist(measureNumberOfDigits) + "<br>";
+					measureString += msgObj.measureTagLabelTotal + d.getGeometry(-1, -1).getTotalDist(measureNumberOfDigits);
 					measureDivTag.write(measureString);
 					return true;
 				}
@@ -573,7 +576,7 @@
 			}
 		}
 		else if (obj.id == button_clear) {
-			var clear = confirm(messageConfirmDeleteAllGeomFromList[selectedLanguage]);
+			var clear = confirm(msgObj.messageConfirmDeleteAllGeomFromList);
 			if (clear) {
 				d = new parent.GeometryArray();
 				parent.mb_disableThisButton(button_clear);
@@ -744,7 +747,7 @@
 		return resultName;
 	}
 	else {
-		return digitizeDefaultGeometryName[selectedLanguage];
+		return msgObj.digitizeDefaultGeometryName;
 	}
 }
 
@@ -758,23 +761,23 @@
 	
 				listOfGeom += "\t<tr>\n\t\t<td>\n";
 				if (wfsExistsForGeom(d.get(i), wfsConf)) {
-					listOfGeom += "\t\t\t<img src = '"+buttonDig_imgdir+buttonDig_wfs_src+"' title='"+buttonDig_wfs_title[selectedLanguage]+"' onclick='showWfs("+i+")'>\n";
+					listOfGeom += "\t\t\t<img src = '"+buttonDig_imgdir+buttonDig_wfs_src+"' title='"+msgObj.buttonDig_wfs_title+"' onclick='showWfs("+i+")'>\n";
 				}
 				listOfGeom += "\t\t</td>\n\t\t<td>\n";
-				listOfGeom += "\t\t\t<img src = '"+buttonDig_imgdir+buttonDig_remove_src+"' title='"+buttonDig_remove_title[selectedLanguage]+"' onclick='parent.mb_disableThisButton(mod_digitizeEvent);d.del("+i+");executeDigitizeSubFunctions();'>\n";
+				listOfGeom += "\t\t\t<img src = '"+buttonDig_imgdir+buttonDig_remove_src+"' title='"+msgObj.buttonDig_remove_title+"' onclick='parent.mb_disableThisButton(mod_digitizeEvent);d.del("+i+");executeDigitizeSubFunctions();'>\n";
 				listOfGeom += "\t\t</td>\n\t\t<td>\n";
 	
 				if (isValidWfsConfIndex(wfsConf, d.get(i).wfs_conf)) {
-					listOfGeom += "\t\t\t<img src = '"+buttonDig_imgdir+buttonDig_removeDb_src+"' title='"+buttonDig_removeDb_title[selectedLanguage]+"' onclick=\"var deltrans = confirm('"+messageConfirmDeleteGeomFromDb[selectedLanguage]+"');if (deltrans) dbGeom('delete', "+i+")\">\n";
+					listOfGeom += "\t\t\t<img src = '"+buttonDig_imgdir+buttonDig_removeDb_src+"' title='"+msgObj.buttonDig_removeDb_title+"' onclick=\"var deltrans = confirm('"+msgObj.messageConfirmDeleteGeomFromDb+"');if (deltrans) dbGeom('delete', "+i+")\">\n";
 				}
 				listOfGeom += "\t\t</td>\n\t\t<td style = 'color:blue;font-size:12px'>\n";
 				listOfGeom += "\t\t\t<div onmouseover='parent.mb_wfs_perform(\"over\",d.get("+i+"));' ";
 				listOfGeom += " onmouseout='parent.mb_wfs_perform(\"out\",d.get("+i+"))' ";
 				listOfGeom += " onclick='parent.mb_wfs_perform(\"click\",d.get("+i+"));' ";
 				var geomName = getName(d.get(i)); 
-				if (d.get(i).geomType == parent.geomType.polygon) {geomName += " ("+messageDescriptionPolygon[selectedLanguage]+")";}
-				else if (d.get(i).geomType == parent.geomType.line) {geomName += " ("+messageDescriptionLine[selectedLanguage]+")";}
-				else if (d.get(i).geomType == parent.geomType.point) {geomName += " ("+messageDescriptionPoint[selectedLanguage]+")";}
+				if (d.get(i).geomType == parent.geomType.polygon) {geomName += " ("+msgObj.messageDescriptionPolygon+")";}
+				else if (d.get(i).geomType == parent.geomType.line) {geomName += " ("+msgObj.messageDescriptionLine+")";}
+				else if (d.get(i).geomType == parent.geomType.point) {geomName += " ("+msgObj.messageDescriptionPoint+")";}
 				
 				listOfGeom += ">" + geomName +"</div>\t\t</td>\n\t</tr>\n";
 			}
@@ -828,7 +831,7 @@
 		}
 	}
 	if (!isCorrect) {
-		errorMessage = messageSelectAnOption[selectedLanguage] + "\n";
+		errorMessage = msgObj.messageSelectAnOption + "\n";
 	}
 	return {"isCorrect":isCorrect, "errorMessage":errorMessage};
 }
@@ -844,7 +847,7 @@
 			if (nodeArray[i].value == "true") {
 				if (doc.getElementById(nodeId).value == "") {
 					isCorrect = false;
-					errorMessage += "'"+ doc.getElementById(nodeId).name +"': "+ messageErrorFieldIsEmpty[selectedLanguage] +"\n";
+					errorMessage += "'"+ doc.getElementById(nodeId).name +"': "+ msgObj.messageErrorFieldIsEmpty +"\n";
 				}
 			}
 		}
@@ -891,14 +894,14 @@
 			if (nodeArray[i].value == "int") {
 				if (!isInteger(nodeValue)) {
 					isCorrect = false;
-					errorMessage += "'"+doc.getElementById(nodeId).name+"': "+ messageErrorNotAnInteger[selectedLanguage] + "\n";
+					errorMessage += "'"+doc.getElementById(nodeId).name+"': "+ msgObj.messageErrorNotAnInteger + "\n";
 				}
 			}
 			else if (nodeArray[i].value == "double") {
 				nodeValue = replaceCommaByDecimalPoint(nodeValue);
 				if (!isFloat(nodeValue)) {
 					isCorrect = false;
-					errorMessage += "'"+doc.getElementById(nodeId).name+"': "+ messageErrorNotAFloat[selectedLanguage] + "\n";
+					errorMessage += "'"+doc.getElementById(nodeId).name+"': "+ msgObj.messageErrorNotAFloat + "\n";
 				}
 				else {
 					doc.getElementById(nodeId).value = nodeValue;
@@ -1118,22 +1121,22 @@
 				onClickText += 	"}";
 				
 				if (options[i] == "save" && hasGeometryColumn && (!fid || showSaveButtonForExistingGeometries)) {
-					str += "\t\t\t<td><input type='button' name='saveButton' value='"+buttonLabelSaveGeometry[selectedLanguage]+"' onclick=\""+onClickText+"\" /></td>\n";
+					str += "\t\t\t<td><input type='button' name='saveButton' value='"+msgObj.buttonLabelSaveGeometry+"' onclick=\""+onClickText+"\" /></td>\n";
 				}
 				
 				if (!featureTypeMismatch && fid) {
 					if (options[i] == "update" && hasGeometryColumn) {
-						str += "\t\t\t<td><input type='button' name='updateButton' value='"+buttonLabelUpdateGeometry[selectedLanguage]+"' onclick=\""+onClickText+"\"/></td>\n";
+						str += "\t\t\t<td><input type='button' name='updateButton' value='"+msgObj.buttonLabelUpdateGeometry+"' onclick=\""+onClickText+"\"/></td>\n";
 					}
 					if (options[i] == "delete"){ 
-						var deleteOnClickText = "var deltrans = confirm('"+messageConfirmDeleteGeomFromDb[selectedLanguage]+"');";
+						var deleteOnClickText = "var deltrans = confirm('"+msgObj.messageConfirmDeleteGeomFromDb+"');";
 						deleteOnClickText += "if (deltrans){";
 						deleteOnClickText += onClickText + "}";
-						str += "\t\t\t<td><input type='button' name='deleteButton' value='"+buttonLabelDeleteGeometry[selectedLanguage]+"' onclick=\""+deleteOnClickText+"\"/></td>\n";
+						str += "\t\t\t<td><input type='button' name='deleteButton' value='"+msgObj.buttonLabelDeleteGeometry+"' onclick=\""+deleteOnClickText+"\"/></td>\n";
 					}
 				}
 				if (options[i] == "abort") {
-					str += "\t\t\t<td><input type='button' name='abortButton' value='"+buttonLabelAbort[selectedLanguage]+"' onclick=\"window.close();\" /></td>\n";
+					str += "\t\t\t<td><input type='button' name='abortButton' value='"+msgObj.buttonLabelAbort+"' onclick=\"window.close();\" /></td>\n";
 				}
 			}
 			str += "\t\t</tr>\n";
@@ -1159,7 +1162,7 @@
 	var mapObjInd = parent.getMapObjIndexByName(mod_digitize_target);
 
 	if (myconf['featuretype_srs'] != parent.mb_mapObj[mapObjInd].epsg) {
-		alert(errorMessageEpsgMismatch[selectedLanguage] + parent.mb_mapObj[mapObjInd].epsg + " / "+ myconf['featuretype_srs']);
+		alert(msgObj.errorMessageEpsgMismatch + parent.mb_mapObj[mapObjInd].epsg + " / "+ myconf['featuretype_srs']);
 	}
 	else {
 		var fid = false;
@@ -1177,7 +1180,7 @@
 						d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].value);
 					}
 					else {
-						errorMessage = messageErrorFormEvaluation[selectedLanguage];
+						errorMessage = msgObj.messageErrorFormEvaluation;
 					}
 				}
 				// selectbox
@@ -1186,7 +1189,7 @@
 						d.get(m).e.setElement(myform.elements[i].id, myform.elements[i].options[myform.elements[i].selectedIndex].value);
 					}
 					else {
-						errorMessage = messageErrorFormEvaluation[selectedLanguage];
+						errorMessage = msgObj.messageErrorFormEvaluation;
 					}
 				}
 			}
@@ -1217,10 +1220,10 @@
 	executeDigitizeSubFunctions();
 	
 	if (status == "success" && response == "success") {
-		var wfsWriteMessage = messageSuccessWfsWrite[selectedLanguage];
+		var wfsWriteMessage = msgObj.messageSuccessWfsWrite;
 	}
 	else {
-		var wfsWriteMessage = messageErrorWfsWrite[selectedLanguage];
+		var wfsWriteMessage = msgObj.messageErrorWfsWrite;
 	} 
 
 	if (typeof(wfsWindow) != 'undefined' && !wfsWindow.closed) {
@@ -1234,6 +1237,18 @@
 // --- wfs window (begin) -----------------------------------------------------------------------------------------
 // -----------------------------------------------------------------------------------------------------------
 
+function getMessages() {
+	parent.mb_ajax_json("../php/mod_digitize_messages.php", function(obj, status) {
+		msgObj = obj;
+		applyMessages();
+	});
+}
+
+function applyMessages() {
+	updateMeasureTag();
+	updateListOfGeometries();
+}
+
 	</script>
 	</head>
 	<body onload="registerFunctions();displayButtons();">



More information about the Mapbender_commits mailing list