2
0
forked from Wavyzz/dolibarr

Modif pour mieux grer l'activation ou dsactivation de code javascript.

This commit is contained in:
Laurent Destailleur
2005-12-03 20:43:33 +00:00
parent c1bef265d6
commit 6f4dd8bf60
5 changed files with 180 additions and 44 deletions

View File

@@ -696,6 +696,16 @@ function img_disable($alt = "default")
}
/**
\brief Affiche logo help avec curseur "?"
\return string Retourne tag img
*/
function img_help()
{
global $conf,$langs;
return '<img style="cursor: help;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/help.png" border="0" alt="" title="">';
}
/**
\brief Affiche logo info
\param alt Texte sur le alt de l'image
@@ -705,7 +715,7 @@ function img_info($alt = "default")
{
global $conf,$langs;
if ($alt=="default") $alt=$langs->trans("Informations");
return '<img src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/info.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
return '<img style="cursor: help;" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/info.png" border="0" alt="'.$alt.'" title="'.$alt.'">';
}
/**

79
htdocs/lib/lib_foot.js Normal file
View File

@@ -0,0 +1,79 @@
// Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
//
// Script javascript mis en bas de page (avant fin de body)
//
// \file htdocs/lib/lib_foot.js
// \brief Fichier qui inclue les fonctions javascript de fin de page si option use_javascript active
// \version $Revision$
/***********************************************
* Cool DHTML tooltip script- <20> Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}
function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"
//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}
function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip;

View File

@@ -1,3 +1,11 @@
// Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
//
// Script javascript mis en en-tete de pages (dans section head)
//
// \file htdocs/lib/lib_head.js
// \brief Fichier qui inclue les fonctions javascript d'en-tete si option use_javascript active
// \version $Revision$
// Pour la fonction de saisi auto des villes
// *****************************************
@@ -23,42 +31,6 @@ function autofilltownfromzip_save_refresh_create()
}
// Pour les tooltips
//******************
function ShowTip(fArg)
{
var tooltipOBJ = (document.getElementById) ? document.getElementById('tt' + fArg) : eval("document.all['tt" + fArg + "']");
if (tooltipOBJ != null) {
var tooltipLft = (document.body.offsetwidth?document.body.offsetwidth:document.body.style.pixelWidth) - (tooltipOBJ.offsetWidth?tooltipOBJ.offsetWidth:(tooltipOBJ.style.pixelWidth?tooltipOBJ.style.pixelWidth:300)) - 30;
var tooltipTop = 10;
if (navigator.appName == 'Netscape') {
tooltipTop = (document.body.scrolltop>=0?document.body.scrolltop+10:event.clientY+10);
tooltipOBJ.style.top = tooltipTop+"px";
tooltipOBJ.style.left = tooltipLft+"px";
}
else {
tooltipTop = (document.body.scrolltop>=0?document.body.scrolltop+10:event.clientY+10);
tooltipTop = (document.body.scrollTop>=0?document.body.scrollTop+10:event.clientY+10);
if ((event.clientX > tooltipLft) && (event.clientY < (tooltipOBJ.scrollHeight?tooltipOBJ.scrollHeight:tooltipOBJ.style.pixelHeight) + 10)) {
tooltipTop = (document.body.scrolltop?document.body.scrolltop:document.body.offsetTop) + event.clientY + 20;
}
tooltipOBJ.style.left = tooltipLft;
tooltipOBJ.style.top = tooltipTop;
}
tooltipOBJ.style.visibility = "visible";
}
}
function HideTip(fArg)
{
var tooltipOBJ = (document.getElementById) ? document.getElementById('tt' + fArg) : eval("document.all['tt" + fArg + "']");
if (tooltipOBJ != null) {
tooltipOBJ.style.visibility = "hidden";
}
}
// Pour la saisie des dates par calendrier
// ***************************************
@@ -262,3 +234,73 @@ function displaySelectBoxes() {
}
}
}
/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function showtip(thetext){
if (ns6||ie){
tipobj.innerHTML=thetext
enabletip=true
return false
}
}
function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"
//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}
function hidetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip;

View File

@@ -255,6 +255,7 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
llxHeader("","",$langs->trans("ProductServiceCard"));
$html = new Form($db);
/*
@@ -262,7 +263,6 @@ llxHeader("","",$langs->trans("ProductServiceCard"));
*/
if ($_GET["action"] == 'create' && $user->rights->produit->creer)
{
$html = new Form($db);
$product = new Product($db);
if ($_error == 1)
{
@@ -547,7 +547,6 @@ if ($_GET["id"] || $_GET["ref"])
$langs->load("bills");
print '<tr><td>'.$langs->trans("VATRate").'</td><td colspan="2">';
$html = new Form($db);
print $html->select_tva("tva_tx", $product->tva_tx, $mysoc, '');
print '</td></tr>';
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
@@ -639,7 +638,6 @@ print "\n</div><br>\n";
if ($_GET["id"] && $_GET["action"] == '' && $product->envente)
{
$htmls = new Form($db);
$propal = New Propal($db);
print '<table width="100%" class="noborder">';
@@ -712,7 +710,7 @@ if ($_GET["id"] && $_GET["action"] == '' && $product->envente)
print '<table class="noborder" width="100%">'.$otherprop;
print '<input type="hidden" name="action" value="addinpropal">';
print '<tr '.$bc[$var].'><td colspan="3">'.$langs->trans("OtherPropals").'</td><td>';
$htmls->select_array("propalid", $otherprop);
$html->select_array("propalid", $otherprop);
print '</td></tr>';
print '<tr '.$bc[$var].'><td>'. strftime("%d %b",$objp->dp)."</td><td nowrap>\n";
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("Discount");

View File

@@ -829,9 +829,16 @@ padding: 2px;
/* ============================================================================== */
/* Tooltips */
/* ============================================================================== */
div.tooltip {
position:absolute; top: 0px; left: 0px; z-index: 2; width: 300px; visibility:hidden; font: 8pt 'MS Comic Sans','Arial',sans-serif;
background-color: #FFFFE6; padding: 8px; border: 1px solid black;
#dhtmltooltip
{
position: absolute;
width: 200px;
border: 1px solid #444444;
padding: 2px;
background-color: lightyellow;
visibility: hidden;
z-index: 100;
}