Mercurial > hgrepos > hgweb.cgi > s4
changeset 331:1a60dfc56bb0
Search form in other user's home restrict author to that one.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Fri, 21 Oct 2016 18:53:46 +0859 |
parents | 37fd6d9d5d9b |
children | 9dc6f9e60f6a |
files | s4-blog.sh s4-funcs.sh |
diffstat | 2 files changed, 27 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-blog.sh Fri Oct 21 18:14:10 2016 +0859 +++ b/s4-blog.sh Fri Oct 21 18:53:46 2016 +0859 @@ -229,7 +229,7 @@ #err "usecache=$usecache `ls -l $outfile`" #err tm=$tm #err tsfile=$tsfile=`cat $tsfile` - if [ -s $outfile ] && # $outfile should be > 0 + if [ -s "$outfile" ] && # $outfile should be > 0 { [ "$usecache" ] || # And usecache flag is true, or... { [ -s "$tsfile" ] && [ x"`cat $tsfile`" = x"$tm" ] };}; then @@ -470,7 +470,7 @@ ctime=${k#@} # Not sure GROUP BY a.blogid is comfortable for searchers...? kc=$kc${kc:+" AND "}"s.ctime GLOB '${ctime}*'" - ##### kwdgrp=" GROUP BY a.blogid" + ##### kwdgrp=" GROUP BY a.blogid" ## Add this to lessen results elif [ x"$k" = x"@today" -o x"$k" = x"@今日" ]; then ctime=`date +%F` kc=$kc${kc:+" AND "}"s.ctime GLOB '${ctime}*'" @@ -491,13 +491,19 @@ linkhome $owner 1>&3 echo "(`linkhome $owner` グループからの検索)" | html p fi + elif { author=`getpar author`; test -n "$author"; }; then + atptn=`sqlquotestr $author` + kc="$kc${kc:+ AND }author=$atptn" + if isuser $author; then + echo "(`linkhome $author` さんの書き込みからの検索)" | html p + fi fi # article_s: id=article-id, key='text', val='TEXT' # article: id=article-id, blogid=blogkd # blog: id=blog-id, author=LeaderAuthor # blog_s: id=blog-id, key='title', val='BLOG-TITLE' # WANT: blog-ROWid,article-id,val(TEXT) - sql="`sql4readableblogs` -- Extract user-readable blogs + sql="`sql4readableblogs` -- Extract user-readable blogs SELECT b.rid||'#'||x.id as '', b.title as TITLE, substr(x.ctime, 0, 11) as DATE,
--- a/s4-funcs.sh Fri Oct 21 18:14:10 2016 +0859 +++ b/s4-funcs.sh Fri Oct 21 18:53:46 2016 +0859 @@ -1490,11 +1490,22 @@ (1)と(2)は組み合わせOK 例: @2016-10-0[1-9] 芋煮 → 2016年10月上旬でキーワード「芋煮」を含む記事検索" + auth="" + placeholder="全記事からの検索" + case "$1" in + author=*) + a=`echo "${1#author=}"|htmlescape` + g=`gecos ${1#author=}` + auth="<input type=\"hidden\" name=\"author\" value=\"$a\">" + placeholder="このユーザの書込検索" + help="★★ $g さんの書き込みから検索します$nl$help" + ;; + esac cat<<-EOF <div class="fr"> - <form action="$myname"> + <form action="$myname">$auth <input type="text" name="kwd" value="" title="$help" - placeholder=" 全記事からの検索 " width="10"> + placeholder=" $placeholder " width="10"> <input type="hidden" name="stage" value="searchart"> </form> </div> @@ -1582,6 +1593,7 @@ err SH:gecos=$gecos GF_VIEWONLY=1 cond="gname in (select gname from grp_mem where user='$uname')" + search_form_args="" if [ x"$user" = x"$uname" ]; then conflink="<a href=\"?userconf\">プロフィールの編集</a> / <a href=\"?blog\">新規話題の作成</a>" @@ -1596,12 +1608,14 @@ conflink="$conflink / <a href=\"?lsmyfile\">過去の提出ファイル</a>" fi + else + search_form_args="author=$uname" fi . ./s4-blog.sh tf=$tmpd/title.$$ pf=$tmpd/profile.$$ bf=$tmpd/blogs.$$ sf=$tmpd/search.$$ - search_form > $sf - echo "$gecos さん" > $tf + search_form $search_form_args > $sf + echo "$gecos さん" > $tf { echo "<div class=\"noprofimg\">" viewtable $formdir/user.def user $1 echo "</div>"