s4

changeset 408:138a0c6b09a7

Edit link in cached row file should be determined dynamically.
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 09 Feb 2017 19:45:06 +0859
parents 4d912c2d48df
children 388639a80a23
files s4-blog.sh
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/s4-blog.sh	Thu Feb 09 11:20:10 2017 +0900
     1.2 +++ b/s4-blog.sh	Thu Feb 09 19:45:06 2017 +0859
     1.3 @@ -222,6 +222,7 @@
     1.4    while IFS='|' read id edit notify uid uname icon aid tm new hte imgids; do
     1.5      cachefile="$td/$id.row.html"
     1.6      stampfile="$td/$id.row.stamp"
     1.7 +    editlink="${edit:+<a href="$elink+$edit">編集</a> }"
     1.8  
     1.9      # First, check the availability of user-icon.
    1.10      # If not existent, clear and reset row cache by rm $stampfile
    1.11 @@ -249,7 +250,7 @@
    1.12  
    1.13  	cat<<EOF
    1.14  <tr id="$id">
    1.15 -<td class="$tdcls">$picon${edit:+<a href="$elink+$edit">編集</a> }#$aid
    1.16 +<td class="$tdcls">${picon}__EDIT__#$aid
    1.17  <a href="$hlink+$uid">$uname</a>
    1.18  $tm
    1.19  ${notify:+$nt}</td>
    1.20 @@ -308,7 +309,9 @@
    1.21        test -n "$stampfile" && date "+%F %T" > $stampfile
    1.22      fi
    1.23      # Printing a cached row
    1.24 -    sed "/<td class=/s/__NEWCLS__/$new${new:+ }/" $cachefile
    1.25 +    sed -e "/<td class=/s/__NEWCLS__/$new${new:+ }/" \
    1.26 +	-e "/<td class=/s,__EDIT__,$editlink," \
    1.27 +	$cachefile
    1.28    done
    1.29  
    1.30    textform='<div class="fold">