[Mapbender-commits] r3221 - in trunk/mapbender: http/php lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Nov 12 03:45:16 EST 2008
Author: christoph
Date: 2008-11-12 03:45:16 -0500 (Wed, 12 Nov 2008)
New Revision: 3221
Modified:
trunk/mapbender/http/php/mod_button_tooltips.php
trunk/mapbender/lib/button.js
Log:
adapted AJAX call to JSON RPC, see
http://trac.osgeo.org/mapbender/ticket/322
Modified: trunk/mapbender/http/php/mod_button_tooltips.php
===================================================================
--- trunk/mapbender/http/php/mod_button_tooltips.php 2008-11-12 08:43:19 UTC (rev 3220)
+++ trunk/mapbender/http/php/mod_button_tooltips.php 2008-11-12 08:45:16 UTC (rev 3221)
@@ -18,8 +18,6 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
-require_once(dirname(__FILE__)."/../classes/class_json.php");
-require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
$buttonObj = array();
@@ -31,9 +29,11 @@
array_push($buttonObj, array("id" => $row["e_id"], "title" => $row["e_title"]));
}
-$json = new Mapbender_JSON();
-$output = $json->encode($buttonObj);
+$ajaxResponse = new AjaxResponse($_REQUEST);
+$ajaxResponse->setResult($buttonObj);
+$ajaxResponse->send();
+//$output = $json->encode($buttonObj);
-header("Content-type:text/plain; charset=utf-8");
-echo $output;
+//header("Content-type:text/plain; charset=utf-8");
+//echo $output;
?>
\ No newline at end of file
Modified: trunk/mapbender/lib/button.js
===================================================================
--- trunk/mapbender/lib/button.js 2008-11-12 08:43:19 UTC (rev 3220)
+++ trunk/mapbender/lib/button.js 2008-11-12 08:45:16 UTC (rev 3221)
@@ -122,23 +122,27 @@
}
}
}
-function updateButtonTooltips(obj) {
+function updateButtonTooltips(obj, result, message) {
+ if (!result) {
+ alert(message);
+ return;
+ }
+ var buttonArray = obj;
// this one only changes those in the main frame
var imageArray = document.getElementsByTagName("img");
for (var i = 0; i < imageArray.length; i++) {
- for(var j=0; j<obj.length; j++){
- if (imageArray[i].id == obj[j].id) {
- document.getElementById(imageArray[i].id).title = obj[j].title;
+ for(var j=0; j<buttonArray.length; j++){
+ if (imageArray[i].id == buttonArray[j].id) {
+ document.getElementById(imageArray[i].id).title = buttonArray[j].title;
}
}
}
}
function mb_localizeButtons(){
- mb_ajax_json("../php/mod_button_tooltips.php", function(obj, status){
- updateButtonTooltips(obj);
- });
-}
+ var req = new Mapbender.Ajax.Request();
+ req.send("../php/mod_button_tooltips.php", updateButtonTooltips);
+};
eventLocalize.register(function () {
mb_localizeButtons();
More information about the Mapbender_commits
mailing list