s4

changeset 490:e4b929e40fa8

Add feature of limiting date range of POST count
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 08 Jun 2018 09:36:21 +0900
parents 075897fee2c0
children c5d6e12306d4
files s4-funcs.sh
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/s4-funcs.sh	Mon May 28 10:39:32 2018 +0900
     1.2 +++ b/s4-funcs.sh	Fri Jun 08 09:36:21 2018 +0900
     1.3 @@ -2458,14 +2458,22 @@
     1.4        fi
     1.5      fi
     1.6    fi
     1.7 +  # POST count summary
     1.8 +  from=`getpar from`; to=`getpar to`
     1.9 +  from_input="<input type=\"date\" name=\"from\" placeholder=\"YYYY-MM-DD\" value=\"${from}\">"
    1.10 +  to_input="<input type=\"date\" name=\"to\" value=\"${to:-9999}\">"
    1.11 +  fromtonote="<p>POST集計: $from_input - $to_input</p>$from - $to"
    1.12    # New entry
    1.13    sql="WITH mems AS (
    1.14  	  SELECT g.rowid, name, gecos FROM grp_mem gm LEFT JOIN gecoses g
    1.15  	  ON gm.user=g.name
    1.16  	  WHERE gname=(SELECT gname FROM grp WHERE rowid=$grid)
    1.17 +	), target_article AS (
    1.18 +	  SELECT id FROM article_s
    1.19 +	  WHERE key='ctime' AND val BETWEEN '${from:-0000}' AND '${to:-9999}'
    1.20  	), posts AS (
    1.21    	  SELECT author, count(author) post
    1.22 -	  FROM article NATURAL JOIN article_s
    1.23 +	  FROM article NATURAL JOIN article_s NATURAL JOIN target_article
    1.24    	  WHERE blogid IN (SELECT id FROM blog_s
    1.25                     WHERE key='owner'
    1.26                     AND val=(SELECT gname FROM grp WHERE rowid=$grid))
    1.27 @@ -2552,7 +2560,7 @@
    1.28  ${isowner:+$cmmsg$excmsg}
    1.29  `cgi_radio rm close id="x"`<label for="x">×</label>
    1.30  </div>
    1.31 -<h4>$grp 参加者一覧</h4>
    1.32 +<h4>$grp 参加者一覧</h4>$fromtonote
    1.33  <table class="td2r">
    1.34  `sq $db -header -html "$sql"`
    1.35  </table>