# HG changeset patch # User HIROSE Yuuji # Date 1552526922 -32400 # Node ID d34b8f36501c705fd5b2cf4eb107ba2b4fc6631d # Parent 944739c3ac5c29f80750be122aca1fddbd2b4476 Progressive search does not restrict author diff -r 944739c3ac5c -r d34b8f36501c s4-blog.sh --- 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
+ 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,\([^<]*\),VIEW," @@ -904,9 +909,18 @@ found=$((`grep "^" $result | wc -l` + 0)) # Cast to INT one=${found%1} echo "$found match${one:+es} found" + # VIEW + # -> 39,49,55, -> 39,49,55 + # -> + sed -n "/.*href=.*replyblog\+\([0-9][0-9]*\).*/s//\1/p" "$result" \ + | sort | uniq | tr '\n' ',' \ + | sed -e 's/,$//' \ + -e 's/^//' else echo orz... fi + echo "$sf" | sed "1,/-- EOF/d" # Close
} listblog() ( # $1={user,group} diff -r 944739c3ac5c -r d34b8f36501c s4-funcs.sh --- 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 @@ $auth + ${touchpanel:+

$help

} +
EOF