[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 215/219: ICheckBox : add attribute to allow t
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 215/219: ICheckBox : add attribute to allow to select checkbox thanks its attribute with the js select_checkbox_attribute |
Date: |
Mon, 18 Dec 2017 13:23:05 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit 66d68954db0886ff0b4acfca549fd99192473058
Author: Dany De Bontridder <address@hidden>
Date: Sat Dec 16 12:27:26 2017 +0100
ICheckBox : add attribute to allow to select checkbox thanks its attribute
with the js select_checkbox_attribute
---
html/js/scripts.js | 19 +++++++++++++++++++
include/lib/html_input.class.php | 34 ++++++++++++++++++++++++++++++++++
include/lib/icheckbox.class.php | 1 +
3 files changed, 54 insertions(+)
diff --git a/html/js/scripts.js b/html/js/scripts.js
index 6831dc2..02c4792 100644
--- a/html/js/scripts.js
+++ b/html/js/scripts.js
@@ -1033,6 +1033,25 @@ function select_checkbox(form_id)
}
}
/**
+ * select all the checkbox in a given form if the specific attribute
+ * has the given value
+ * @param form_id id of the form
+ * @param attribute name
+ * @param attribute value
+ */
+function select_checkbox_attribute(form_id,p_attribute_name,p_attribute_value)
+{
+ var form = $(form_id);
+ for (var i = 0; i < form.length; i++)
+ {
+ var e = form.elements[i];
+ if (e.type === 'checkbox' &&
e.getAttribute(p_attribute_name)==p_attribute_value)
+ {
+ e.checked = true;
+ }
+ }
+}
+/**
* unselect all the checkbox in a given form
* @param form_id id of the form
*/
diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php
index 18909af..33307ee 100755
--- a/include/lib/html_input.class.php
+++ b/include/lib/html_input.class.php
@@ -450,6 +450,24 @@ class HtmlInput
return $r;
}
/**
+ * Anchor Html with javascript
+ address@hidden $action action action to perform (message) without onclick
+ address@hidden $javascript javascript to execute
+ address@hidden $id is the DOM element id
+ address@hidden $p_class CSS class of the button
+ address@hidden $p_symbole raw symbole to add to the action message
+ */
+ static function
anchor_action($action,$javascript,$id=NULL,$p_class="button",$p_symbole="")
+ {
+ if ($id==NULL){
+ $id=uniqid("xx");
+ }
+ $r="";
+ $r.='<a id="'.$id.'" class="'.$p_class.'"
onclick="'.$javascript.'">'.$p_symbole.h($action).'</a>';
+ return $r;
+
+ }
+ /**
* button Html with javascript
address@hidden $action action action to perform (message) without onclick
address@hidden $javascript javascript to execute
@@ -1025,4 +1043,20 @@ EOF;
$js=HtmlInput::button_action(_('Nouvel
événement'),'action_add('.$dossier.')','xx','smallbutton');
return $js;
}
+ /**
+ * Insert attribute inside a INPUT TYPE, these attribute can be
retrieved
+ * in javascript with element.getAttribute or changed with
element.setAttribute
+ * example insert my_attribute into a checkbox <input type="checkbox"
"my_attribute"="XX">
+ * @return string to insert into the HTML node
+ *
+ */
+ function get_node_attribute()
+ {
+ $r="";
+ $nb_attribute=count($this->attribute);
+ for ($i=0;$i < $nb_attribute;$i++) {
+ $r.=sprintf(' %s="%s" ',$this->attribute[$i][0]
,$this->attribute[$i][1]);
+ }
+ return $r;
+ }
}
diff --git a/include/lib/icheckbox.class.php b/include/lib/icheckbox.class.php
index ff7195f..13177dc 100644
--- a/include/lib/icheckbox.class.php
+++ b/include/lib/icheckbox.class.php
@@ -36,6 +36,7 @@ class ICheckBox extends HtmlInput
$check=( $this->selected==true )?"checked":"unchecked";
$r='<input type="CHECKBOX" id="'.$this->id.'"
name="'.$this->name.'"'.' value="'.$this->value.'"';
$r.=" $check";
+ $r.=$this->get_node_attribute();
$r.=' '.$this->disabled." ".$this->javascript.'>';
$r=$r." $this->label";
- [Noalyss-commit] [noalyss] 111/219: Comment Table, (continued)
- [Noalyss-commit] [noalyss] 111/219: Comment Table, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 92/219: Esthetic : hide some columns when screen too small, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 39/219: Acc_Reconciliation : improve function get_amount_noautovat, set the prepare query inside the function, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 172/219: Merge branch 'master' of ns3:/srv/git/noalyss, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 143/219: ANC : balance analytique / comptabilité, corrige bug SQL, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 155/219: Task #1493 Encodage VEN , ACH, Ordre des opérations Déplacement du bouton modèle d'opérations, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 130/219: ANC groupe : little bug in PLANANC, allow a group null, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 142/219: ANC : balance croisée double fixe SQL query, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 160/219: INSTALL : check PHP version minimum 5.5, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 219/219: Task #1378 : show only the ledger of a given type, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 215/219: ICheckBox : add attribute to allow to select checkbox thanks its attribute with the js select_checkbox_attribute,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 170/219: Traduction, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 216/219: Task #1378 : select ledger thanks their type, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 201/219: Task #0001507: Click sur détail opérations apparaît trop haut Problem comes from window.onload loaded with detail operation. Move into do.php , recherche.php , popup.php from script.js, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 40/219: Test : utilisation nouvelle police nouveau theme Stock... Correction bug http_input SQL : correction table jnt_letter , col. inutile, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 86/219: Improve appearance, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 150/219: HttpInput: Exception if the type is not known, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 98/219: esthetic change icon, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 141/219: CSS Esthetic : comment span or IText can have the CSSclass label_item, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 117/219: Task #0001297: Perfectionnement menu COMPTA/ADV/OPEN remove dead code, Dany De Bontridder, 2017/12/18
- [Noalyss-commit] [noalyss] 35/219: Task #0001415: Lettrage - masquer la mise en évidence. Click a second time of an reconciliation and the highlight disappear, Dany De Bontridder, 2017/12/18