X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-base%2Fhtdocs%2Fluci-static%2Fresources%2Fcbi.js;h=02c54ad3e8878ebb0e4e774d7a8e3c3c0c4ea205;hp=5e31bf20996b8181b1f0c6a26b1c81ab8df50740;hb=a28da6a88a0cd7a5bc0c12c1ef2d8cad86c2aff3;hpb=20ccc903505ee15419b5cde113f9061b7a4f7513 diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index 5e31bf209..02c54ad3e 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -545,7 +545,7 @@ function cbi_browser_init(id, respath, url, defpath) cbi_bind(btn, 'click', cbi_browser_btnclick); } -function cbi_dynlist_init(name, respath, datatype, optional, choices) +function cbi_dynlist_init(name, respath, datatype, optional, url, defpath, choices) { var input0 = document.getElementsByName(name)[0]; var prefix = input0.name; @@ -606,6 +606,11 @@ function cbi_dynlist_init(name, respath, datatype, optional, choices) parent.appendChild(t); parent.appendChild(b); + if (datatype == 'file') + { + cbi_browser_init(t.id, respath, url, defpath); + } + parent.appendChild(document.createElement('br')); if (datatype) @@ -616,13 +621,13 @@ function cbi_dynlist_init(name, respath, datatype, optional, choices) if (choices) { cbi_combobox_init(t.id, choices[0], '', choices[1]); - t.nextSibling.index = i; + b.index = i; - cbi_bind(t.nextSibling, 'keydown', cbi_dynlist_keydown); - cbi_bind(t.nextSibling, 'keypress', cbi_dynlist_keypress); + cbi_bind(b, 'keydown', cbi_dynlist_keydown); + cbi_bind(b, 'keypress', cbi_dynlist_keypress); if (i == focus || -i == focus) - t.nextSibling.focus(); + b.focus(); } else { @@ -758,20 +763,24 @@ function cbi_dynlist_init(name, respath, datatype, optional, choices) ev = ev ? ev : window.event; var se = ev.target ? ev.target : ev.srcElement; + var input = se.previousSibling; + while (input && input.name != name) { + input = input.previousSibling; + } if (se.src.indexOf('remove') > -1) { - se.previousSibling.value = ''; + input.value = ''; cbi_dynlist_keydown({ - target: se.previousSibling, + target: input, keyCode: 8 }); } else { cbi_dynlist_keydown({ - target: se.previousSibling, + target: input, keyCode: 13 }); }