From d021d1b061d7a428c1dcf6e0681cbd59ce2d4a8b Mon Sep 17 00:00:00 2001 From: Dany wm Date: Mon, 14 Oct 2024 09:23:16 +0200 Subject: [PATCH] replace g() --- html/js/card.js | 1 + html/js/infobulle.js | 3 ++- html/js/noalyss_script.js | 27 +++++++++++++++++++++------ include/ajax/ajax_card.php | 3 ++- include/lib/iposte.class.php | 4 ++-- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/html/js/card.js b/html/js/card.js index 7bd3b6239..1e131447f 100644 --- a/html/js/card.js +++ b/html/js/card.js @@ -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) diff --git a/html/js/infobulle.js b/html/js/infobulle.js index 37c52a547..2ab0cfd96 100644 --- a/html/js/infobulle.js +++ b/html/js/infobulle.js @@ -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; diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index 69df81e2c..001d77048 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -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 diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php index 7e0dcf1f7..ab74ca0f5 100644 --- a/include/ajax/ajax_card.php +++ b/include/ajax/ajax_card.php @@ -326,7 +326,8 @@ case 'st': $r.=''.h($array[$i]['fd_label']).''; $r.=''; $r.=''; - $r.=''.h($array[$i]['fd_description'])."($nb_count)".''; + $r.=''.h + ($array[$i]['fd_description'])."($nb_count)".''; $r.=''; $r.=""; diff --git a/include/lib/iposte.class.php b/include/lib/iposte.class.php index 74ea4b054..3cd03c11a 100644 --- a/include/lib/iposte.class.php +++ b/include/lib/iposte.class.php @@ -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';