replace g()

This commit is contained in:
Dany wm 2024-10-14 09:23:16 +02:00 committed by sparkyx
parent 9e5745aedb
commit d021d1b061
5 changed files with 28 additions and 10 deletions

View file

@ -431,6 +431,7 @@ function search_get_card(obj)
}
/**
* show the answer of ajax request
* @see search_get_card
*@param answer in XML
*/
function result_card_search(req)

View file

@ -101,7 +101,8 @@ function displaySelectBox(p_name) {
newDiv.style.top=locPosY+"px";
newDiv.style.left=document.getElementById(p_name+"_bt").offsetLeft+"px";
newDiv.setStyle({display:"block",position:"absolute","z-index":999});
card_layer++;
newDiv.setStyle({display:"block",position:"absolute","z-index":card_layer});
if ( id$("search_"+p_name+"_list") ) {
var sTmp = newDiv.innerHTML;

View file

@ -28,7 +28,8 @@ var ask_reload = 0;
// tag_choose Element which contains all the selected tags
var tag_choose = '';
var aDraggableElement = new Array();
// Layer for z-index , see function get_next_layer , must be used in PHP and JS
var layer=0;
// document.viewport depends of prototype.js
var viewport = document.viewport.getDimensions(); // Gets the viewport as an object literal
var width = viewport.width; // Usable window width
@ -123,8 +124,9 @@ function trim(s) {
* @return the found object of undefined if not found
*/
function id$(ID) {
if (ID instanceof Object ) return ID;
if (document.getElementById) {
return this.document.getElementById(ID);
return (document.getElementById(ID)||console.error(`id$ not found ${ID}`)) ;
} else if (document.all) {
return document.all[ID];
} else {
@ -133,6 +135,19 @@ function id$(ID) {
}
}
/**
* this function is deprecated and replaced by id$
* @deprecated
* @param ID
* @returns {*}
*/
function g(ID) {
console.warn(`g(${ID} is deprecated, use id$`);
return id$(ID);
}
function get_next_layer(){
return layer++;
}
/**
* enable the type of periode
*/
@ -764,11 +779,11 @@ function add_div(obj) {
/**
* remove a object created with add_div
* @param elt id of the elt
* @param str_elt string id of the elt
*/
function removeDiv(elt) {
if (id$(elt)) {
document.body.removeChild(id$(elt));
function removeDiv(str_elt) {
if (document.getElementById(str_elt)) {
document.body.removeChild(id$(str_elt));
}
// if reloaded if asked the window will be reloaded when
// the box is closed

View file

@ -326,7 +326,8 @@ case 'st':
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.',\''.$eltid.'\')">'.h($array[$i]['fd_label']).'</a>';
$r.='</td>';
$r.='<td>';
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.',\''.$eltid.'\')">'.h($array[$i]['fd_description'])."($nb_count)".'</a>';
$r.='<a href="javascript:void(0)" onclick="select_cat(\''.$array[$i]['fd_id'].'\','.$gDossier.',\''.$eltid.'\')">'.h
($array[$i]['fd_description'])."($nb_count)".'</a>';
$r.='</td>';
$r.="</tr>";

View file

@ -88,12 +88,12 @@ class IPoste extends HtmlInput
$this->extra2="all";
$this->extra="";
$this->attribute=array();
$this->id=$p_id;
$this->id=$p_id;
$this->nb_row=1;
}
static function ipopup($p_name)
static function ipopup($p_name)
{
$ip=new IPopup($p_name);
$ip->title='Plan comptable';