Mercurial > hgrepos > hgweb.cgi > s4
changeset 803:45322d035c12
Link to "ShowAll" moved into blog_replies table
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Sun, 14 Jun 2020 16:33:22 +0900 |
parents | d368b937956e |
children | 39e59b5b2131 |
files | s4-blog.sh |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-blog.sh Sun Jun 14 12:41:31 2020 +0900 +++ b/s4-blog.sh Sun Jun 14 16:33:22 2020 +0900 @@ -390,16 +390,26 @@ echo "時間をおいてください(Visit later please)." | html p return fi - if [ -n "$nlimit" -a `wc -l < $midfile` -gt "$nlimit" ]; then + echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->' + narts=`wc -l < $midfile` + if [ -n "$nlimit" -a "$narts" -gt "$nlimit" ]; then + newtop=`cat -n $midfile | grep "|new|" | head -1 | cut -f1` + if [ -n "$newtop" ]; then + afternew=$((narts-newtop+1)) + [ $afternew -gt $nlimit ] && nlimit=$((afternew+0)) + err Newtop=$newtop lines=$narts afternew=$afternew nlim=$nilmit + fi CAT="tail -n $nlimit" - limitedmsg="<small class=\"warn\">※最新${nlimit}件のみの表示</small>" + limitedmsg="<span class=\"warn\">※最新${nlimit}件のみの表示※</span>" showalllink="<a title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>" - echo $limitedmsg$showalllink | html p + cat<<-EOF + <tr><td>$limitedmsg<br>($((narts-$nlimit))件省略)</td> + <th>$showalllink</th></tr> + EOF else CAT=cat fi # Start blog_replies table - echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->' $CAT $midfile | while IFS='|' read id edit notify uid author uname icon aid \ tm reki new hte fa imgids