s4
changeset 836:b3516ee2bb4d
Filename renaming added to article EDIT
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Tue, 23 Jun 2020 12:58:31 +0900 |
parents | fa23017ba273 |
children | a6462eea48be |
files | examples/common/default/default.css s4-cgi.sh s4-funcs.sh |
diffstat | 3 files changed, 38 insertions(+), 9 deletions(-) [+] |
line diff
1.1 --- a/examples/common/default/default.css Tue Jun 23 12:47:34 2020 +0900 1.2 +++ b/examples/common/default/default.css Tue Jun 23 12:58:31 2020 +0900 1.3 @@ -62,14 +62,17 @@ 1.4 input.action ~ input:not(.action), input.action ~ textarea { 1.5 display: none; 1.6 } 1.7 -input.action[value="edit"]:checked ~ input {display: inline;} 1.8 +input.action[value="edit"]:checked ~ input[class="edit"], 1.9 +input.action[value="mv"]:checked ~ input[type="text"] {display: inline;} 1.10 input.action[value="edit"]:checked ~ textarea {display: block;} 1.11 -input.action[value="edit"]:checked ~ span {display: none;} 1.12 +input.action[value="edit"]:checked ~ span, 1.13 +input.action[value="mv"]:checked ~ span {display: none;} 1.14 input.action[value="rm"]:checked ~ span {background: red;} 1.15 label.confirm {display: none;} 1.16 input.action[value="rm"]:checked ~ label.confirm { 1.17 display: inline; 1.18 } 1.19 + 1.20 input.hidesub ~ input[type="submit"] {visibility: hidden;} 1.21 input.hidesub:focus ~ input[type="submit"], 1.22 p:active input[type="submit"]
2.1 --- a/s4-cgi.sh Tue Jun 23 12:47:34 2020 +0900 2.2 +++ b/s4-cgi.sh Tue Jun 23 12:58:31 2020 +0900 2.3 @@ -74,6 +74,9 @@ 2.4 # `dir' should contain $name.count and $name.N where N is 1 upto N 2.5 i=1 name=$1 dir=$2 func=$3 2.6 n=`cat $dir/$name.count` 2.7 + case "$func" in 2.8 + *file) addrename=yes ;; 2.9 + esac 2.10 echo '<table class="text">' 2.11 while [ $i -le $n ]; do 2.12 file=$name.$i 2.13 @@ -85,11 +88,15 @@ 2.14 value="keep"><label for="keep.$vname" title="Keep">温存</label> 2.15 <input class="action" type="radio" name="action.$vname" id="edit.$vname" 2.16 value="edit"><label for="edit.$vname" title="Replace">修正</label> 2.17 +${addrename:+<input class="action" type="radio" name="action.$vname" 2.18 + id="mv.$vname" value="mv"><label for="mv.$vname" 2.19 + title="Rename">名前変更</label>} 2.20 <input class="action" type="radio" name="action.$vname" id="rm.$vname" 2.21 value="rm"><label for="rm.$vname" title="Remove">削除</label> 2.22 <label class="confirm" title="OK?">本当に消します<input class="confirm" type="checkbox" 2.23 name="confirm.$vname" value="yes">はい</label><br> 2.24 `$func $vname "$val" "$4"`<span>$val</span> 2.25 +${addrename:+<input class="mv" type="text" name="mv.$vname" value="$val">} 2.26 </td></tr> 2.27 EOF 2.28 i=$((i+1)) 2.29 @@ -101,14 +108,14 @@ 2.30 ) 2.31 # In these functions, $2 should be quoted because it can be null 2.32 cgi_multi_text() { 2.33 - cgi_multi $1 "$2" cgi_text "$3" 2.34 + cgi_multi $1 "$2" cgi_text "$3 class=\"edit\"" 2.35 } 2.36 cgi_multi_textarea() { 2.37 - cgi_multi $1 "$2" cgi_textarea "$3" 2.38 + cgi_multi $1 "$2" cgi_textarea "$3 class=\"edit\"" 2.39 } 2.40 cgi_multi_file() { 2.41 # $1=name $2=val(filename) 2.42 - cgi_multi $1 "$2" cgi_file "$3" 2.43 + cgi_multi $1 "$2" cgi_file "$3 class=\"edit\"" 2.44 } 2.45 cgi_datalist_h() { 2.46 # $1=id $2...=hexed-args
3.1 --- a/s4-funcs.sh Tue Jun 23 12:47:34 2020 +0900 3.2 +++ b/s4-funcs.sh Tue Jun 23 12:58:31 2020 +0900 3.3 @@ -729,7 +729,7 @@ 3.4 user|skey) unset _$i ;; 3.5 esac 3.6 fi 3.7 - query "DELETE FROM par WHERE var='$i';" 3.8 + query "DELETE FROM par WHERE var='$i' AND sessid='$session';" 3.9 done 3.10 } 3.11 replpar() { 3.12 @@ -2941,7 +2941,7 @@ 3.13 fi 3.14 subj=`getpar subject` 3.15 afiles="" 3.16 - for fn in `query "SELECT DISTINCT val FROM par WHERE var='files';"` 3.17 + for fn in `query "SELECT DISTINCT val FROM par WHERE var='files' AND sessid='$session';"` 3.18 do 3.19 f=$tmpd/$fn 3.20 if [ -s $f ]; then 3.21 @@ -3978,7 +3978,7 @@ 3.22 # sessID|address.1.22|string|Somewhere-x.y.z 3.23 sql="" 3.24 ##err dots from query "select var from par where var like '$col.%';" 3.25 - for v in `query "select var from par where var like '$col.%';"`; do 3.26 + for v in `query "select var from par where var like '$col.%' AND sessid='$session';"`; do 3.27 # v=address.1.22 3.28 st_rowid=${v##*.} 3.29 origcol=${v%%.*} # original column derived from 3.30 @@ -4014,10 +4014,29 @@ 3.31 ;; 3.32 *) 3.33 newsql="update $tb2 set val=(select val from par where var \ 3.34 -like '$col.%.$st_rowid')" 3.35 +like '$col.%.$st_rowid' AND sessid='$session')" 3.36 ;; 3.37 esac 3.38 ;; 3.39 + mv) 3.40 + # regularize filename and strip directory part 3.41 + newname=`getpar mv.$v|tr -d '":;#<>?^%$!'|tr -d "'"|tr ' ' _` 3.42 + newname=`basename $newname` 3.43 + err "newname($v)=$newname" 3.44 + newext="${newname##*.}" 3.45 + if test x"$newname" != x"$newext" \ 3.46 + && echo "${file_accept#*=}" \ 3.47 + | fgrep -w "$newext" >/dev/null 1>&2 3.48 + then 3.49 + newsql="UPDATE $tb2 SET val='$newname'" 3.50 + else 3.51 + html p<<-EOF 3.52 + $newname は取り扱えないファイル名です。 3.53 + 空白を含まない名前で拡張子を正しくつけて下さい。 3.54 + EOF 3.55 + continue 3.56 + fi 3.57 + ;; 3.58 *) # maybe "keep", do not modify value 3.59 continue 3.60 ;;