s4

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 diff
     1.1 --- a/s4-blog.sh	Wed Mar 06 14:15:53 2019 +0900
     1.2 +++ b/s4-blog.sh	Wed Mar 13 20:16:56 2019 +0900
     1.3 @@ -827,23 +827,28 @@
     1.4    kwd=`echo "$kwd"|htmlescape`
     1.5    owner=`getpar owner`
     1.6    owner=${owner:-$1}
     1.7 -  echo "「$kwd」による検索結果" | html p
     1.8 +  msg=""
     1.9    if [ -n "$owner" ]; then
    1.10      cond="where key='owner' and val='$owner'"
    1.11 +    search_form_args="author=$owner"
    1.12      if isuser $owner; then
    1.13 -      echo "(`linkhome $owner` さんの記録からの検索)" | html p
    1.14 +      msg="(`linkhome $owner` さんの記録からの検索)"
    1.15      else
    1.16        linkhome $owner 1>&3
    1.17 -      echo "(`linkhome $owner` グループからの検索)" | html p
    1.18 +      msg="(`linkhome $owner` グループからの検索)"
    1.19      fi
    1.20    elif { author=`getpar author`; test -n "$author"; }; then
    1.21      atptn=`sqlquotestr $author`
    1.22      #kc="$kc${kc:+ AND }author=$atptn"
    1.23      authcond="WHERE author=$atptn"
    1.24 +    search_form_args="author=$author"
    1.25      if isuser $author; then
    1.26 -      echo "(`linkhome $author` さんの書き込みからの検索)" | html p
    1.27 +      msg="(`linkhome $author` さんの書き込みからの検索)"
    1.28      fi
    1.29    fi
    1.30 +  search_form "$search_form_args" "$kwd"
    1.31 +  echo "「$kwd」による検索結果" $search_form_args| html p
    1.32 +  echo "$msg" | html p
    1.33    # article_s:	id=article-id, key='text', val='TEXT'
    1.34    # article:	id=article-id, blogid=blogkd
    1.35    # blog:		id=blog-id, author=LeaderAuthor
     2.1 --- a/s4-funcs.sh	Wed Mar 06 14:15:53 2019 +0900
     2.2 +++ b/s4-funcs.sh	Wed Mar 13 20:16:56 2019 +0900
     2.3 @@ -1639,6 +1639,8 @@
     2.4  }
     2.5  
     2.6  search_form() {
     2.7 +  # $1		 = { author=<AUTHOR> | grp=<GROUP> }
     2.8 +  # $2(optional) = pre-input keywords
     2.9    help="(1)空白区切りの単語で本文検索
    2.10  (2)@YYYY-MM-DD 日付け(シェルパターン可)で日付け検索
    2.11     @2016-0[1-6]  → 2016年1月から6月
    2.12 @@ -1666,10 +1668,11 @@
    2.13        placeholder="このグループからの検索"
    2.14        ;;
    2.15    esac
    2.16 +  inikwd="$2"				# no need to htmlescape
    2.17    cat<<-EOF
    2.18  	<div class="right">
    2.19  	<form action="$myname">$auth
    2.20 -	<input type="text" name="kwd" value="" title="$help"
    2.21 +	<input type="text" name="kwd" value="$inikwd" title="$help"
    2.22  	 placeholder=" $placeholder " width="10" accesskey="k">
    2.23  	 ${touchpanel:+<p class="help">$help</p>}
    2.24  	<input type="hidden" name="stage" value="searchart">
    2.25 @@ -1790,7 +1793,7 @@
    2.26    . ./s4-blog.sh
    2.27  
    2.28    tf=$tmpd/title.$$ pf=$tmpd/profile.$$ bf=$tmpd/blogs.$$ sf=$tmpd/search.$$
    2.29 -  search_form $search_form_args		> $sf
    2.30 +  search_form "$search_form_args"	> $sf
    2.31    echo "$gecos さん"			> $tf
    2.32    { echo "<div class=\"noprofimg\">"
    2.33      viewtable $formdir/user.def user $1