changeset 409:388639a80a23

Also notify rule in cached file should be generated dynamically.
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 09 Feb 2017 20:13:58 +0859
parents 138a0c6b09a7
children c1b4a9dba1c9
files s4-blog.sh
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Thu Feb 09 19:45:06 2017 +0859
+++ b/s4-blog.sh	Thu Feb 09 20:13:58 2017 +0859
@@ -223,6 +223,8 @@
     cachefile="$td/$id.row.html"
     stampfile="$td/$id.row.stamp"
     editlink="${edit:+<a href="$elink+$edit">編集</a> }"
+    nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\"\
+	 name=\"notifyto\" value=\"$uid\">返信通知送信</label>"
 
     # First, check the availability of user-icon.
     # If not existent, clear and reset row cache by rm $stampfile
@@ -236,8 +238,6 @@
       : Nothing to do
     else
       {		######## New ROW creation begins here ######## >$cachefile
-	nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\"
-	 name=\"notifyto\" value=\"$uid\">返信通知送信</label>"
 	tdcls="__NEWCLS__repatt"
 	if [ -s "$icon" ]; then
 	  icfn=`echo "$icon"|htmlescape`
@@ -253,7 +253,7 @@
 <td class="$tdcls">${picon}__EDIT__#$aid
 <a href="$hlink+$uid">$uname</a>
 $tm
-${notify:+$nt}</td>
+<__NOTIFY__></td>
 EOF
 	echo -n "<td id=\"$aid\" class=\"repl\">"
 	echo "$hte"|unhexize|htmlescape|hreflink|minitbl
@@ -309,8 +309,9 @@
       test -n "$stampfile" && date "+%F %T" > $stampfile
     fi
     # Printing a cached row
-    sed -e "/<td class=/s/__NEWCLS__/$new${new:+ }/" \
-	-e "/<td class=/s,__EDIT__,$editlink," \
+    sed -e "/^<td class=/s/__NEWCLS__/$new${new:+ }/" \
+	-e "/^<td class=/s,__EDIT__,$editlink," \
+	-e "/^<__NOTIFY__>/s,,${notify:+$nt}," \
 	$cachefile
   done
 

yatex.org