two lists with interchangable elements)
Message-ID: <52e90168.qP6kflZIAJSsoC07%ab(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: 703dfb85244f89167d1e25c13968f1292f8cbd6f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=703dfb85244f89…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Wed Jan 29 14:23:53 2014 +0100
FIX Fixed sorting in duallist element (two lists with interchangable elements)
This fix ensures that if elements are moved from one list to the other
they are inserted at the correct alphanumerical index and not at the end.
---
.werks/271 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/js/checkmk.js | 15 ++++++++++++++-
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/.werks/271 b/.werks/271
new file mode 100644
index 0000000..4b30c21
--- /dev/null
+++ b/.werks/271
@@ -0,0 +1,10 @@
+Title: Fixed sorting in duallist element (two lists with interchangable elements)
+Level: 1
+Component: wato
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1391001637
+
+This fix ensures that if elements are moved from one list to the other
+they are inserted at the correct alphanumerical index and not at the end.
diff --git a/ChangeLog b/ChangeLog
index 534b548..0355943 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -238,6 +238,7 @@
* 0686 FIX: Fix replication with WATO if EC is enabled on master and disabled on
slave
* 0129 FIX: Fixed permission bug in "Edit user profile" dialog....
* 0269 FIX: brocade_fcport: fixed problem on displaying check_parameters in WATO...
+ * 0271 FIX: Fixed sorting in duallist element (two lists with interchangable
elements)...
Notifications:
* 0362 sms: now searching PATH for sendsms and smssend commands...
diff --git a/web/htdocs/js/checkmk.js b/web/htdocs/js/checkmk.js
index 5fd261a..3dd086e 100644
--- a/web/htdocs/js/checkmk.js
+++ b/web/htdocs/js/checkmk.js
@@ -1803,7 +1803,20 @@ function vs_duallist_switch(field, varprefix) {
// Move the selected option to the other select field
var selected = field.options[field.selectedIndex];
field.removeChild(selected);
- other_field.appendChild(selected);
+
+ // Determine the correct child to insert
+ var sibling = other_field.firstChild;
+ while (sibling != null) {
+ if (sibling.nodeType == 1 && sibling.label.toLowerCase() >
selected.label.toLowerCase())
+ break;
+ sibling = sibling.nextSibling
+ }
+
+ if (sibling)
+ other_field.insertBefore(selected, sibling);
+ else
+ other_field.appendChild(selected);
+
selected.selected = false;
// add remove from internal helper field