Mercurial > hgrepos > hgweb.cgi > s4
changeset 509:d34b8f36501c
Progressive search does not restrict author
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Thu, 14 Mar 2019 10:28:42 +0900 |
parents | 944739c3ac5c |
children | 2a70b6c7ffad |
files | s4-blog.sh s4-funcs.sh |
diffstat | 2 files changed, 25 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-blog.sh Wed Mar 13 20:16:56 2019 +0900 +++ b/s4-blog.sh Thu Mar 14 10:28:42 2019 +0900 @@ -830,25 +830,30 @@ msg="" if [ -n "$owner" ]; then cond="where key='owner' and val='$owner'" - search_form_args="author=$owner" if isuser $owner; then - msg="(`linkhome $owner` さんの記録からの検索)" + msg="(`linkhome $owner` さんの記録から)" else linkhome $owner 1>&3 - msg="(`linkhome $owner` グループからの検索)" + 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 - msg="(`linkhome $author` さんの書き込みからの検索)" + msg="(`linkhome $author` さんの書き込みから)" fi fi - search_form "$search_form_args" "$kwd" - echo "「$kwd」による検索結果" $search_form_args| html p - echo "$msg" | html p + bloglist=`getpar bloglist|sed 's/[^0-9,]//g'` + if [ -n "$bloglist" ]; then + blogcond="AND bl.rid IN ($bloglist)" + fi + + sf=`search_form "$search_form_args" "$kwd" | sed '1d;$d'` # rm <div></div> + echo "$sf" | sed -e "/POST SENTENCE/s/.*/__PS__/" -e "/EOF/q" \ + | _m4 -D__PS__="による検索結果$msg" + echo "(上記入力窓で再検索すると下記の掲示板のみに絞って再検索します)" \ + | html p 'class="small"' # article_s: id=article-id, key='text', val='TEXT' # article: id=article-id, blogid=blogkd # blog: id=blog-id, author=LeaderAuthor @@ -889,7 +894,7 @@ substr(content, 0, 78) TEXT FROM ar JOIN bl ON ar.blogid=bl.id -WHERE $kc AND bl.id IN (SELECT id FROM blog_s $cond) +WHERE $kc AND bl.id IN (SELECT id FROM blog_s $cond) $blogcond ORDER by DATE DESC, TITLE, ctime;" sedopt="s,<TR><TD>\([^<]*\)</TD>,<TR><TD><a\ href=\"?replyblog+\1\">VIEW</a></TD>," @@ -904,9 +909,18 @@ found=$((`grep "^<TR><TD>" $result | wc -l` + 0)) # Cast to INT one=${found%1} echo "$found match${one:+es} found" + # <a href="?replyblog+39#12345">VIEW</a> + # -> 39,49,55, -> 39,49,55 + # -> <input type="hidden" name="bloglist" value="39,49,55"> + sed -n "/.*href=.*replyblog\+\([0-9][0-9]*\).*/s//\1/p" "$result" \ + | sort | uniq | tr '\n' ',' \ + | sed -e 's/,$//' \ + -e 's/^/<input type="hidden" name="bloglist" value="/' \ + -e 's/$/">/' else echo orz... fi + echo "$sf" | sed "1,/-- EOF/d" # Close <form> } listblog() ( # $1={user,group}
--- a/s4-funcs.sh Wed Mar 13 20:16:56 2019 +0900 +++ b/s4-funcs.sh Thu Mar 14 10:28:42 2019 +0900 @@ -1674,8 +1674,10 @@ <form action="$myname">$auth <input type="text" name="kwd" value="$inikwd" title="$help" placeholder=" $placeholder " width="10" accesskey="k"> + <!-- POST SENTENCE --> ${touchpanel:+<p class="help">$help</p>} <input type="hidden" name="stage" value="searchart"> + <!-- EOF --> </form> </div> EOF