changeset 508:944739c3ac5c

Continuous search available
author HIROSE Yuuji <yuuji@gentei.org>
date Wed, 13 Mar 2019 20:16:56 +0900
parents 145fb3cca3fb
children d34b8f36501c
files s4-blog.sh s4-funcs.sh
diffstat 2 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/s4-blog.sh	Wed Mar 06 14:15:53 2019 +0900
+++ b/s4-blog.sh	Wed Mar 13 20:16:56 2019 +0900
@@ -827,23 +827,28 @@
   kwd=`echo "$kwd"|htmlescape`
   owner=`getpar owner`
   owner=${owner:-$1}
-  echo "「$kwd」による検索結果" | html p
+  msg=""
   if [ -n "$owner" ]; then
     cond="where key='owner' and val='$owner'"
+    search_form_args="author=$owner"
     if isuser $owner; then
-      echo "(`linkhome $owner` さんの記録からの検索)" | html p
+      msg="(`linkhome $owner` さんの記録からの検索)"
     else
       linkhome $owner 1>&3
-      echo "(`linkhome $owner` グループからの検索)" | html p
+      msg="(`linkhome $owner` グループからの検索)"
     fi
   elif { author=`getpar author`; test -n "$author"; }; then
     atptn=`sqlquotestr $author`
     #kc="$kc${kc:+ AND }author=$atptn"
     authcond="WHERE author=$atptn"
+    search_form_args="author=$author"
     if isuser $author; then
-      echo "(`linkhome $author` さんの書き込みからの検索)" | html p
+      msg="(`linkhome $author` さんの書き込みからの検索)"
     fi
   fi
+  search_form "$search_form_args" "$kwd"
+  echo "「$kwd」による検索結果" $search_form_args| html p
+  echo "$msg" | html p
   # article_s:	id=article-id, key='text', val='TEXT'
   # article:	id=article-id, blogid=blogkd
   # blog:		id=blog-id, author=LeaderAuthor
--- a/s4-funcs.sh	Wed Mar 06 14:15:53 2019 +0900
+++ b/s4-funcs.sh	Wed Mar 13 20:16:56 2019 +0900
@@ -1639,6 +1639,8 @@
 }
 
 search_form() {
+  # $1		 = { author=<AUTHOR> | grp=<GROUP> }
+  # $2(optional) = pre-input keywords
   help="(1)空白区切りの単語で本文検索
 (2)@YYYY-MM-DD 日付け(シェルパターン可)で日付け検索
    @2016-0[1-6]  → 2016年1月から6月
@@ -1666,10 +1668,11 @@
       placeholder="このグループからの検索"
       ;;
   esac
+  inikwd="$2"				# no need to htmlescape
   cat<<-EOF
 	<div class="right">
 	<form action="$myname">$auth
-	<input type="text" name="kwd" value="" title="$help"
+	<input type="text" name="kwd" value="$inikwd" title="$help"
 	 placeholder=" $placeholder " width="10" accesskey="k">
 	 ${touchpanel:+<p class="help">$help</p>}
 	<input type="hidden" name="stage" value="searchart">
@@ -1790,7 +1793,7 @@
   . ./s4-blog.sh
 
   tf=$tmpd/title.$$ pf=$tmpd/profile.$$ bf=$tmpd/blogs.$$ sf=$tmpd/search.$$
-  search_form $search_form_args		> $sf
+  search_form "$search_form_args"	> $sf
   echo "$gecos さん"			> $tf
   { echo "<div class=\"noprofimg\">"
     viewtable $formdir/user.def user $1

yatex.org