s4

changeset 236:19b92549b5b7

Add button to clear all unread article list
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 26 Jun 2016 20:56:01 +0859
parents 014f459543d5
children ba4efe0b53e0
files s4-funcs.sh
diffstat 1 files changed, 26 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/s4-funcs.sh	Sat Jun 25 09:49:02 2016 +0859
     1.2 +++ b/s4-funcs.sh	Sun Jun 26 20:56:01 2016 +0859
     1.3 @@ -28,6 +28,7 @@
     1.4  maximagexy=1600x1600
     1.5  ### maximagexy=400x400
     1.6  file_accept='accept="image/*,text/*,audio/*,application/vnd.oasis.*,application/pdf,application/x-*"'
     1.7 +blogreadflagrowid=0
     1.8  
     1.9  tconfs=""
    1.10  imgcached=cache/img.`date +%Y/%m`
    1.11 @@ -1378,16 +1379,24 @@
    1.12          max(case key when 'owner' then val end) owner
    1.13   from blog, blog_s using(id) group by id
    1.14  ), acclog_user as (
    1.15 -  select * from acclog where user='$user' and tbl='blog'
    1.16 +  -- select * from acclog where user='$user' and tbl='blog'
    1.17 +  -- GET (user,tbl,tblrowid,max(time,DEFAULTtime))
    1.18 +  SELECT user, tbl, tblrowid,
    1.19 +         max(time,
    1.20 +             coalesce((SELECT time FROM acclog
    1.21 +		       WHERE user='$user' and tbl='blog'
    1.22 +		       AND tblrowid=$blogreadflagrowid), 0)) time
    1.23 +	 FROM acclog
    1.24 +	 WHERE user='$user' AND  tbl='blog'
    1.25  ), blogall as (
    1.26   select b.id, b.rowid, b.owner, b.title, ctime, ac.author
    1.27   from blog_title_owner b, article_ctime ac
    1.28        on b.id=ac.blogid
    1.29  )
    1.30   select rowid LINK, 
    1.31 -        sum(case when l.time is null then 1
    1.32 -                 when l.time < ctime then 1
    1.33 -                 else 0
    1.34 +        sum(case when l.time is not null
    1.35 +                 then l.time < ctime
    1.36 +                 else 1
    1.37              end) "新着",
    1.38   count(id) "総数", ctime, title,
    1.39   /* owner gecos */
    1.40 @@ -1497,6 +1506,11 @@
    1.41        new10=`DT_CHLD=article:blogid \
    1.42  	  DT_VIEW=replyblog dumptable html blog "ctime title gecos" "$cond"`
    1.43      else
    1.44 +      # 2016-06-26
    1.45 +      if [ x"`getpar readchk``getpar read`" = x"yesyes" ]; then
    1.46 +	acclog blog $blogreadflagrowid
    1.47 +	# echo "全部既読にしました" | html p
    1.48 +      fi
    1.49        # 2016-02-19 Counting NEWS without using dumptable.
    1.50        sql=`listnewblogsql "$user"`
    1.51        new10=`DT_SQL="$sql" DT_VIEW=replyblog dumptable html blog`
    1.52 @@ -1507,6 +1521,14 @@
    1.53      if [ $cont -gt 0 ]; then
    1.54        echo "全体の新着記事${cont}傑" | html h2
    1.55        echo "$new10"
    1.56 +      cat<<-EOF | html form 'action="?home"'
    1.57 +	<div class="fold noborder">
    1.58 +	`cgi_checkbox readchk yes 'id="read"'`<label
    1.59 +	 for="read">新着ふくめて全部読んだことにする</label>
    1.60 +	 <div>`cgi_submit '確定'`</div>
    1.61 +	 `cgi_hidden read yes`
    1.62 +	</div>
    1.63 +	EOF
    1.64      fi
    1.65      cat<<EOF
    1.66  <div class="fold">