changeset 219:e2dea2f63a69

Duplicate posting by reload avoided
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 13 Jun 2016 12:28:00 +0859
parents 849e6dee3485
children 7d05425e4057
files examples/common/default/default.css examples/sns/form/article.def s4-blog.sh s4-funcs.sh s4.cgi
diffstat 5 files changed, 27 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/examples/common/default/default.css	Mon Jun 13 08:36:49 2016 +0859
+++ b/examples/common/default/default.css	Mon Jun 13 12:28:00 2016 +0859
@@ -77,6 +77,7 @@
     border: 1px solid black; border-collapse: collapse;
     white-space: pre-wrap;
 }
+table.blog_replies+p.update_link {margin-top: 0; margin-bottom: 14em;}
 .blog_replies td:nth-child(2) {
     vertical-align: top; min-width: 30em; height: 3em;
     max-width: 50em;
--- a/examples/sns/form/article.def	Mon Jun 13 08:36:49 2016 +0859
+++ b/examples/sns/form/article.def	Mon Jun 13 12:28:00 2016 +0859
@@ -4,6 +4,6 @@
 時刻:ctime:s:stamp:
 参照元:parent:s:parent: 
 パス:path:s:path:
-本文:text:s:textarea:cols="60" rows="8"
-画像:image:m:image:multiple
+本文:text:s:textarea:cols="72" rows="4"
+添付:image:m:image:multiple
 stage:stage:x:hidden:value="replyblog"
--- a/s4-blog.sh	Mon Jun 13 08:36:49 2016 +0859
+++ b/s4-blog.sh	Mon Jun 13 12:28:00 2016 +0859
@@ -101,7 +101,6 @@
 
   #(1)Display root article
   cat<<EOF
-<form class="replyblog" action="$myname?replyblog+${rowid}#bottom" method="POST" enctype="multipart/form-data">
 <table class="bloghead">
 EOF
 
@@ -251,18 +250,23 @@
 <input type="submit" value="送信">
 <input type="reset" value="リセット"></div></div>
 '
-  echo '</table>'
-  
-  $iswritable && cat<<EOF
-<div class="blogcomment">
-<!-- <p>コメント記入</p> -->
-<input type="hidden" name="blogid" value="$id">
-<input type="hidden" name="stage" value="replyblog">
-<input type="hidden" name="serial" value="$serial">
-$textform
-</div>
-EOF
-  echo "</form><p id=\"bottom\"></p>"
+  cat<<-EOF
+	</table>
+	<p class="update_link"><a
+	 href="?reload/$rowid">再読込</a></p>
+	EOF
+  $iswritable && cat<<-EOF
+	<div class="blogcomment">
+	<div class="fold">
+	<input type="checkbox" id="cmt" checked><label for="cmt"
+	>コメントする</label>
+	<div>
+	`GF_ACTION="?replyblog+${rowid}#bottom" \
+	 GF_ARGS="<input type=\"hidden\" name=\"blogid\" value=\"$id\">" \
+	 genform $formdir/article.def`
+	</div></div></div>
+	<p id="bottom"></p>
+	EOF
   # Record access log
   acclog blog $rowid
 }
--- a/s4-funcs.sh	Mon Jun 13 08:36:49 2016 +0859
+++ b/s4-funcs.sh	Mon Jun 13 12:28:00 2016 +0859
@@ -2614,7 +2614,7 @@
   # $1 = form definition file
   # $2, $3 (optional)= table name and ROWID
   # If $GF_VIEWONLY set and nonNull, output values without form
-  # If $GF_HIDDEN set, use it hidden values
+  # If $GF_ARGS set, use it as content-strings in the form
   # If $GF_OWNER set, use it as value of name="owner"
   # If $GF_STAGE set, use it as value of name="stage"
   forms="" hiddens="" rowid=$3
@@ -2757,8 +2757,6 @@
 	if [ -z "$rowid" ]; then
 	  val=$((($(date +%s)-1433084400)/10))c$$
 	fi
-##	form="<input type=\"hidden\" name=\"serial\" value=\"$val\">"
-##	2015-07-31
 	form="<input type=\"hidden\" name=\"$name\" value=\"$val\">"
 	prompt="" ;;
       [Ss][Ee][Ss][Ss][Ii][Oo][Nn])
@@ -2799,7 +2797,7 @@
 EOF
   fi
   cat<<EOF
-</form>
+$GF_ARGS</form>
 $tail
 EOF
 }
--- a/s4.cgi	Mon Jun 13 08:36:49 2016 +0859
+++ b/s4.cgi	Mon Jun 13 12:28:00 2016 +0859
@@ -65,6 +65,11 @@
 err blog_reply2 $rowid
     blog_reply $rowid
     ;;
+  reload*)	# Dirty workaround for reloading page just after submit
+    newurl="$urlbase?replyblog+${stage#*/}#bottom"
+    echo "Refresh: 0; $newurl"; echo
+    exit 0
+    ;;
   lshandout|gethandout)
     if [ x"$stage" = x"lshandout" ]; then
       contenttype; echo

yatex.org