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 wrap: on
line diff
--- a/examples/common/default/default.css	Sat Apr 13 18:28:20 2019 +0900
+++ b/examples/common/default/default.css	Sat Apr 13 19:00:56 2019 +0900
@@ -147,6 +147,9 @@
 div.noprofimg tr.profimg:hover, div.noprofimg tr.profimg:active {
     visibility: visible; display: table-row;}
 
+/* Used for overlapping image */
+img.overlap {position: absolute; top: 40px; left: 50px; z-index: 2;}
+
 /* Used in user's home page */
 p.profimg {float: left; max-width: 50%; max-height: 400px;
 	   overflow: hidden; margin: 0 1em 1ex;
@@ -294,7 +297,7 @@
 		   rgba(242,240,240,0.7);
     position: relative;
 }
-div.search div.fr {position: relative;}
+div.search div.fr, *.relative {position: relative;}
 div.search p.help, textarea + p.help {display: none;}
 div.search input:focus + p.help,
 textarea:focus + p.help {
--- a/s4-blog.sh	Sat Apr 13 18:28:20 2019 +0900
+++ b/s4-blog.sh	Sat Apr 13 19:00:56 2019 +0900
@@ -119,6 +119,7 @@
   ts=${tbl}_s tm=${tbl}_m
   at=article as=article_s am=article_m
   serial=$(($(date +%s)-1420038000))s$$
+  cannotread='<div class="relative"><img class="overlap" src="img/key.png" alt="(読み取り不可)"></div>'
   blog_writable $rowid $user
   rc=$?
   if [ $rc = 0 ]; then
@@ -158,17 +159,20 @@
   else	# if writable
     isgrpowner "$user" "$blogowner" && isgrpadmin=true	# (*1)
   fi
-  case `getvalbyid blog notify "$2"` in # "all", "admin" or "no" (or NULL)
+  case `getvalbyid blog notify "$rowid"` in # "all", "admin" or "no" (or NULL)
     admin)	notifyto=1 ;;
     *)		notifyto="" ;;
   esac
+  case `getvalbyid blog mode "$rowid"` in
+    *quiz*|*close*)	f_exclusive=1 ;;
+    *)			f_exclusive='' ;;
+  esac
 
   # err "SELECT id from $tbl where rowid=$rowid"
   id=`query "select id from $tbl where rowid=$rowid;"`
   #err id=$id
   #err "select val from $ts where key='title' and id='$id';"
 
-
   #(1)Display root article
   cat<<EOF
 <form class="replyblog" action="$myname?replyblog+${rowid}#bottom" method="POST" enctype="multipart/form-data">
@@ -275,6 +279,12 @@
 	s.TIME,
         CASE WHEN s.TIME > '$atime' THEN 'new' ELSE '' END newer,
 	hex(s.TEXT),
+	CASE -- File Accessibility to attached file
+	WHEN '$f_exclusive' = ''    THEN ''
+	WHEN '$isgrpadmin' = 'true' THEN ''
+	WHEN '$user' = author       THEN ''
+	ELSE				 'Unreadable'
+	END cannotread,
 	(SELECT group_concat(rowid||':'||length(bin)||':'||hex(val), ' ')
 	 FROM article_m
 	 WHERE id=a.id AND key='image') imxgids
@@ -286,12 +296,16 @@
      a_s s
   ON a.id=s.id;
 EOF
-  while IFS='|' read id edit notify uid uname icon aid tm new hte imgids; do
+  while IFS='|' read id edit notify uid uname icon aid tm new hte fa imgids
+  do
     cachefile="$td/$id.row.html"
     stampfile="$td/$id.row.stamp"
     editlink="${edit:+<a href="$elink+$edit">編集</a> }"
     nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\"\
 	 name=\"notifyto\" value=\"$uid\">返信通知送信</label>"
+  # Compute file accessibility of attached file
+  err "----r=$aid fa=[$fa]----"
+
 
     # First, check the availability of user-icon.
     # If not existent, clear and reset row cache by rm $stampfile
@@ -368,7 +382,7 @@
 	      fi
 	      ;;
 	    *)
-	      echo "<a href=\"$catlink+$mrid\"><img src=\"$deficon\">$fnb</a>"
+	      echo "<__UNREADABLE__><a href=\"$catlink+$mrid\"><img src=\"$deficon\">$fnb</a>"
 	      ;;
 	  esac
 	done
@@ -380,6 +394,7 @@
     sed -e "/^<td class=/s/__NEWCLS__/$new${new:+ }/" \
 	-e "/^<td class=/s,__EDIT__,$editlink," \
 	-e "/^<__NOTIFY__>/s,,${notify:+$nt}," \
+	-e "/^<__UNREADABLE__>/s,,${fa:+$cannotread}," \
 	$cachefile
   done
   
@@ -459,7 +474,7 @@
 }
 gethandoutcsv2() {
   # contenttype; echo
-  SQL=$(cat<<-EOF)  gethandoutcsv "$1"
+  SQL=$(cat<<-EOF
 	WITH this_blog_articles AS (
 	  SELECT rtb.id bid, rtb.brid, a.id aid, author, title, ctime
 	  FROM report_type_blogs rtb JOIN article a ON rtb.id=a.blogid
@@ -487,6 +502,7 @@
 		cnt "post"
 	 FROM count_list cl JOIN gecoses g ON cl.author=g.name;
 	EOF
+     )  gethandoutcsv "$1"
 }
 lshandout_ulink_table() {
   # NO Args.  Read stdin as SQL

yatex.org