svn commit: r378 - trunk/mapbender/http/javascripts/mod_help.php

uli at osgeo.org uli at osgeo.org
Fri Jun 2 09:10:02 EDT 2006


Author: uli
Date: 2006-06-02 13:10:01+0000
New Revision: 378

Added:
   trunk/mapbender/http/javascripts/mod_help.php   (contents, props changed)

Log:
new module for dynamic help


Added: trunk/mapbender/http/javascripts/mod_help.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_help.php?view=auto&rev=378
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/javascripts/mod_help.php	2006-06-02 13:10:01+0000
@@ -0,0 +1,98 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/mod_help
+# Copyright (C) 2002 CCGIS 
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once("../../conf/mapbender.conf");
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+$gui_id = $_REQUEST["gui_id"];
+
+$sql = "SELECT e_src, e_target FROM gui_element WHERE e_id = 'help' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sql, $v, $t);
+$cnt = 0;
+while($row = db_fetch_array($res)){ 
+   $e_src = $row["e_src"];
+   $cnt++;
+}
+if($cnt > 1){ echo "alert('help: ID not unique!');";}
+?>
+var mod_help_elName = "help";
+var mod_halp_str = "";
+var mod_help_img_on = new Image(); mod_help_img_on.src =  "<?php  echo preg_replace("/_off/","_on",$e_src);  ?>";
+var mod_help_img_off = new Image(); mod_help_img_off.src ="<?php  echo $e_src;  ?>";
+var mod_help_img_over = new Image(); mod_help_img_over.src = "<?php  echo preg_replace("/_off/","_over",$e_src);  ?>";
+
+function init_help(ind){
+	mb_button[ind] = document.getElementById(mod_help_elName);
+	mb_button[ind].img_over = mod_help_img_over.src;
+	mb_button[ind].img_on = mod_help_img_on.src;
+	mb_button[ind].img_off = mod_help_img_off.src;
+	mb_button[ind].status = 0;
+	mb_button[ind].elName = mod_help_elName;
+	mb_button[ind].go = new Function ("mod_help_click()");
+	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;
+	}
+	else{
+		var t = mod_help_set();
+	}
+}
+function mod_help_disable(){
+	document.getElementById('mod_help_img').innerHTML = '';
+	document.getElementById('mod_help_img').style.width = '0px';
+	document.getElementById('mod_help_img').style.height = '0px';
+	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';
+	tmp.style.position = 'absolute';
+	tmp.style.zIndex = '1000';
+	tmp.style.top = '0px';
+	tmp.style.left = '0px';
+	tmp.style.width = '1000px';
+	tmp.style.height='1000px';
+	return true;
+}
+function mod_help_set_str(str){
+	mod_help_str = str;
+	document.getElementById('mod_help_img').innerHTML = mod_help_str;
+}
+function mod_help_highlight(v){
+	if(v){
+		document.getElementById('mod_help_img').style.cursor = 'help';	
+	}
+	else{
+		document.getElementById('mod_help_img').style.cursor = 'pointer';
+	}
+}
+




More information about the Mapbender_commits mailing list