s4
changeset 352:dd0c70353869
More HELP text for search form. Add search result report.
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 26 Oct 2016 12:25:05 +0859 |
parents | deb4cc74a415 |
children | 240e695ed574 |
files | examples/common/default/default.css s4-blog.sh s4-funcs.sh |
diffstat | 3 files changed, 33 insertions(+), 1 deletions(-) [+] |
line diff
1.1 --- a/examples/common/default/default.css Tue Oct 25 23:00:46 2016 +0859 1.2 +++ b/examples/common/default/default.css Wed Oct 26 12:25:05 2016 +0859 1.3 @@ -221,6 +221,15 @@ 1.4 margin: 1em; padding: 0 0.5ex; padding-left: 18px; 1.5 background: url("../../img/loupe.png") left center no-repeat 1.6 rgba(242,240,240,0.7); 1.7 + position: relative; 1.8 +} 1.9 +div.search div.fr {position: relative;} 1.10 +div.search p.help {display: none;} 1.11 +div.search input:focus + p.help { 1.12 + display: block; background: white; 1.13 + position: absolute; right: 15em; white-space: pre; 1.14 + border: 1px solid #888; border-radius: 1em; padding: 1ex; 1.15 + box-shadow: #555 2px 2px; 1.16 } 1.17 1.18 /*
2.1 --- a/s4-blog.sh Tue Oct 25 23:00:46 2016 +0859 2.2 +++ b/s4-blog.sh Wed Oct 26 12:25:05 2016 +0859 2.3 @@ -490,6 +490,12 @@ 2.4 elif [ x"$k" = x"@week" ]; then 2.5 ctime=`query "SELECT datetime('now', 'localtime', '-7 days');"` 2.6 kc=$kc${kc:+" AND "}"ctime > '${ctime}'" 2.7 + elif [ x"$k" = x"@month" ]; then 2.8 + ctime=`query "SELECT datetime('now', 'localtime', '-1 month');"` 2.9 + kc=$kc${kc:+" AND "}"ctime > '${ctime}'" 2.10 + elif [ x"$k" = x"@year" ]; then 2.11 + ctime=`query "SELECT datetime('now', 'localtime', '-1 year');"` 2.12 + kc=$kc${kc:+" AND "}"ctime > '${ctime}'" 2.13 else 2.14 kc=$kc${kc:+" AND "}"content LIKE '%$k%'" 2.15 fi 2.16 @@ -560,11 +566,20 @@ 2.17 sedopt="s,<TR><TD>\([^<]*\)</TD>,<TR><TD><a\ 2.18 href=\"?replyblog+\1\">VIEW</a></TD>," 2.19 # echo "$sql2" > tmp/sql.out 2.20 + result=$tmpd/result.$$ 2.21 cat<<EOF 2.22 <table class="b searchart"> 2.23 -`sq -header -html $db "$sql2"|sed "$sedopt"` 2.24 +`sq -header -html $db "$sql2"|sed "$sedopt"|tee $result` 2.25 </table> 2.26 EOF 2.27 + if [ -s "$result" ]; then 2.28 + found=`grep "^<TR><TD>" $result | wc -l` 2.29 + found=$((found+0)) 2.30 + one=${found%1} 2.31 + echo "$found match${one:+es} found" 2.32 + else 2.33 + echo orz... 2.34 + fi 2.35 } 2.36 listblog() ( 2.37 # $1={user,group}
3.1 --- a/s4-funcs.sh Tue Oct 25 23:00:46 2016 +0859 3.2 +++ b/s4-funcs.sh Wed Oct 26 12:25:05 2016 +0859 3.3 @@ -38,6 +38,10 @@ 3.4 nl=" 3.5 " 3.6 iconcachekey="profimgcache_S" 3.7 +case "$HTTP_USER_AGENT" in 3.8 + *i[Pp]hone*|*[Aa]ndroid*) touchpanel=1 ;; 3.9 + *) touchpanel="" ;; 3.10 +esac 3.11 . ./s4-cgi.sh 3.12 3.13 : <<EOF 3.14 @@ -1522,6 +1526,9 @@ 3.15 search_form() { 3.16 help="(1)空白区切りの単語で本文検索 3.17 (2)@YYYY-MM-DD 日付け(シェルパターン可)で日付け検索 3.18 + @2016-0[1-6] → 2016年1月から6月 3.19 + @>2016-01 @<2016-02-15 → 2016年1月から2月14日までの期間 3.20 + @week → 最近一週間 3.21 (3)#番号 で記事ID検索 3.22 (1)と(2)は組み合わせOK 3.23 例: @2016-10-0[1-9] 芋煮 3.24 @@ -1542,6 +1549,7 @@ 3.25 <form action="$myname">$auth 3.26 <input type="text" name="kwd" value="" title="$help" 3.27 placeholder=" $placeholder " width="10" accesskey="k"> 3.28 + ${touchpanel:+<p class="help">$help</p>} 3.29 <input type="hidden" name="stage" value="searchart"> 3.30 </form> 3.31 </div>