X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fcbi%2Fhtdocs%2Fluci-static%2Fresources%2Fcbi.js;h=247228d225b47d6a3f15a88e3ecefae176153be7;hp=2c7f99f0624dfeb9f1fc43d9d9f07d8d0332bb0b;hb=bddc2053b4d020a1982c8bfb86dde5a88dc47be6;hpb=712424dc0cf17a60f3d77024b892cc04146f6295 diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index 2c7f99f06..247228d22 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -1,4 +1,21 @@ +/* + LuCI - Lua Configuration Interface + + Copyright 2008 Steven Barth + Copyright 2008-2009 Jo-Philipp Wich + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + $Id$ +*/ + var cbi_d = []; +var cbi_t = []; +var cbi_c = []; function cbi_d_add(field, dep, next) { var obj = document.getElementById(field); @@ -19,7 +36,7 @@ function cbi_d_add(field, dep, next) { "deps": [] }; cbi_d.unshift(entry); - } + } entry.deps.push(dep) } } @@ -27,30 +44,52 @@ function cbi_d_add(field, dep, next) { function cbi_d_checkvalue(target, ref) { var t = document.getElementById(target); var value; - - if (!t || !t.value) { + + if (!t) { + var tl = document.getElementsByName(target); + + if( tl.length > 0 && tl[0].type == 'radio' ) + for( var i = 0; i < tl.length; i++ ) + if( tl[i].checked ) { + value = tl[i].value; + break; + } + + value = value ? value : ""; + } else if (!t.value) { value = ""; } else { value = t.value; - + if (t.type == "checkbox") { value = t.checked ? value : ""; } } - + return (value == ref) } function cbi_d_check(deps) { + var reverse; + var def = false; for (var i=0; i