aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/scripts/formfiller.sh
diff options
context:
space:
mode:
authorGravatar Pawel Tomak <satherot@gmail.com>2010-03-28 17:56:05 +0200
committerGravatar Pawel Tomak <satherot@gmail.com>2010-03-28 17:56:05 +0200
commit4792e67bd0fb1fbdb224d617184f1d54eddaecd5 (patch)
tree37b4ebadb742ce471583828285d12cece080c70e /examples/data/scripts/formfiller.sh
parent12897363d6c7d6a9cab03266a16be16eddab7ed0 (diff)
Fixed some issues connected with multilines for textareas
Diffstat (limited to 'examples/data/scripts/formfiller.sh')
-rwxr-xr-xexamples/data/scripts/formfiller.sh33
1 files changed, 18 insertions, 15 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh
index cc7d900..5eab784 100755
--- a/examples/data/scripts/formfiller.sh
+++ b/examples/data/scripts/formfiller.sh
@@ -97,11 +97,11 @@ dumpFunction='function dump() {
var input;
while(input=xp_res.iterateNext()) {
var type=(input.type?input.type:text);
- if(type == "text" || type == "password" || type == "file") {
+ if(type == "text" || type == "password") {
rv += input.name + "(" + type + "):" + input.value + "\\n";
}
else if(type == "checkbox" || type == "radio") {
- rv += input.name + "[" + input.value + "](" + type + "):" + (input.checked?"ON":"OFF") + "\\n";
+ rv += input.name + "{" + input.value + "}(" + type + "):" + (input.checked?"ON":"OFF") + "\\n";
}
}
xp_res=allFrames[j].document.evaluate("//textarea", allFrames[j].document.documentElement, null, XPathResult.ANY_TYPE,null);
@@ -151,17 +151,19 @@ then
option=`echo -e -n "$menu"| dmenu ${LINES} -nb "${NB}" -nf "${NF}" -sb "${SB}" -sf "${SF}" -p "${PROMPT}"`
fi
- sed 's/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(on\|yes\|1\)$/\1[\2](\3):1/I;s/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(off\|no\|0\)$/\1[\2](\3):0/I' -i $keydir/$domain
+ sed 's/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):.\+$/\1{\2}(\3):1/I;s/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):$/\1{\2}(\3):0/I' -i $keydir/$domain
fields=`cat $keydir/$domain | \
- sed -n -e "/^!profile=${option}/,/^!profile=/p" | \
- sed 's/^\([^[]\+\[[^]]*]([^)]\+):\|[^(]\+([^)]\+):\)/<\1>/' | \
- sed 's/^\(.\+\)$/\1{{br}}/g' | \
- tr -d '\n'| sed 's/{{br}}<\([^[]\+\[[^]]*]([^)]\+):\|[^(]\+([^)]\+):\)>/\n\1/g'`
+ sed -n "/^!profile=${option}/,/^!profile=/p" | \
+ sed '/^!profile=/d' | \
+ sed 's/^\([^(]\+(\)\(radio\|checkbox\|text\|textarea\|password\)):/%{>\1\2):<}%/' | \
+ sed 's/^\(.\+\)$/<{br}>\1/' | \
+ tr -d '\n' | \
+ sed 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|textarea\|password\)):<}%/\\n\1\2):/g'`
echo "${fields}" | \
sed -n -e "s/\([^(]\+\)(\(password\|text\|textarea\)\+):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\2', '\3', 0);/p" | \
- sed -e 's/@/\\@/g;s/{{br}}/\\\\n/g' > $fifo
+ sed -e 's/@/\\@/g;s/<{br}>/\\\\n/g' > $fifo
echo "${fields}" | \
- sed -n -e "s/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', \4);/p" | \
+ sed -n -e "s/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', \4);/p" | \
sed -e 's/@/\\@/g' > $fifo
elif [ "$action" = "once" ]
then
@@ -173,16 +175,17 @@ then
[ -e $tmpfile ] || exit 2
- sed 's/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(on\|yes\|1\)$/\1[\2](\3):1/I;s/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(off\|no\|0\)$/\1[\2](\3):0/I' -i $tmpfile
+ sed 's/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):.\+$/\1{\2}(\3):1/I;s/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):$/\1{\2}(\3):0/I' -i $tmpfile
fields=`cat $tmpfile | \
- sed 's/^\([^[]\+\[[^]]*]([^)]\+):\|[^(]\+([^)]\+):\)/<\1>/' | \
- sed 's/^\(.\+\)$/\1{{br}}/g' | \
- tr -d '\n'| sed 's/{{br}}<\([^[]\+\[[^]]*]([^)]\+):\|[^(]\+([^)]\+):\)>/\n\1/g'`
+ sed 's/^\([^(]\+(\)\(radio\|checkbox\|text\|textarea\|password\)):/%{>\1\2):<}%/' | \
+ sed 's/^\(.\+\)$/<{br}>\1/' | \
+ tr -d '\n' | \
+ sed 's/<{br}>%{>\([^(]\+(\)\(radio\|checkbox\|text\|textarea\|password\)):<}%/\\n\1\2):/g'`
echo "${fields}" | \
sed -n -e "s/\([^(]\+\)(\(password\|text\|textarea\)\+):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\2', '\3', 0);/p" | \
- sed -e 's/@/\\@/g;s/{{br}}/\\\\n/g' > $fifo
+ sed -e 's/@/\\@/g;s/<{br}>/\\\\n/g' > $fifo
echo "${fields}" | \
- sed -n -e "s/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', \4);/p" | \
+ sed -n -e "s/\([^{]\+\){\([^}]*\)}(\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', \4);/p" | \
sed -e 's/@/\\@/g' > $fifo
rm -f $tmpfile
else