s4

changeset 776:d773042e923d feature-world

merged
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 11 Jun 2020 10:39:51 +0900
parents 825646678e33 2c5a8c5dd1ee
children 1aa864ab9739
files s4-funcs.sh
diffstat 2 files changed, 21 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/s4-blog.sh	Tue Jun 09 12:32:27 2020 +0900
     1.2 +++ b/s4-blog.sh	Thu Jun 11 10:39:51 2020 +0900
     1.3 @@ -228,7 +228,12 @@
     1.4      case $blog_mode in
     1.5        *report*|*quiz*|*enquete*)
     1.6  	href2="<a href=\"?lshandout+$rowid\" accesskey=\"l\" title=\"Shortcut: L${nl}List Handouts\"> 提出状況 </a>"
     1.7 -	href3="(<a href=\"?gethandout+$rowid\" accesskey=\"f\" title=\"Shortcut: F${nl}File Retrieval\">ファイル取得</a>)"
     1.8 +	case "$isgrpadmin$blog_mode" in
     1.9 +	  false*closed*|false*quiz|false*enquete*) ;;
    1.10 +	  *)
    1.11 +	    href3="(<a href=\"?gethandout+$rowid\" accesskey=\"f\" title=\"Shortcut: F${nl}File Retrieval\">ファイル取得</a>)"
    1.12 +	    ;;
    1.13 +	esac
    1.14  	;;
    1.15      esac
    1.16    fi
    1.17 @@ -736,16 +741,24 @@
    1.18      echo "メンバー以外は利用できません。" | html p; return
    1.19    fi
    1.20    # Here, this blog is writable by $user
    1.21 +  mode=`getvalbyid blog mode $1`
    1.22    owner=`getvalbyid blog owner $1`
    1.23 +  blogauthor=`getvalbyid blog author $1`
    1.24 +  isopenblogauthor=false
    1.25    if [ x"$user" = x"$owner" ]; then
    1.26      : OK
    1.27    elif isgrpowner "$user" "$owner"; then
    1.28      : OK
    1.29 +  elif [ x"$blogauthor" = x"$user" ]; then
    1.30 +    # Non-admin Author of blog cannot do gethandout() in report-closed mode
    1.31 +    # for avoidance the risk of fake report-closed blog.
    1.32 +    case "$mode" in	# Only report-open can be handled by blog author
    1.33 +      *open*) isopenblogauthor=true ;;
    1.34 +    esac
    1.35    else
    1.36      contenttype; echo
    1.37 -    echo "板の所有者以外は利用できません。" | html p; return
    1.38 +    echo "グループ管理者のみ取得できます。" | html p; return
    1.39    fi
    1.40 -  mode=`getvalbyid blog mode $1`
    1.41    copy2csv=false
    1.42    blogid=`getvalbyid blog id $1`
    1.43    isgroup "$owner" && isgroup=true || isgroup=false
    1.44 @@ -813,7 +826,8 @@
    1.45  	WHERE blogid=(SELECT id FROM blog WHERE rowid=$rid);
    1.46  	EOF
    1.47    cat $midfile | while IFS='|' read rowid artid author text; do
    1.48 -    isfilereadable $user article_s $rowid || continue
    1.49 +    $isgrpowner || $isopenblogauthor \
    1.50 +      || isfilereadable $user article_s $rowid || continue
    1.51      dir=`printf $bd/%d/%06d "$rid" "$rowid"`
    1.52      mkdir -p $dir
    1.53      echo "$author" > $dir/Author
     2.1 --- a/s4-funcs.sh	Tue Jun 09 12:32:27 2020 +0900
     2.2 +++ b/s4-funcs.sh	Thu Jun 11 10:39:51 2020 +0900
     2.3 @@ -3434,14 +3434,13 @@
     2.4    gid=$(query "select rowid from grp where gname=`sqlquote \"$t_grp\"`;")
     2.5    rcpts="`getgroupadminmails "$t_grp"` $user"
     2.6    ## err admit: msgdir=$msgdir, rcpts="["$rcpts"]"
     2.7 -  body="グループ <a href=\"?grp+$gid\">$t_grp</a>
     2.8 -に
     2.9 +  body="に
    2.10  $t_usr
    2.11  `[ x$1 = xyes ] && echo 'を追加' || echo 'の解除操作を'`
    2.12  しました。"
    2.13 -  (echo "$body"; echo; echo "$url?grp+$gid") | smail "$rcpts" "joingrp $1"
    2.14 +  echo "$t_grp$nl$body$nl$nl$url?grp+$gid" | smail "$rcpts" "joingrp $1"
    2.15    query "delete from session where id='$2';"
    2.16 -  echo "$body" | html p
    2.17 +  echo "グループ <a href=\"?grp+$gid\">$t_grp</a>$nl$body" | html p
    2.18  }
    2.19  
    2.20  joingrprequest() {