tazpanel diff lib/libtazpanel @ rev 557
Allow many file choosers on a page; allow file filtering based on MIME type; fix working in Firefox
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Dec 08 13:38:20 2015 +0200 (2015-12-08) |
parents | 694b20d6963c |
children | a15373a181ff |
line diff
1.1 --- a/lib/libtazpanel Mon Dec 07 02:36:31 2015 +0200 1.2 +++ b/lib/libtazpanel Tue Dec 08 13:38:20 2015 +0200 1.3 @@ -411,17 +411,21 @@ 1.4 # The html 'file' object does not return the full path. Ajax helps on localhost. 1.5 1.6 file_chooser() { 1.7 + # 1: <input> name; 2: [predefined value]; 3: [button icon]; 4: [MIME type] 1.8 + id="input$RANDOM" 1.9 cat <<EOT 1.10 -<span id="$1"><input type="text" name="$1" ${2:+value="$2" }/></span> 1.11 -<button data-icon="${3:-conf}" onclick="ajax('index.cgi?do=file-selection&name=$1', '1', '$1'); return false"> 1.12 +<span id="$id"><input type="text" name="$1" ${2:+value="$2" }/></span>\ 1.13 +<button data-icon="${3:-conf}" onclick="ajax('index.cgi?do=file-selection&name=$name&type=$4', '1', '$id'); return false">\ 1.14 $(_n 'Browse')</button> 1.15 EOT 1.16 } 1.17 1.18 dir_chooser() { 1.19 + # 1: <input> name; 2: [predefined value]; 3: [button icon] 1.20 + id="input$RANDOM" 1.21 cat <<EOT 1.22 -<span id="$1"><input type="text" name="$1" ${2:+value="$2" }/></span> 1.23 -<button data-icon="${3:-folder}" onclick="ajax('index.cgi?do=dir-selection&name=$1', '1', '$1'); return false"> 1.24 +<span id="$id"><input type="text" name="$1" ${2:+value="$2" }/></span>\ 1.25 +<button data-icon="${3:-folder}" onclick="ajax('index.cgi?do=dir-selection&name=$1', '1', '$id'); return false">\ 1.26 $(_n 'Browse')</button> 1.27 EOT 1.28 }