s4

changeset 328:d89412dc78a1

List recent subscriptions in other user's home
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 21 Oct 2016 16:48:37 +0859
parents 5e56160ad1f5
children e4fedb216119
files s4-funcs.sh
diffstat 1 files changed, 13 insertions(+), 11 deletions(-) [+]
line diff
     1.1 --- a/s4-funcs.sh	Fri Oct 21 16:26:52 2016 +0859
     1.2 +++ b/s4-funcs.sh	Fri Oct 21 16:48:37 2016 +0859
     1.3 @@ -1633,13 +1633,12 @@
     1.4    #Calling listgroupbytable, originally here
     1.5    
     1.6    (
     1.7 -  if [ x"$user" = x"$uname" ]; then
     1.8 -    # Display Most Recent Entry
     1.9 -    shortval=${dumpcollen:+"substr(val, 0, $dumpcollen)"}
    1.10 -    shortval=${shortval:-val}
    1.11 +  # Display Most Recent Entry
    1.12 +  shortval=${dumpcollen:+"substr(val, 0, $dumpcollen)"}
    1.13 +  shortval=${shortval:-val}
    1.14  
    1.15 -    # The m.aid in the next line is suspicious.  But works fine in SQLite3...
    1.16 -    DT_SQL="SELECT b.rowid || '#' || m.aid LINK,
    1.17 +   # The m.aid in the next line is suspicious.  But works fine in SQLite3...
    1.18 +  DT_SQL="SELECT b.rowid || '#' || m.aid LINK,
    1.19         ctime,
    1.20         (SELECT $shortval FROM blog_s WHERE key='title' AND id=b.id) title,
    1.21         (SELECT gecos FROM gecoses
    1.22 @@ -1650,12 +1649,12 @@
    1.23       JOIN
    1.24       (SELECT distinct blogid, a.id aid, max(val) ctime
    1.25        FROM article a, article_s s
    1.26 -      ON a.id=s.id AND a.author='$user' AND s.key='ctime'
    1.27 +      ON a.id=s.id AND a.author='$uname' AND s.key='ctime'
    1.28        GROUP BY blogid ORDER BY val DESC LIMIT 50
    1.29       ) m
    1.30       ON b.id=m.blogid;"
    1.31 -    # This should be as follows
    1.32 -    : <<EOF
    1.33 +  # This should be as follows
    1.34 +  : <<EOF
    1.35  WITH arts AS(
    1.36    SELECT (SELECT rowid FROM blog WHERE id=a.blogid) brid,
    1.37           a.blogid, a.id id, s.val ctime
    1.38 @@ -1671,14 +1670,15 @@
    1.39  ORDER BY ctime DESC LIMIT 50;
    1.40  EOF
    1.41  
    1.42 -    cat<<-EOF
    1.43 +  cat<<-EOF
    1.44  	`cgi_radio foldtabs yes id="mre"`<label
    1.45  	 for="mre">最近の書き込み先</label>
    1.46  	<div class="lcto">
    1.47  	`DT_VIEW=replyblog dumptable html blog`
    1.48  	</div>
    1.49  	EOF
    1.50 -    unset DT_SQL
    1.51 +  unset DT_SQL
    1.52 +  if [ x"$user" = x"$uname" ]; then
    1.53      # Display NEWS
    1.54      if false; then
    1.55        cond="where 新着 > 0 order by 新着 desc,ctime desc limit 10"
    1.56 @@ -1710,6 +1710,8 @@
    1.57        echo "$new10 <!-- new10 -->"
    1.58        echo "</div>"
    1.59      fi
    1.60 +  else				# Not My Home ($user != $uname)
    1.61 +    # DT_SQL=
    1.62    fi
    1.63    ) > $hometail &		# Is background call safe to m4??
    1.64    #