@osimatic/helpers-js 1.1.77 → 1.1.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/list_box.js CHANGED
@@ -1,113 +1,113 @@
1
- class ListBox {
2
- /*
3
- <div class="form-group">
4
- <div class="listebox_left">
5
- <span class="titre_listebox">Services interdits :</span><br/>
6
- <select name="liste_services" id="liste_services" class="liste_box liste_box_grand" size="10" multiple="multiple">
7
- <?php foreach ($listeServicesClient as $arbo) : ?>
8
- <option value="<?php echo $arbo->getIdArbo(); ?>"><?php echo $arbo->getLibelleAffiche(); ?></option>
9
- <?php endforeach ?>
10
- </select>
11
- </div>
12
-
13
- <div class="listebox_cmd">
14
- <a href="#" id="listebox_lien_right"><img src="<?php echo ROOT_PATH.DOSSIER_IMAGES; ?>icone_listbox_right.png" /></a><br/>
15
- <a href="#" id="listebox_lien_left"><img src="<?php echo ROOT_PATH.DOSSIER_IMAGES; ?>icone_listbox_left.png" /></a>
16
- </div>
17
-
18
- <div class="listebox_right">
19
- <span class="titre_listebox">Services autorisés :</span><br/>
20
- <select name="liste_services_stats[]" id="liste_services_stats" class="liste_box liste_box_grand" size="10" multiple="multiple">
21
- <?php foreach ($listeServicesStatsConsultant as $arbo) : ?>
22
- <option value="<?php echo $arbo->getIdArbo(); ?>"><?php echo $arbo->getLibelleAffiche(); ?></option>
23
- <?php endforeach ?>
24
- </select>
25
- </div>
26
- <div class="cl"></div>
27
- </div>
28
- */
29
-
30
- /*
31
- Listbox Select All / Deselect All JavaScript
32
- Use :
33
- listbox_selectall('countryList', true); //select all the options
34
- listbox_selectall('countryList', false); //deselect all the options
35
- */
36
- static selectall(listID, isSelect) {
37
- var listbox = document.getElementById(listID);
38
- for (var count=0; count < listbox.options.length; count++) {
39
- listbox.options[count].selected = isSelect;
40
- }
41
- }
42
-
43
- /*
44
- Listbox Move up/down options JavaScript
45
- Use :
46
- listbox_move('countryList', 'up'); //move up the selected option
47
- listbox_move('countryList', 'down'); //move down the selected option
48
- */
49
- static move(listID, direction) {
50
- var listbox = document.getElementById(listID);
51
- var selIndex = listbox.selectedIndex;
52
-
53
- if (-1 === selIndex) {
54
- alert("Please select an option to move.");
55
- return;
56
- }
57
-
58
- var increment = -1;
59
- if (direction == 'up') {
60
- increment = -1;
61
- }
62
- else {
63
- increment = 1;
64
- }
65
-
66
- if ((selIndex + increment) < 0 || (selIndex + increment) > (listbox.options.length-1)) {
67
- return;
68
- }
69
-
70
- var selValue = listbox.options[selIndex].value;
71
- var selText = listbox.options[selIndex].text;
72
- listbox.options[selIndex].value = listbox.options[selIndex + increment].value
73
- listbox.options[selIndex].text = listbox.options[selIndex + increment].text
74
-
75
- listbox.options[selIndex + increment].value = selValue;
76
- listbox.options[selIndex + increment].text = selText;
77
-
78
- listbox.selectedIndex = selIndex + increment;
79
- }
80
-
81
- /*
82
- Listbox swap/move left-right options JavaScript
83
- Use :
84
- listbox_moveacross('countryList', 'selectedCountryList');
85
- */
86
- static moveacross(sourceID, destID) {
87
- var src = document.getElementById(sourceID);
88
- var dest = document.getElementById(destID);
89
-
90
- for (var count=0; count < src.options.length; count++) {
91
- if (src.options[count].selected == true) {
92
- var option = src.options[count];
93
-
94
- var newOption = document.createElement("option");
95
- newOption.value = option.value;
96
- newOption.text = option.text;
97
- newOption.selected = true;
98
- try {
99
- dest.add(newOption, null); //Standard
100
- src.remove(count, null);
101
- }
102
- catch(error) {
103
- dest.add(newOption); // IE only
104
- src.remove(count);
105
- }
106
- count--;
107
- }
108
- }
109
- }
110
-
111
- }
112
-
1
+ class ListBox {
2
+ /*
3
+ <div class="form-group">
4
+ <div class="listebox_left">
5
+ <span class="titre_listebox">Services interdits :</span><br/>
6
+ <select name="liste_services" id="liste_services" class="liste_box liste_box_grand" size="10" multiple="multiple">
7
+ <?php foreach ($listeServicesClient as $arbo) : ?>
8
+ <option value="<?php echo $arbo->getIdArbo(); ?>"><?php echo $arbo->getLibelleAffiche(); ?></option>
9
+ <?php endforeach ?>
10
+ </select>
11
+ </div>
12
+
13
+ <div class="listebox_cmd">
14
+ <a href="#" id="listebox_lien_right"><img src="<?php echo ROOT_PATH.DOSSIER_IMAGES; ?>icone_listbox_right.png" /></a><br/>
15
+ <a href="#" id="listebox_lien_left"><img src="<?php echo ROOT_PATH.DOSSIER_IMAGES; ?>icone_listbox_left.png" /></a>
16
+ </div>
17
+
18
+ <div class="listebox_right">
19
+ <span class="titre_listebox">Services autorisés :</span><br/>
20
+ <select name="liste_services_stats[]" id="liste_services_stats" class="liste_box liste_box_grand" size="10" multiple="multiple">
21
+ <?php foreach ($listeServicesStatsConsultant as $arbo) : ?>
22
+ <option value="<?php echo $arbo->getIdArbo(); ?>"><?php echo $arbo->getLibelleAffiche(); ?></option>
23
+ <?php endforeach ?>
24
+ </select>
25
+ </div>
26
+ <div class="cl"></div>
27
+ </div>
28
+ */
29
+
30
+ /*
31
+ Listbox Select All / Deselect All JavaScript
32
+ Use :
33
+ listbox_selectall('countryList', true); //select all the options
34
+ listbox_selectall('countryList', false); //deselect all the options
35
+ */
36
+ static selectall(listID, isSelect) {
37
+ var listbox = document.getElementById(listID);
38
+ for (var count=0; count < listbox.options.length; count++) {
39
+ listbox.options[count].selected = isSelect;
40
+ }
41
+ }
42
+
43
+ /*
44
+ Listbox Move up/down options JavaScript
45
+ Use :
46
+ listbox_move('countryList', 'up'); //move up the selected option
47
+ listbox_move('countryList', 'down'); //move down the selected option
48
+ */
49
+ static move(listID, direction) {
50
+ var listbox = document.getElementById(listID);
51
+ var selIndex = listbox.selectedIndex;
52
+
53
+ if (-1 === selIndex) {
54
+ alert("Please select an option to move.");
55
+ return;
56
+ }
57
+
58
+ var increment = -1;
59
+ if (direction == 'up') {
60
+ increment = -1;
61
+ }
62
+ else {
63
+ increment = 1;
64
+ }
65
+
66
+ if ((selIndex + increment) < 0 || (selIndex + increment) > (listbox.options.length-1)) {
67
+ return;
68
+ }
69
+
70
+ var selValue = listbox.options[selIndex].value;
71
+ var selText = listbox.options[selIndex].text;
72
+ listbox.options[selIndex].value = listbox.options[selIndex + increment].value
73
+ listbox.options[selIndex].text = listbox.options[selIndex + increment].text
74
+
75
+ listbox.options[selIndex + increment].value = selValue;
76
+ listbox.options[selIndex + increment].text = selText;
77
+
78
+ listbox.selectedIndex = selIndex + increment;
79
+ }
80
+
81
+ /*
82
+ Listbox swap/move left-right options JavaScript
83
+ Use :
84
+ listbox_moveacross('countryList', 'selectedCountryList');
85
+ */
86
+ static moveacross(sourceID, destID) {
87
+ var src = document.getElementById(sourceID);
88
+ var dest = document.getElementById(destID);
89
+
90
+ for (var count=0; count < src.options.length; count++) {
91
+ if (src.options[count].selected == true) {
92
+ var option = src.options[count];
93
+
94
+ var newOption = document.createElement("option");
95
+ newOption.value = option.value;
96
+ newOption.text = option.text;
97
+ newOption.selected = true;
98
+ try {
99
+ dest.add(newOption, null); //Standard
100
+ src.remove(count, null);
101
+ }
102
+ catch(error) {
103
+ dest.add(newOption); // IE only
104
+ src.remove(count);
105
+ }
106
+ count--;
107
+ }
108
+ }
109
+ }
110
+
111
+ }
112
+
113
113
  module.exports = { ListBox };