s4

changeset 802:1de1319dce99 feature-world

merged
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 14 Jun 2020 12:48:43 +0900
parents 12a567f00744 d368b937956e
children fc271965bd56
files s4-blog.sh s4-funcs.sh scripts/s4-sns.case
diffstat 3 files changed, 30 insertions(+), 6 deletions(-) [+]
line diff
     1.1 --- a/s4-blog.sh	Sun Jun 14 11:33:02 2020 +0900
     1.2 +++ b/s4-blog.sh	Sun Jun 14 12:48:43 2020 +0900
     1.3 @@ -113,7 +113,7 @@
     1.4  )
     1.5  
     1.6  blog_showentry() {
     1.7 -  # $1=table $2=rowid
     1.8 +  # $1=table $2=rowid $3(optional)=control-sequence
     1.9    # if [ -n "$2" ]; then
    1.10    #   if [ -n "$imgcached" ]; then
    1.11    #     bstmpdir=$tmpdir/$imgcached/$thumbxy
    1.12 @@ -123,6 +123,7 @@
    1.13    #     # tmpfiles=$tmpfiles" $tmpd"
    1.14    #   fi
    1.15    # fi
    1.16 +  control=$3
    1.17    td=`getcachedir "article/$2"`
    1.18    [ -d "$td" ] || mkdir -p $td
    1.19    tbl=${1%%[!A-Z0-9a-z_]*} rowid=${2%%[!A-Z0-9a-z_]*}
    1.20 @@ -273,7 +274,7 @@
    1.21  	echo "${blogtype}モードは本人と管理者の書き込みのみが表示されます。"
    1.22  	;;
    1.23      esac | html p 'class="warn"'
    1.24 -    echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->'
    1.25 +
    1.26      if [ x"$blogtype" = x"クイズ" -o x"$blogtype" = x"XXXX集計" ]; then
    1.27        if $isgroup; then
    1.28  	# Failsafe to query timeout
    1.29 @@ -298,6 +299,16 @@
    1.30      echo "時間をおいて繋いでください(Please visit later)." | html p
    1.31      return
    1.32    fi
    1.33 +  ## Parse control sequence
    1.34 +  nlimit=$listartlimit
    1.35 +  case "$control" in
    1.36 +    n:[Aa][Ll][Ll])
    1.37 +	unset nlimit ;;
    1.38 +    n:*)
    1.39 +	nlimit=${control##*:}
    1.40 +	nlimit=${nlimit%%[!A-Z0-9a-z_]*}
    1.41 +	;;
    1.42 +  esac
    1.43    lkhome="<a href=\"$myname?home" lke='">'
    1.44    lkedit="<a href=\"$myname?editart"
    1.45    hlink="$myname?home" elink="$myname?editart"
    1.46 @@ -379,7 +390,17 @@
    1.47      echo "時間をおいてください(Visit later please)." | html p
    1.48      return
    1.49    fi
    1.50 -  cat $midfile |
    1.51 +  if [ -n "$nlimit" -a `wc -l < $midfile` -gt "$nlimit" ]; then
    1.52 +    CAT="tail -n $nlimit"
    1.53 +    limitedmsg="<small class=\"warn\">※最新${nlimit}件のみの表示</small>"
    1.54 +    showalllink="<a title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>"
    1.55 +    echo $limitedmsg$showalllink | html p
    1.56 +  else
    1.57 +    CAT=cat
    1.58 +  fi
    1.59 +  # Start blog_replies table
    1.60 +  echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->'
    1.61 +  $CAT $midfile |
    1.62    while IFS='|' read id edit notify uid author uname icon aid \
    1.63  	   tm reki new hte fa imgids
    1.64    do
    1.65 @@ -532,7 +553,8 @@
    1.66  	 href="?reload/$rowid" accesskey="r"
    1.67  	  title="Shortcut: R${nl}Reload">再読込</a> / <a
    1.68  	 href="#title" id="bottom" accesskey="t"
    1.69 -	  title="Shortcut: T${nl}to the Top">先頭へ</a></p>
    1.70 +	  title="Shortcut: T${nl}to the Top">先頭へ</a>
    1.71 +	 ${showalllink:+/ $showalllink$limitedmsg}</p>
    1.72  	EOF
    1.73    $iswritable && cat<<-EOF
    1.74  	<div class="blogcomment">
    1.75 @@ -1250,6 +1272,7 @@
    1.76  }
    1.77  
    1.78  blog_reply() {		# Posting to blog article
    1.79 +  # $1=rowid $2=control-sequence
    1.80    rowid=`numericalize $1`	# Ensure (already purified in s4.cgi)
    1.81  
    1.82    if [ -z "$rowid" ]; then
    1.83 @@ -1329,7 +1352,7 @@
    1.84    def=$formdir/article.def
    1.85    echo "$title" | htmlescape > $tmpd/title.$$
    1.86    echo "$subtitle$frozen_flag" > $tmpd/subtitle.$$
    1.87 -  ${BLOG_SHOW:-blog_showentry} blog $rowid \
    1.88 +  ${BLOG_SHOW:-blog_showentry} blog $rowid "$2" \
    1.89        | _m4 -D_TITLE_="spaste(\`$tmpd/title.$$')" \
    1.90  	    -D_BODYCLASS_=general"${memclass:+ $memclass}" \
    1.91  	    -D_FORMHEAD_="spaste(\`$tmpd/subtitle.$$')" \
     2.1 --- a/s4-funcs.sh	Sun Jun 14 11:33:02 2020 +0900
     2.2 +++ b/s4-funcs.sh	Sun Jun 14 12:48:43 2020 +0900
     2.3 @@ -38,6 +38,7 @@
     2.4  sesstb=tmp.sess
     2.5  workdb=$dbdir/tmpdata.sq3
     2.6  listentlimit=${LISTENTLIMIT:-30}
     2.7 +listartlimit=${LISTARTLIMIT:-50}
     2.8  admin=${ADMIN:-hostmaster@example.org}
     2.9  noreply=${NOREPLY:-noreply@example.org}
    2.10  noreply_from="${S4NAME:-s4} message notification <$noreply>"
     3.1 --- a/scripts/s4-sns.case	Sun Jun 14 11:33:02 2020 +0900
     3.2 +++ b/scripts/s4-sns.case	Sun Jun 14 12:48:43 2020 +0900
     3.3 @@ -33,7 +33,7 @@
     3.4      contenttype; echo
     3.5      rowid=${2%%[!A-Z0-9a-z_]*}
     3.6      . ./s4-blog.sh
     3.7 -    blog_reply $rowid
     3.8 +    blog_reply $rowid "$3"
     3.9      ;;
    3.10    aid[1-9]*)
    3.11      arid=${1#aid}