[Mapbender-commits] r1637 - in trunk/mapbender/http: frames javascripts

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Aug 9 04:43:57 EDT 2007


Author: christoph
Date: 2007-08-09 04:43:57 -0400 (Thu, 09 Aug 2007)
New Revision: 1637

Modified:
   trunk/mapbender/http/frames/index.php
   trunk/mapbender/http/javascripts/map.js
   trunk/mapbender/http/javascripts/map.php
Log:
localization

Modified: trunk/mapbender/http/frames/index.php
===================================================================
--- trunk/mapbender/http/frames/index.php	2007-08-08 15:32:31 UTC (rev 1636)
+++ trunk/mapbender/http/frames/index.php	2007-08-09 08:43:57 UTC (rev 1637)
@@ -19,15 +19,23 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 session_start();
+mb_internal_encoding("UTF-8");
 
 require("../php/mb_validateSession.php");
-$_SESSION["mb_user_gui"] = $_REQUEST["gui_id"];
+require_once("../classes/class_locale.php");
 require_once("../../conf/mapbender.conf");
+
 $con = db_connect(DBSERVER,OWNER,PW);
 db_select_db(DB,$con);
 
 $pattern = '/sessionID/';
 
+$_SESSION["mb_user_gui"] = $_REQUEST["gui_id"];
+
+$localeObj = new Mb_locale($_SESSION["mb_lang"]);
+
+
+
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
@@ -95,9 +103,11 @@
 ?>
 </head>
 <?php
