s4
changeset 388:4f6b63c25ab8
User/Group listing made fast by using imgsrc_cache()
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 28 Nov 2016 18:30:54 +0859 |
parents | 2c928bb47c90 |
children | 3074b635687a |
files | examples/common/default/default.css s4-funcs.sh |
diffstat | 2 files changed, 27 insertions(+), 8 deletions(-) [+] |
line diff
1.1 --- a/examples/common/default/default.css Mon Nov 28 12:08:51 2016 +0859 1.2 +++ b/examples/common/default/default.css Mon Nov 28 18:30:54 2016 +0859 1.3 @@ -221,6 +221,7 @@ 1.4 div.iconlist p._test {background: #ffb6c1;} /* light pink */ 1.5 div.xy120x120 {min-width: 120px; min-height: 140px;} 1.6 div.xy96x96 {min-width: 96px; min-height: 116px;} 1.7 +div.xy96x96 img {max-width: 96px;} 1.8 div.xy50x50 {min-width: 50px; min-height: 70px;} 1.9 div.moderated {background: rgba(255, 215, 0, 0.3);} /* gold */ 1.10 body.moderated {background: #fffec4;} /* #faed8a */
2.1 --- a/s4-funcs.sh Mon Nov 28 12:08:51 2016 +0859 2.2 +++ b/s4-funcs.sh Mon Nov 28 18:30:54 2016 +0859 2.3 @@ -631,10 +631,10 @@ 2.4 pk=`gettblpkey $1` 2.5 key=`query "select $pk from $1 where rowid=$3;"` 2.6 getkey="(select $pk from $1 where rowid=$3)" 2.7 + td=${4:-$tmpd} 2.8 + [ -d $td ] || mkdir -p $td 2.9 ### err "select $pk from $1 where rowid=$3" - key=$key '$4(tmp)'=$4 2.10 for kt in s m; do 2.11 - td=${4:-$tmpd} 2.12 - [ -d $td ] || mkdir -p $td 2.13 t=${1}_$kt 2.14 for c in `gettbl_${kt}_cols $1`; do 2.15 vcount=1 # count(val) 2.16 @@ -1929,6 +1929,9 @@ 2.17 getgrp="(select gname from grp where rowid=${rowid:--1})" 2.18 sql="select a.rowid, a.$link, 2.19 coalesce(b.$gcs, a.$nm) as nick, 2.20 + quote(a.$nm) as qname, 2.21 + (SELECT val FROM ${tbl}_s 2.22 + WHERE $nm=a.$nm AND key='$iconcachekey') icon, 2.23 coalesce(b.gecos, a.$nm) /* If group, concat (Nusers) */ 2.24 || case when a.$nm in (select gname from grp) 2.25 then printf('(%d名)', 2.26 @@ -2011,20 +2014,35 @@ 2.27 2.28 ## err ListEntry: `echo "$sql"\;` 2.29 query "$sql limit $limit ${offset:+offset $offset};" \ 2.30 - | while IFS='|' read id lnk name gecos tag ownerp type; do 2.31 + | while IFS='|' read id lnk name qname icon gecos tag ownerp type; do 2.32 err name=$name owner=$ownerp lnk=$lnk 2.33 err newlnk=$lnk regmode=$regmode 2.34 icondir=$dir/$id 2.35 - files=`getvalbyid $tbl profimg $id $icondir` 2.36 # Pick up only last icon 2.37 echo "<div class=\"iconlist xy$thumbxy $type\"> 2.38 <p class=\"tag _$tag\">$tag</p>" \ 2.39 | _m4 $tagconv 2.40 - if [ -n "$files" ]; then 2.41 - icon=`echo "$files"|tail -1` 2.42 - iconhref2 "$icondir/$icon" "$hrb+$lnk" "$gecos" 2.43 + if [ -z "NOSPEEDUP" ]; then 2.44 + files=`getvalbyid $tbl profimg $id $icondir` 2.45 + if [ -n "$files" ]; then 2.46 + icon=`echo "$files"|tail -1` 2.47 + iconhref2 "$icondir/$icon" "$hrb+$lnk" "$gecos" 2.48 + else 2.49 + iconhref "$dir/$deficon" "$hrb+$lnk" "$gecos" 2.50 + fi 2.51 + elif [ -n "$icon" -a -s "$icon" ]; then 2.52 + iconhref2 "./$icon" "$hrb+$lnk" "$gecos" 2.53 else 2.54 - iconhref "$dir/$deficon" "$hrb+$lnk" "$gecos" 2.55 + cond="$nm=$qname" 2.56 + # err imgsrc_cache "$dir/list" ${tbl}_m "$cond" S 2.57 + # err query "SELECT type FROM ${tbl}_m $cond LIMIT 1;" 2.58 + img=`query "SELECT type FROM ${tbl}_m WHERE $cond AND key='profimg' LIMIT 1;"` 2.59 + # err "img=[$img]" 2.60 + if [ -n "$img" ]; then 2.61 + imgsrc_cache "$dir/list" ${tbl}_m "$nm=$qname" S 2.62 + else 2.63 + iconhref2 "$dir/$deficon" "$hrb+$lnk" "$gecos" 2.64 + fi 2.65 fi 2.66 echo "<br>$name${ownerp:+<br>$ownerp}" 2.67 echo "</div>"