summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-14 11:50:44 +0000
committerSteven Barth <steven@midlink.org>2008-08-14 11:50:44 +0000
commite42779fcabec3995b87a50e233e95a2f3f7bc466 (patch)
treeb6ca90c55625a8568a64fc8a1730a5089b3e86f9 /libs
parentfce110981700dfd57cd9f8c381d3bdd15ee8befd (diff)
User interface improvements part #3
Diffstat (limited to 'libs')
-rw-r--r--libs/cbi/htdocs/luci-static/resources/cbi.js41
-rw-r--r--libs/cbi/htdocs/luci-static/resources/cbi/download.gifbin0 -> 189 bytes
-rw-r--r--libs/cbi/htdocs/luci-static/resources/cbi/key.gifbin0 -> 230 bytes
-rw-r--r--libs/cbi/htdocs/luci-static/resources/cbi/link.gifbin0 -> 291 bytes
-rw-r--r--libs/cbi/htdocs/luci-static/resources/cbi/user.gifbin0 -> 246 bytes
5 files changed, 34 insertions, 7 deletions
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js
index e42193cffc..78a9e90bf6 100644
--- a/libs/cbi/htdocs/luci-static/resources/cbi.js
+++ b/libs/cbi/htdocs/luci-static/resources/cbi.js
@@ -7,7 +7,16 @@ function cbi_d_add(field, target, value) {
if (!cbi_d[target][value]) {
cbi_d[target][value] = [];
}
- cbi_d[target][value].push(field);
+
+ var obj = document.getElementById(field);
+ if (obj) {
+ var entry = {
+ "node": obj,
+ "parent": obj.parentNode,
+ "next": obj.nextSibling
+ }
+ cbi_d[target][value].unshift(entry);
+ }
}
function cbi_d_update(target) {
@@ -17,16 +26,34 @@ function cbi_d_update(target) {
for (var x in cbi_d[target]) {
for (var i=0; i<cbi_d[target][x].length; i++) {
- var y = document.getElementById(cbi_d[target][x][i])
- y.style.display = "none";
+ var entry = cbi_d[target][x][i];
+ if (entry.node.parentNode) {
+ entry.parent.removeChild(entry.node)
+ }
}
}
var t = document.getElementById(target);
- if (t && t.value && cbi_d[target][t.value]) {
- for (var i=0; i<cbi_d[target][t.value].length; i++) {
- var y = document.getElementById(cbi_d[target][t.value][i])
- y.style.display = "block";
+ var value
+
+ if (!t || !t.value) {
+ value = "";
+ } else {
+ value = t.value;
+
+ if (t.type == "checkbox") {
+ value = t.checked ? value : "";
+ }
+ }
+
+ if (cbi_d[target][value]) {
+ for (var i=0; i<cbi_d[target][value].length; i++) {
+ var entry = cbi_d[target][value][i];
+ if (!entry.next) {
+ entry.parent.appendChild(entry.node);
+ } else {
+ entry.parent.insertBefore(entry.node, entry.next);
+ }
}
}
}
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/download.gif b/libs/cbi/htdocs/luci-static/resources/cbi/download.gif
new file mode 100644
index 0000000000..f99a5383b2
--- /dev/null
+++ b/libs/cbi/htdocs/luci-static/resources/cbi/download.gif
Binary files differ
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/key.gif b/libs/cbi/htdocs/luci-static/resources/cbi/key.gif
new file mode 100644
index 0000000000..e3853e5afd
--- /dev/null
+++ b/libs/cbi/htdocs/luci-static/resources/cbi/key.gif
Binary files differ
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/link.gif b/libs/cbi/htdocs/luci-static/resources/cbi/link.gif
new file mode 100644
index 0000000000..1b2a923a5a
--- /dev/null
+++ b/libs/cbi/htdocs/luci-static/resources/cbi/link.gif
Binary files differ
diff --git a/libs/cbi/htdocs/luci-static/resources/cbi/user.gif b/libs/cbi/htdocs/luci-static/resources/cbi/user.gif
new file mode 100644
index 0000000000..dcb5c2a899
--- /dev/null
+++ b/libs/cbi/htdocs/luci-static/resources/cbi/user.gif
Binary files differ