# HG changeset patch # User HIROSE Yuuji # Date 1592106091 -32400 # Node ID d368b937956ec8b12c51ab1db7cd2a6be29ef479 # Parent e9e86a1fc1f33475e853b8f6a6ae57367dad6eaf Limit the number of articles to show by default diff -r e9e86a1fc1f3 -r d368b937956e s4-blog.sh --- a/s4-blog.sh Fri Jun 12 19:01:48 2020 +0900 +++ b/s4-blog.sh Sun Jun 14 12:41:31 2020 +0900 @@ -113,7 +113,7 @@ ) blog_showentry() { - # $1=table $2=rowid + # $1=table $2=rowid $3(optional)=control-sequence # if [ -n "$2" ]; then # if [ -n "$imgcached" ]; then # bstmpdir=$tmpdir/$imgcached/$thumbxy @@ -123,6 +123,7 @@ # # tmpfiles=$tmpfiles" $tmpd" # fi # fi + control=$3 td=`getcachedir "article/$2"` [ -d "$td" ] || mkdir -p $td tbl=${1%%[!A-Z0-9a-z_]*} rowid=${2%%[!A-Z0-9a-z_]*} @@ -273,7 +274,7 @@ echo "${blogtype}モードは本人と管理者の書き込みのみが表示されます。" ;; esac | html p 'class="warn"' - echo '' + if [ x"$blogtype" = x"クイズ" -o x"$blogtype" = x"XXXX集計" ]; then if $isgroup; then # Failsafe to query timeout @@ -298,6 +299,16 @@ echo "時間をおいて繋いでください(Please visit later)." | html p return fi + ## Parse control sequence + nlimit=$listartlimit + case "$control" in + n:[Aa][Ll][Ll]) + unset nlimit ;; + n:*) + nlimit=${control##*:} + nlimit=${nlimit%%[!A-Z0-9a-z_]*} + ;; + esac lkhome="※最新${nlimit}件のみの表示" + showalllink="全件表示" + echo $limitedmsg$showalllink | html p + else + CAT=cat + fi + # Start blog_replies table + echo '
' + $CAT $midfile | while IFS='|' read id edit notify uid author uname icon aid \ tm reki new hte fa imgids do @@ -532,7 +553,8 @@ href="?reload/$rowid" accesskey="r" title="Shortcut: R${nl}Reload">再読込 / 先頭へ

+ title="Shortcut: T${nl}to the Top">先頭へ + ${showalllink:+/ $showalllink$limitedmsg}

EOF $iswritable && cat<<-EOF
@@ -1250,6 +1272,7 @@ } blog_reply() { # Posting to blog article + # $1=rowid $2=control-sequence rowid=`numericalize $1` # Ensure (already purified in s4.cgi) if [ -z "$rowid" ]; then @@ -1329,7 +1352,7 @@ def=$formdir/article.def echo "$title" | htmlescape > $tmpd/title.$$ echo "$subtitle$frozen_flag" > $tmpd/subtitle.$$ - ${BLOG_SHOW:-blog_showentry} blog $rowid \ + ${BLOG_SHOW:-blog_showentry} blog $rowid "$2" \ | _m4 -D_TITLE_="spaste(\`$tmpd/title.$$')" \ -D_BODYCLASS_=general"${memclass:+ $memclass}" \ -D_FORMHEAD_="spaste(\`$tmpd/subtitle.$$')" \ diff -r e9e86a1fc1f3 -r d368b937956e s4-funcs.sh --- a/s4-funcs.sh Fri Jun 12 19:01:48 2020 +0900 +++ b/s4-funcs.sh Sun Jun 14 12:41:31 2020 +0900 @@ -19,6 +19,7 @@ sessdb=$dbdir/sess.sq3 sesstb=tmp.sess listentlimit=${LISTENTLIMIT:-30} +listartlimit=${LISTARTLIMIT:-50} admin=${ADMIN:-hostmaster@example.org} noreply=${NOREPLY:-noreply@example.org} noreply_from="${S4NAME:-s4} message notification <$noreply>" diff -r e9e86a1fc1f3 -r d368b937956e scripts/s4-sns.case --- a/scripts/s4-sns.case Fri Jun 12 19:01:48 2020 +0900 +++ b/scripts/s4-sns.case Sun Jun 14 12:41:31 2020 +0900 @@ -33,7 +33,7 @@ contenttype; echo rowid=${2%%[!A-Z0-9a-z_]*} . ./s4-blog.sh - blog_reply $rowid + blog_reply $rowid "$3" ;; aid[1-9]*) arid=${1#aid}