tazpanel diff index.cgi @ rev 553
Add file chooser
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Nov 22 18:40:59 2015 +0100 (2015-11-22) |
parents | b8613f5d5f32 |
children | d0b7025e3e8c |
line diff
1.1 --- a/index.cgi Sun Nov 15 14:03:03 2015 +0100 1.2 +++ b/index.cgi Sun Nov 22 18:40:59 2015 +0100 1.3 @@ -69,6 +69,35 @@ 1.4 1.5 case " $(GET) " in 1.6 1.7 + *\ do\ *) 1.8 + case "$(GET do)" in 1.9 + 1.10 + *-selection) # display Yad file/dir picker (AJAX) 1.11 + title="$(_ 'Choose file')" 1.12 + extra="" 1.13 + [ "$(GET do)" == "dir-selection" ] && 1.14 + title="$(_ 'Choose directory')" && 1.15 + extra="--directory" 1.16 + while read name arg ; do 1.17 + case "$(GET do)" in 1.18 + *$name*) 1.19 + extra="$extra $arg" ;; 1.20 + esac 1.21 + done <<EOT 1.22 +multiple --multiple 1.23 +preview --add-preview 1.24 +EOT 1.25 + header 1.26 + cat <<EOT 1.27 +<input type="text" name="$(GET name)" value="$(DISPLAY=':0.0' \ 1.28 +XAUTHORITY='/var/run/slim.auth' yad --file-selection --on-top --mouse $extra \ 1.29 +--width=500 --height=350 --title="$title")" /> 1.30 +EOT 1.31 + exit 0 ;; 1.32 + 1.33 + esac 1.34 + ;; 1.35 + 1.36 1.37 *\ exec\ *) 1.38 # Execute command and display its result in a terminal-like window