noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
infobulle.js
Go to the documentation of this file.
1/*
2 * This file is part of NOALYSS.
3 *
4 * NOALYSS is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * NOALYSS is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with NOALYSS; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/
18/**
19 * @file
20 * create the infobulle, the internalization is not yet implemented
21 * @code
22 // Example
23 echo JS_INFOBULLE;
24 echo Icon_Action::infobulle(x);
25 @endcode
26 */
27
28var posX=0,posY=0,offsetX=10,offsetY=10;
29document.onmousemove=getPosition;
30
31function showBulle(p_ctl){
32 var d=document.getElementById('bulle');
33 var viewport = document.viewport.getDimensions();
34 if ( posX+offsetX > viewport.width-d.getWidth()) { posX-=d.getWidth()+20;}
35 if ( posY+offsetY > viewport.height-d.getHeight()-20) { posY-=d.getHeight()+20}
36 d.innerHTML=content[p_ctl];
37 d.style.top=posY+offsetY+"px";
38 d.style.left=posX+offsetX-10+"px";
39 d.style.visibility="visible";
40}
41function getPosition(e)
42{
43 if (document.all)
44 {
45 posX=event.x+document.body.scrollLeft;
46 posY=event.y+document.body.scrollTop;
47 }
48 else
49 {
50 posX=e.pageX;
51 posY=e.pageY;
52 }
53}
54function hideBulle(p_ctl)
55{
56 var d=document.getElementById('bulle');
57 d.style.visibility="hidden";
58}
59function displayBulle(p_comment) {
60 var d=document.getElementById('bulle');
61 var viewport = document.viewport.getDimensions();
62 d.innerHTML=p_comment;
63 if ( posX+offsetX > viewport.width-d.getWidth()) { posX-=d.getWidth()+20;}
64 if ( posY+offsetY > viewport.height-d.getHeight()-20) { posY-=d.getHeight()+20}
65 d.style.top=posY+offsetY+"px";
66 d.style.left=posX+offsetX+"px";
67 d.style.visibility="visible";
68}
69
70/**
71 *
72 * @param p_name
73 * @see select_box.class.php
74 */
75function displaySelectBox(p_name) {
76 try {
77 var newDiv=null;
78 if (! document.getElementById("select_box_content"+p_name) ) {
79
80 newDiv=new Element("div");
81 newDiv.id="select_box_content"+p_name;
82 document.body.appendChild(newDiv);
83 newDiv.addClassName("select_box");
84 $("select_box_content"+p_name).onmouseleave=function() {
85 try {
86 var newDiv=$("select_box_content"+p_name);
87 newDiv.setStyle({display:"none"});
88 } catch(e) {
89 alert(e.message);
90 }
91 }
92 } else {
93 newDiv=document.getElementById("select_box_content"+p_name);
94 }
95 newDiv.innerHTML=$("select_box"+p_name).innerHTML;
96 var viewport = document.viewport.getDimensions();
97 var locPosY=posY;
98 if ( posY+offsetY+ newDiv.getHeight() > window.innerHeight -3) {
99 locPosY-=newDiv.getHeight()+20
100 }
101 newDiv.style.top=locPosY+"px";
102
103 newDiv.style.left=document.getElementById(p_name+"_bt").offsetLeft+"px";
104 newDiv.setStyle({display:"block",position:"absolute","z-index":999});
105
106 if ( $("search_"+p_name+"_list") ) {
107 var sTmp = newDiv.innerHTML;
108 var regex=new RegExp(p_name+"_list","g");
109 sTmp = sTmp.replace(regex,p_name+"_t_list");
110 newDiv.innerHTML=sTmp;
111 $("search_"+p_name+"_t_list").focus();
112 }
113 } catch(e) {
114 alert(e.message);
115 }
116
117}