[Mapbender-commits] r2002 - in trunk/mapbender/http: javascripts php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jan 21 11:33:42 EST 2008
Author: nimix
Date: 2008-01-21 11:33:42 -0500 (Mon, 21 Jan 2008)
New Revision: 2002
Modified:
trunk/mapbender/http/javascripts/mod_help.php
trunk/mapbender/http/php/mod_help.php
Log:
add help for tabs and move to ajax
Modified: trunk/mapbender/http/javascripts/mod_help.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_help.php 2008-01-21 16:31:07 UTC (rev 2001)
+++ trunk/mapbender/http/javascripts/mod_help.php 2008-01-21 16:33:42 UTC (rev 2002)
@@ -54,13 +54,15 @@
mb_button[ind].stop = new Function ("mod_help_disable()");
}
function mod_help_click(){
- if(document.getElementById('mod_help_load')){
- document.getElementById('mod_help_img').innerHTML = mod_help_str;
- mod_help_draw();
+ if(!document.getElementById('mod_help_img')){
+ //create html tags
+ mod_help_set();
+ //request help string
+ mb_ajax_post("../php/mod_help.php?gui_id=<?php echo $gui_id ?>", null, mod_help_set_str);
+ return;
}
- else{
- var t = mod_help_set();
- }
+
+ mod_help_set_str(mod_help_str, "success");
}
function mod_help_disable(){
document.getElementById('mod_help_img').innerHTML = '';
@@ -70,14 +72,6 @@
mb_disableThisButton(mod_help_elName);
}
function mod_help_set(){
- var iframe = document.createElement('iframe');
- iframe.setAttribute("src", "../php/mod_help.php?gui_id=<?php echo $gui_id ?>");
- var tmp = document.body.appendChild(iframe);
- tmp.id = 'mod_help_load';
- tmp.style.width = '1px';
- tmp.style.height='1px';
- tmp.style.visibility = 'hidden';
-
var helpimg = document.createElement('div');
var tmp = document.body.appendChild(helpimg);
tmp.id = 'mod_help_img';
@@ -100,11 +94,27 @@
return true;
}
-function mod_help_set_str(str){
+function mod_help_set_str(str, status){
mod_help_str = str;
document.getElementById('mod_help_img').innerHTML = mod_help_str;
+ mod_help_update();
mod_help_draw();
}
+
+function mod_help_update(){
+ //try to update tab coords
+ try{
+ for(var j=0;j< tabs.count(); j++){
+ var ta = tabs.get(j);
+ var area = document.getElementById("helpArea_"+ta.module);
+ if(area)
+ area.coords = tabs.getCoords(ta.module);
+ }
+ }
+ catch(e){
+ }
+}
+
function mod_help_draw(){
var canvas = new jsGraphics('mod_help_draw');
canvas.setStroke(parseInt(mod_help_thickness));
@@ -114,6 +124,6 @@
var myc = my.areas[i].coords.split(",");
canvas.drawRect(parseInt(myc[0]),parseInt(myc[1]),parseInt(myc[2]) - parseInt(myc[0]),parseInt(myc[3]) - parseInt(myc[1]));
canvas.paint();
- }
+ }
}
Modified: trunk/mapbender/http/php/mod_help.php
===================================================================
--- trunk/mapbender/http/php/mod_help.php 2008-01-21 16:31:07 UTC (rev 2001)
+++ trunk/mapbender/http/php/mod_help.php 2008-01-21 16:33:42 UTC (rev 2002)
@@ -20,11 +20,7 @@
require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
-?>
-<html>
-<head><title></title></head>
-<script language="JavaScript" type="text/javascript">
-<?php
+
$e_id_css = 'help';
$gui_id = $_REQUEST["gui_id"];
include(dirname(__FILE__)."/../include/dyn_php.php");
@@ -35,9 +31,8 @@
$mod_help_height = 1000;
}
?>
-function init(){
- var str = "<img src='../img/transparent.gif' style='cursor:help' width='<?php echo $mod_help_width ?>' height='<?php echo $mod_help_height ?>' usemap='#mod_help_imagemap' border='0'>";
- str += "<map name='mod_help_imagemap'>";
+<img src='../img/transparent.gif' style='cursor:help' width='<?php echo $mod_help_width ?>' height='<?php echo $mod_help_height ?>' usemap='#mod_help_imagemap' border='0'>
+ <map name='mod_help_imagemap'>
<?php
$gui_id = $_REQUEST["gui_id"];
$sql = "SELECT * FROM gui_element WHERE fkey_gui_id = $1 AND e_url <> '' AND e_public = 1";
@@ -46,11 +41,12 @@
$res = db_prep_query($sql, $v, $t);
$cnt = 0;
while($row = db_fetch_array($res)){
- echo "str += '<area onclick=\"mod_help_disable();";
+ echo "<area onclick=\"mod_help_disable();";
if($row["e_id"] != 'help'){
- echo "window.open(\'".$row["e_url"]."\');";
+ echo "window.open('".$row["e_url"]."');";
}
- echo "\"";
+ echo "\" ";
+ echo "id=\"helpArea_".$row['e_id']."\" ";
echo "shape=\"rect\" coords=\"".$row['e_left'].",".$row['e_top'].",";
echo ($row['e_left']+$row['e_width']).",".($row['e_top']+$row['e_height'])."\" ";
// echo "href=\"".$row["e_url"]."\" ";
@@ -62,15 +58,8 @@
else{
echo "alt=\"HELP: ".$mod_help_text."\" title=\"HELP: ".$mod_help_text."\" ";
}
- echo " nohref>';";
+ echo " nohref>";
$cnt++;
}
?>
- str += "</map>";
- parent.mod_help_set_str(str);
-}
-</script>
-
-<body onload='init();'>
-</body>
-</html>
\ No newline at end of file
+</map>
\ No newline at end of file
More information about the Mapbender_commits
mailing list