changeset 246:de0a9f5cc1cf

Listing users in a group couldn't show "next-30", fixed
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 12 Jul 2016 10:04:34 +0859
parents b915381669d6
children d0984b8e9f4c
files s4-funcs.sh
diffstat 1 files changed, 26 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Sun Jul 10 23:25:49 2016 +0859
+++ b/s4-funcs.sh	Tue Jul 12 10:04:34 2016 +0859
@@ -43,6 +43,12 @@
     レポート提出管理
 ひとつのarticleをheadingにして新規ツリーを作成、あるといいかも。
 
+[2016]
+7/12	根本への反省
+	* cgi自身の $1, $2 での切り替えでなく、CGI変数での受け渡しにすべき。
+	  arg1/arg2/arg3 的に $1 に / 区切りでつけた方がよかったかな。
+
+[以下2015]
 8/4	○グループに承認加入モードを追加
 	○グループに参加していない場合は grpaction できない
 	Web
@@ -1612,10 +1618,10 @@
   echo "<a href=\"$href\"><img title=\"$title\" src=\"$src\">$@</a>"
 )
 listentry() (
-  # $1=user/group $2=SearchKeyword $3=condition(if any)
+  # $1=user/group $2=SearchKeyword $3=condition(if any) $4=grprowid(if in grp)
   # Referring variable $iamowner=$grp to attach owner-request links
 err listentry: \$1=$1 \$2=$2 \$3=$3
-  cond=''
+  cond='' hiddens=''
   offset=`getpar offset`
   offset=${offset%%[!0-9]*}
   offset=$((offset + 0))	# change to numeric forcibly
@@ -1625,7 +1631,8 @@
   if [ x"$1" = x"user" ]; then
     hrb="$myname?home"
     deficon=person-default.png
-    entity="ユーザ" tbl=user link=rowid nm=name stage=mems
+    entity="ユーザ" tbl=user link=rowid nm=name # stage=mems
+    [ -n "$4" ] && hiddens=`cgi_hidden grid $4`
     gcs=gecos
   else				# if group
     hrb="$myname?grp"
@@ -1688,6 +1695,9 @@
 EOF
     echo '</div>'
   fi
+  hiddens="$hiddens
+	`cgi_hidden kwd \"$kwd\"`
+	`cgi_hidden stage \"$stage\"`"
   cat<<EOF
   <p>${total}件中の$((offset+1))件めから${kwd:+" - 検索語: $kwd"}</p>
 EOF
@@ -1696,8 +1706,7 @@
     cat<<EOF
 <div class="right clear"><form action="$myname" method="POST">
 `cgi_submit 次の${limit}件`
-`cgi_hidden kwd "$kwd"`
-`cgi_hidden stage "$stage"`
+$hiddens
 `cgi_hidden offset $((offset + limit))`</form></div>
 EOF
 	   )
@@ -1707,8 +1716,7 @@
     cat<<EOF
 <form action="$myname" method="POST">
 `cgi_submit 前の${limit}件`
-`cgi_hidden stage "$stage"`
-`cgi_hidden kwd "$kwd"`
+$hiddens
 `cgi_hidden offset $((offset - limit))`</form>
 EOF
     )
@@ -1717,7 +1725,6 @@
   echo $pnbtn
 
   err ListEntry: `echo "$sql"\;`
-
   query "$sql limit $limit ${offset:+offset $offset};" \
       | while IFS='|' read id lnk name gecos tag ownerp; do
 err name=$name owner=$ownerp lnk=$lnk
@@ -1765,12 +1772,19 @@
 #     fi
 #     par2table $formdir/grp.def
 #   fi
-  grp=`getgroupbyid $1`
+  if [ -z "$1" ]; then
+    grid=`getpar grid`
+    grid=${grid%%[!0-9]*}
+    [ -n "$grid" ] && grp=`getgroupbyid $grid`
+  else
+    grid=$1
+  fi
+  grp=`getgroupbyid $grid`
 err showgroup2: grp=$grp qgrp="[$(sqlquote $grp)]"
   if isgroup "$grp"; then
     tf=$tmpd/title.$$
     echo "グループ $grp" > $tf
-    showgroupsub $formdir/grp.def "$1" | \
+    showgroupsub $formdir/grp.def "$grid" | \
 	_m4 -D_TITLE_="spaste(\`$tf')" \
 	    -D_FORM_="syscmd(\`cat')" \
 	    -D_DUMPTABLE_="" \
@@ -1859,9 +1873,9 @@
 	 DT_VIEW=replyblog dumptable html blog 'ctime team title heading' "$cond"
 
   getgname="(select gname from grp where rowid=$rowid)"
-  c="group by b.name having b.name in (select user from grp_mem where gname=$getgname)"
+  c="group by a.name having a.name in (select user from grp_mem where gname=$getgname)"
   cm="?commission+$rowid"
-  thumbxy=50x50 listmember "" "$c" \
+  thumbxy=50x50 listmember "" "$c" "$rowid" \
       |sed -e "s|\(<br>\),not=\(.*\)|\1|"	# 間違って押しやすい
   # team list
   hexteams=`hexteams "$grp"`

yatex.org