-$sql = "SELECT * FROM gui_element WHERE e_public = 1 AND fkey_gui_id = $1 ORDER BY e_pos";
-$v = array($_REQUEST["gui_id"]);
-$t = array('s');
+$sql = "SELECT fkey_gui_id,e_id,e_pos,e_public,e_comment,e_element,";
+$sql .= "e_src,e_attributes,e_left,e_top,e_width,e_height,e_z_index,e_more_styles,";
+$sql .= "e_content,e_closetag,e_js_file,e_mb_mod,e_target,e_requires,e_url,gettext($1, e_title) as e_title FROM gui_element WHERE e_public = 1 AND fkey_gui_id = $2 ORDER BY e_pos";
+$v = array($_SESSION["mb_lang"], $_REQUEST["gui_id"]);
+$t = array('s', 's');
 $res = db_prep_query($sql,$v,$t);
 $i = 0;
 while(db_fetch_row($res)){
@@ -110,10 +120,13 @@
 	if(db_result($res,$i,"e_attributes") != ""){
 		echo " ".stripslashes(preg_replace($pattern,$replacement,db_result($res,$i,"e_attributes")));
 	}
+	if(db_result($res,$i,"e_title") != ""){
+		echo " title='".db_result($res,$i,"e_title")."' ";
+	}
 	if(db_result($res,$i,"e_src") != ""){
 		if(db_result($res,$i,"e_closetag") == "iframe" && db_result($res,$i,"e_id") != 'loadData'){
       		echo " src = '".preg_replace($pattern,$replacement,db_result($res,$i,"e_src"));
-				if(strpos(db_result($res,$i,"e_src"), "?")) {
+				if(mb_strpos(db_result($res,$i,"e_src"), "?")) {
 					echo "&";
 				}
 				else {

Modified: trunk/mapbender/http/javascripts/map.js
===================================================================
--- trunk/mapbender/http/javascripts/map.js	2007-08-08 15:32:31 UTC (rev 1636)
+++ trunk/mapbender/http/javascripts/map.js	2007-08-09 08:43:57 UTC (rev 1637)
@@ -1488,6 +1488,30 @@
       }
    }
 }
+function updateButtonTooltips(obj) {
+	console.log("begin tooltip update");
+	for(var i=0; i<mb_button.length; i++){
+		console.log("button %i", i);
+		for(var j=0; j<obj.length; j++){
+			console.log("%s %s", mb_button[i].elName, obj[j].id);
+			if (mb_button[i].elName == obj[j].id) {
+				if (mb_button[i].frameName != "") {
+					window.frames[mb_button[i].frameName].document.getElementById(mb_button[i].elName).title = obj[j].title;
+				}
+				else {
+					document.getElementById(mb_button[i].elName).title = obj[j].title;
+				}
+				
+			}
+		}
+	}
+}
+function mb_localizeButtons() {
+	mb_ajax_json("../php/mod_button_tooltips.php", function(obj, status){
+		updateButtonTooltips(obj);
+	});
+}
+mb_registerInitFunctions("mb_registerL10nFunctions('mb_localizeButtons()');");
 
 /*
  ***************************************************************************************
@@ -1634,6 +1658,7 @@
 var mb_MapObjectSubFunctions = [];
 var mb_GetScalePreFunctions = [];
 var mb_loadWmsSubFunctions = [];
+var mb_l10nFunctions = [];
 
 function mb_registerInitFunctions(stringFunction){
 	mb_InitFunctions[mb_InitFunctions.length] = stringFunction;
@@ -1662,6 +1687,9 @@
 function mb_registerWfsWriteSubFunctions(stringFunction){
 	mb_WfsWriteSubFunctions[mb_WfsWriteSubFunctions.length] = stringFunction;
 }
+function mb_registerL10nFunctions(stringFunction) {
+	mb_l10nFunctions[mb_l10nFunctions.length] = stringFunction;
+}
 function mb_removeFunctionFromArray(arrayname,stringFunction){
 	var length = eval(arrayname+".length");
 	for(var i=0; i<length; i++){
@@ -1674,7 +1702,13 @@
 		}
 	}
 }
- 
+
+
+function localize() {
+	for(var i=0; i<mb_l10nFunctions.length; i++){
+		eval(mb_l10nFunctions[i]); 	 
+	} 	 
+}
 function mb_execloadWmsSubFunctions(){
 	for(var i=0; i<mb_loadWmsSubFunctions.length; i++){
 		eval(mb_loadWmsSubFunctions[i]); 	 

Modified: trunk/mapbender/http/javascripts/map.php
===================================================================
--- trunk/mapbender/http/javascripts/map.php	2007-08-08 15:32:31 UTC (rev 1636)
+++ trunk/mapbender/http/javascripts/map.php	2007-08-09 08:43:57 UTC (rev 1637)
@@ -26,6 +26,9 @@
 echo "var mb_myLogin = '".$_SESSION["mb_login"]."';";
 echo "var mb_styleID = '".md5($_SESSION["mb_user_name"])."';";
 echo "var mb_myBBOX = '".$_SESSION["mb_myBBOX"]."';";
+echo "var mapbender = {};";
+echo "mapbender.locale = '" . $_SESSION["mb_locale"] . "';";
+echo "mapbender.languageId = '" . $_SESSION["mb_lang"] . "';";
 echo "var owsproxy = '".OWSPROXY."';";
 echo "var global_mb_log_js = '".LOG_JS."';";
 echo "var global_mb_log_level = '".LOG_LEVEL."';";
@@ -33,11 +36,16 @@
 
 include("map.js");
 
-$con = db_connect($DBSERVER,$OWNER,$PW);
+ini_set('session.bug_compat_42',0);
+ini_set('session.bug_compat_warn',0);
+
+$con = db_connect(DBSERVER,OWNER,PW);
 db_select_db(DB,$con);
 
-$mb_sql = "SELECT DISTINCT e_js_file, e_id, e_src, e_target, e_pos FROM gui_element WHERE e_public = 1 AND fkey_gui_id = '".$_REQUEST["gui_id"]."' ORDER BY e_pos";
-$mb_res = db_query($mb_sql);
+$mb_sql = "SELECT DISTINCT e_js_file, e_id, e_src, e_target, e_pos FROM gui_element WHERE e_public = 1 AND fkey_gui_id = $1 ORDER BY e_pos";
+$mb_v = array($_REQUEST["gui_id"]);
+$mb_t = array("s");
+$mb_res = db_prep_query($mb_sql, $mb_v, $mb_t);
 //$mb_cnt = 0;
 while($row_js = db_fetch_array($mb_res)){
 	if($row_js["e_js_file"] != ""){



More information about the Mapbender_commits mailing list