s4

changeset 557:591838015ac3

Put inaccessible mark on such attached file icon.
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 13 Apr 2019 19:00:56 +0900
parents 4a33f5424767
children 6f75af2ad877
files examples/common/default/default.css s4-blog.sh
diffstat 2 files changed, 25 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/examples/common/default/default.css	Sat Apr 13 18:28:20 2019 +0900
     1.2 +++ b/examples/common/default/default.css	Sat Apr 13 19:00:56 2019 +0900
     1.3 @@ -147,6 +147,9 @@
     1.4  div.noprofimg tr.profimg:hover, div.noprofimg tr.profimg:active {
     1.5      visibility: visible; display: table-row;}
     1.6  
     1.7 +/* Used for overlapping image */
     1.8 +img.overlap {position: absolute; top: 40px; left: 50px; z-index: 2;}
     1.9 +
    1.10  /* Used in user's home page */
    1.11  p.profimg {float: left; max-width: 50%; max-height: 400px;
    1.12  	   overflow: hidden; margin: 0 1em 1ex;
    1.13 @@ -294,7 +297,7 @@
    1.14  		   rgba(242,240,240,0.7);
    1.15      position: relative;
    1.16  }
    1.17 -div.search div.fr {position: relative;}
    1.18 +div.search div.fr, *.relative {position: relative;}
    1.19  div.search p.help, textarea + p.help {display: none;}
    1.20  div.search input:focus + p.help,
    1.21  textarea:focus + p.help {
     2.1 --- a/s4-blog.sh	Sat Apr 13 18:28:20 2019 +0900
     2.2 +++ b/s4-blog.sh	Sat Apr 13 19:00:56 2019 +0900
     2.3 @@ -119,6 +119,7 @@
     2.4    ts=${tbl}_s tm=${tbl}_m
     2.5    at=article as=article_s am=article_m
     2.6    serial=$(($(date +%s)-1420038000))s$$
     2.7 +  cannotread='<div class="relative"><img class="overlap" src="img/key.png" alt="(読み取り不可)"></div>'
     2.8    blog_writable $rowid $user
     2.9    rc=$?
    2.10    if [ $rc = 0 ]; then
    2.11 @@ -158,17 +159,20 @@
    2.12    else	# if writable
    2.13      isgrpowner "$user" "$blogowner" && isgrpadmin=true	# (*1)
    2.14    fi
    2.15 -  case `getvalbyid blog notify "$2"` in # "all", "admin" or "no" (or NULL)
    2.16 +  case `getvalbyid blog notify "$rowid"` in # "all", "admin" or "no" (or NULL)
    2.17      admin)	notifyto=1 ;;
    2.18      *)		notifyto="" ;;
    2.19    esac
    2.20 +  case `getvalbyid blog mode "$rowid"` in
    2.21 +    *quiz*|*close*)	f_exclusive=1 ;;
    2.22 +    *)			f_exclusive='' ;;
    2.23 +  esac
    2.24  
    2.25    # err "SELECT id from $tbl where rowid=$rowid"
    2.26    id=`query "select id from $tbl where rowid=$rowid;"`
    2.27    #err id=$id
    2.28    #err "select val from $ts where key='title' and id='$id';"
    2.29  
    2.30 -
    2.31    #(1)Display root article
    2.32    cat<<EOF
    2.33  <form class="replyblog" action="$myname?replyblog+${rowid}#bottom" method="POST" enctype="multipart/form-data">
    2.34 @@ -275,6 +279,12 @@
    2.35  	s.TIME,
    2.36          CASE WHEN s.TIME > '$atime' THEN 'new' ELSE '' END newer,
    2.37  	hex(s.TEXT),
    2.38 +	CASE -- File Accessibility to attached file
    2.39 +	WHEN '$f_exclusive' = ''    THEN ''
    2.40 +	WHEN '$isgrpadmin' = 'true' THEN ''
    2.41 +	WHEN '$user' = author       THEN ''
    2.42 +	ELSE				 'Unreadable'
    2.43 +	END cannotread,
    2.44  	(SELECT group_concat(rowid||':'||length(bin)||':'||hex(val), ' ')
    2.45  	 FROM article_m
    2.46  	 WHERE id=a.id AND key='image') imxgids
    2.47 @@ -286,12 +296,16 @@
    2.48       a_s s
    2.49    ON a.id=s.id;
    2.50  EOF
    2.51 -  while IFS='|' read id edit notify uid uname icon aid tm new hte imgids; do
    2.52 +  while IFS='|' read id edit notify uid uname icon aid tm new hte fa imgids
    2.53 +  do
    2.54      cachefile="$td/$id.row.html"
    2.55      stampfile="$td/$id.row.stamp"
    2.56      editlink="${edit:+<a href="$elink+$edit">編集</a> }"
    2.57      nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\"\
    2.58  	 name=\"notifyto\" value=\"$uid\">返信通知送信</label>"
    2.59 +  # Compute file accessibility of attached file
    2.60 +  err "----r=$aid fa=[$fa]----"
    2.61 +
    2.62  
    2.63      # First, check the availability of user-icon.
    2.64      # If not existent, clear and reset row cache by rm $stampfile
    2.65 @@ -368,7 +382,7 @@
    2.66  	      fi
    2.67  	      ;;
    2.68  	    *)
    2.69 -	      echo "<a href=\"$catlink+$mrid\"><img src=\"$deficon\">$fnb</a>"
    2.70 +	      echo "<__UNREADABLE__><a href=\"$catlink+$mrid\"><img src=\"$deficon\">$fnb</a>"
    2.71  	      ;;
    2.72  	  esac
    2.73  	done
    2.74 @@ -380,6 +394,7 @@
    2.75      sed -e "/^<td class=/s/__NEWCLS__/$new${new:+ }/" \
    2.76  	-e "/^<td class=/s,__EDIT__,$editlink," \
    2.77  	-e "/^<__NOTIFY__>/s,,${notify:+$nt}," \
    2.78 +	-e "/^<__UNREADABLE__>/s,,${fa:+$cannotread}," \
    2.79  	$cachefile
    2.80    done
    2.81    
    2.82 @@ -459,7 +474,7 @@
    2.83  }
    2.84  gethandoutcsv2() {
    2.85    # contenttype; echo
    2.86 -  SQL=$(cat<<-EOF)  gethandoutcsv "$1"
    2.87 +  SQL=$(cat<<-EOF
    2.88  	WITH this_blog_articles AS (
    2.89  	  SELECT rtb.id bid, rtb.brid, a.id aid, author, title, ctime
    2.90  	  FROM report_type_blogs rtb JOIN article a ON rtb.id=a.blogid
    2.91 @@ -487,6 +502,7 @@
    2.92  		cnt "post"
    2.93  	 FROM count_list cl JOIN gecoses g ON cl.author=g.name;
    2.94  	EOF
    2.95 +     )  gethandoutcsv "$1"
    2.96  }
    2.97  lshandout_ulink_table() {
    2.98    # NO Args.  Read stdin as SQL