summaryrefslogtreecommitdiff
path: root/media/admin_media/js/SelectBox.js
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-02-07 16:38:33 -0600
committerDan McGee <dan@archlinux.org>2009-02-07 16:38:33 -0600
commit8d55746b7eb42b59d5cd5ab66b7d00dd16df8b38 (patch)
tree46a755215be6ed9deb2beaafbd1bd88b0402dfa5 /media/admin_media/js/SelectBox.js
parent8d53e928f6fb41954c8f6c1ffd3449b360b7978b (diff)
Update admin_media to latest Django version
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'media/admin_media/js/SelectBox.js')
-rw-r--r--media/admin_media/js/SelectBox.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/media/admin_media/js/SelectBox.js b/media/admin_media/js/SelectBox.js
index af8de204..f28c8615 100644
--- a/media/admin_media/js/SelectBox.js
+++ b/media/admin_media/js/SelectBox.js
@@ -6,7 +6,7 @@ var SelectBox = {
SelectBox.cache[id] = new Array();
var cache = SelectBox.cache[id];
for (var i = 0; (node = box.options[i]); i++) {
- cache.push({ value: node.value, text: node.text, displayed: 1 });
+ cache.push({value: node.value, text: node.text, displayed: 1});
}
},
redisplay: function(id) {
@@ -50,7 +50,7 @@ var SelectBox = {
SelectBox.cache[id].length--;
},
add_to_cache: function(id, option) {
- SelectBox.cache[id].push({ value: option.value, text: option.text, displayed: 1 });
+ SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1});
},
cache_contains: function(id, value) {
// Check if an item is contained in the cache
@@ -68,7 +68,7 @@ var SelectBox = {
var option;
for (var i = 0; (option = from_box.options[i]); i++) {
if (option.selected && SelectBox.cache_contains(from, option.value)) {
- SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
+ SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1});
SelectBox.delete_from_cache(from, option.value);
}
}
@@ -80,8 +80,10 @@ var SelectBox = {
var to_box = document.getElementById(to);
var option;
for (var i = 0; (option = from_box.options[i]); i++) {
- SelectBox.add_to_cache(to, { value: option.value, text: option.text, displayed: 1 });
- SelectBox.delete_from_cache(from, option.value);
+ if (SelectBox.cache_contains(from, option.value)) {
+ SelectBox.add_to_cache(to, {value: option.value, text: option.text, displayed: 1});
+ SelectBox.delete_from_cache(from, option.value);
+ }
}
SelectBox.redisplay(from);
SelectBox.redisplay(to);