From 1db9f295fa3e98a1f1472d2a8eda881333db5a43 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 5 Mar 2011 06:35:26 +0000 Subject: libs/web: repair and modernize FileBrowser widget, patches by Kevin Locke (#207) --- libs/web/htdocs/luci-static/resources/cbi.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'libs/web/htdocs/luci-static/resources/cbi.js') diff --git a/libs/web/htdocs/luci-static/resources/cbi.js b/libs/web/htdocs/luci-static/resources/cbi.js index 2bcfb8c3df..be0a5a8d70 100644 --- a/libs/web/htdocs/luci-static/resources/cbi.js +++ b/libs/web/htdocs/luci-static/resources/cbi.js @@ -402,6 +402,23 @@ function cbi_filebrowser(id, url, defpath) { browser.focus(); } +function cbi_browser_init(id, respath, url, defpath) +{ + function cbi_browser_btnclick(e) { + cbi_filebrowser(id, url, defpath); + return false; + } + + var field = document.getElementById(id); + + var btn = document.createElement('img'); + btn.className = 'cbi-image-button'; + btn.src = respath + '/cbi/folder.gif'; + field.parentNode.insertBefore(btn, field.nextSibling); + + cbi_bind(btn, 'click', cbi_browser_btnclick); +} + function cbi_dynlist_init(name, respath) { function cbi_dynlist_renumber(e) @@ -587,6 +604,7 @@ function cbi_dynlist_init(name, respath) for( var i = 0; i < inputs.length; i++ ) { var btn = document.createElement('img'); + btn.className = 'cbi-image-button'; btn.src = respath + ( (i+1) < inputs.length ? '/cbi/remove.gif' : '/cbi/add.gif' ); -- cgit v1.2.3