-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit
31 lines (26 loc) · 896 Bytes
/
edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
im $OWNER || Forbidden
if test $REQUEST_METHOD = POST; then
item_id="`test -L items/$iid && readlink items/$iid || echo $iid`"
qhash -d"$item_id" items/assoc.db > /dev/null
fd type | tee $ITEM_PATH/type | while read type; do
test ! -z "$type" || continue
typeid="`qhash -g "$type" items/types.db | awk '{print $1}'`"
if test -z "$typeid"; then
typeid="`qhash -p "$type" items/types.db`"
fi
echo "-p\"$item_id:$typeid\""
done | xargs -I {} qhash -m1 {} items/assoc.db > /dev/null
fd data > $ITEM_PATH/data.txt
SeeOther ../
fi
cat <<!
<form action='.' method='POST' class='p sf f v' enctype='multipart/form-data'>
<textarea name='data' class='c8' style='height: 60vh; white-space: pre;'>
`cat $ITEM_PATH/data.txt`
</textarea>
<textarea name='type' class='c8' style='height: 13vh; white-space: pre;'>
`cat $ITEM_PATH/type`
</textarea>
<button>`_ Submit`</button>
!