[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 192/219: Select_box : add a new type of value
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 192/219: Select_box : add a new type of value and fix a problem with the position of the div |
Date: |
Mon, 18 Dec 2017 13:23:01 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit beaa17e66dd2a9076c8ed2930daa1a08d062ee67
Author: Dany De Bontridder <address@hidden>
Date: Sun Dec 10 13:54:59 2017 +0100
Select_box : add a new type of value and fix a problem with the position
of the div
---
include/lib/select_box.class.php | 41 +++++++++++++++++++++++++++++++++++-----
1 file changed, 36 insertions(+), 5 deletions(-)
diff --git a/include/lib/select_box.class.php b/include/lib/select_box.class.php
index 6a66898..430e28b 100644
--- a/include/lib/select_box.class.php
+++ b/include/lib/select_box.class.php
@@ -46,17 +46,28 @@ class Select_Box
function input()
{
+ // Show when click
$javascript=sprintf('$("%s_bt").onclick=function() {
try {
var newDiv=$("select_box%s");
- var pos=$("%s_bt").cumulativeOffset();
-
newDiv.setStyle({display:"block",position:"absolute",top:pos.top+25+"px",left:pos.left+5+"px"});
+ var pos=$("%s_bt").cumulativeOffset();
+
newDiv.setStyle({display:"block",position:"fixed",top:pos.top+25+"px",left:pos.left+5+"px"});
} catch(e) {
alert(e.message);
}
-}
-', $this->id, $this->id, $this->id, $this->id);
+ }
+ ', $this->id, $this->id, $this->id, $this->id);
+
+ // Hide when out of the zone
+ $javascript.=sprintf('$("select_box%s").onmouseleave=function() {
+ try {
+ var newDiv=$("select_box%s");
+ newDiv.setStyle({display:"none"});
+ } catch(e) {
+ alert(e.message);
+ }
+ }',$this->id,$this->id);
// display the button
printf('<input type="button" id="%s_bt" value="%s ▾">',
@@ -68,7 +79,7 @@ class Select_Box
// Print the list of possible options
- echo "<ul>";
+ printf('<ul id="%s_list">',$this->id);
for ($i=0; $i<count($this->item); $i++)
{
if ($this->item[$i]['type']=="url")
@@ -87,6 +98,15 @@ class Select_Box
printf('<li><a href="javascript:void(0)"
onclick="%s">%s</a></li>',
$this->item[$i]['javascript'],
$this->item[$i]['label']);
}
+ else if ($this->item[$i]['type']=="input") {
+ $ok=new IButton("ok");
+ $ok->value=$this->item[$i]['label'];
+ $ok->javascript=$this->item[$i]['input']->javascript;
+ printf('<li> %s %s</li>',
+ $this->item[$i]['input']->input(),
+ $ok->input()
+ );
+ }
}
echo "</ul>";
@@ -123,5 +143,16 @@ class Select_Box
$this->item[$this->cnt]['type']='value';
$this->cnt++;
}
+ function add_input($p_label,HtmlInput $p_element) {
+ /* $this->item[$this->cnt]['label']=$p_element->label;
+ $this->item[$this->cnt]['value']=$p_element->value;
+ $this->item[$this->cnt]['javascript']=$p_element->javascript;
+ *
+ */
+ $this->item[$this->cnt]['label']=$p_label;
+ $this->item[$this->cnt]['input']=clone $p_element;
+ $this->item[$this->cnt]['type']='input';
+ $this->cnt++;
+ }
}
- [Noalyss-commit] [noalyss] 73/219: Esthetic : History , improve place of button, (continued)
- [Noalyss-commit] [noalyss] 73/219: Esthetic : History , improve place of button, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 184/219: Icon move / fix Correct button_anchor to avoid the message "javascript:void(0)", Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 43/219: Add the icon for modify, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 12/219: Infobulle : warning : esthetic, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 126/219: Esthetic : align text, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 113/219: Améliore esthétique, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 106/219: task #0001272: Rendre possible l'appel de la calculatrice depuis le fin fond d'une page., Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 59/219: ManageTable : Correct bug for the sort, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 76/219: Extourne : correct reverse operation for autoliquidation, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 135/219: Template operation : message if there is no template, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 192/219: Select_box : add a new type of value and fix a problem with the position of the div,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 112/219: Task #0001481: Encodage Vente, Achat, Fin ou OD Task #0001485: possibilité de clouer une fenetre, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 125/219: Rewriting : Use of Noalyss_CSV, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 175/219: Change autocomplete and adapt Icard setWidth is false + indicator icon for ICard, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 81/219: PRINTPOSTE : esthetic, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 121/219: correct js : getMessage instead of message, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 78/219: InPlace_Switch : add a supplemental javascript command, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 10/219: GESTION -> CUST, MANAGER, ADM ... esthetic move the name of the tiers to the right, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 50/219: task #0001467: Journaux VENTES - inversion D/C dans liste de catégorie de fiches, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 169/219: For MSIE, force to unicode (still problem with MSIE11) !, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 94/219: Fix background color for button 'modele operation', Dany De Bontridder, 2017/12/18