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=4b1849beab9cfe083b0d7ec360c6dd488dc4e6d6;hp=2c7f99f0624dfeb9f1fc43d9d9f07d8d0332bb0b;hb=b618361bf1c7ea160f3e0ef18aa8f409f7a21eff;hpb=712424dc0cf17a60f3d77024b892cc04146f6295 diff --git a/libs/cbi/htdocs/luci-static/resources/cbi.js b/libs/cbi/htdocs/luci-static/resources/cbi.js index 2c7f99f06..4b1849bea 100644 --- a/libs/cbi/htdocs/luci-static/resources/cbi.js +++ b/libs/cbi/htdocs/luci-static/resources/cbi.js @@ -19,7 +19,7 @@ function cbi_d_add(field, dep, next) { "deps": [] }; cbi_d.unshift(entry); - } + } entry.deps.push(dep) } } @@ -27,17 +27,17 @@ function cbi_d_add(field, dep, next) { function cbi_d_checkvalue(target, ref) { var t = document.getElementById(target); var value; - + if (!t || !t.value) { value = ""; } else { value = t.value; - + if (t.type == "checkbox") { value = t.checked ? value : ""; } } - + return (value == ref) } @@ -50,7 +50,7 @@ function cbi_d_check(deps) { if (istat) { return true } - } + } } function cbi_d_update() { @@ -69,7 +69,7 @@ function cbi_d_update() { parent.appendChild(entry.node); } else { next.parentNode.insertBefore(entry.node, next); - } + } state = (state || (node && node.parentNode)) } } @@ -100,16 +100,17 @@ function cbi_bind(obj, type, callback, mode) { } function cbi_combobox(id, values, def, man) { - var selid = "cbi.combobox." + id + var selid = "cbi.combobox." + id; if (document.getElementById(selid)) { return } var obj = document.getElementById(id) var sel = document.createElement("select"); - sel.id = selid + sel.id = selid; + sel.className = 'cbi-input-select'; if (obj.nextSibling) { - obj.parentNode.insertBefore(sel, obj.nextSibling); + obj.parentNode.insertBefore(sel, obj.nextSibling); } else { obj.parentNode.appendChild(sel); } @@ -165,4 +166,14 @@ function cbi_combobox_init(id, values, def, man) { cbi_combobox(id, values, def, man) }); cbi_combobox(id, values, def, man); -} \ No newline at end of file +} + +function cbi_filebrowser(id, url, defpath) { + var field = document.getElementById(id); + var browser = window.open( + url + ( field.value || defpath || '' ) + '?field=' + id, + "luci_filebrowser", "width=300,height=400,left=100,top=200,scrollbars=yes" + ); + + browser.focus(); +}