comparison s4-blog.sh @ 1040:78e904f9be34 draft

Add Filtering by TEAM
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 21 Apr 2024 11:30:46 +0900
parents 68a01c699acb
children 99ba706d5fdb
comparison
equal deleted inserted replaced
1039:68a01c699acb 1040:78e904f9be34
162 # blog: id 162 # blog: id
163 # blog_s: title,ctime,heading 163 # blog_s: title,ctime,heading
164 # blog_m: *article 164 # blog_m: *article
165 165
166 blogowner=`getvalbyid blog owner "$2"` 166 blogowner=`getvalbyid blog owner "$2"`
167 isgroup "$blogowner" && isgroup=true || isgroup=false 167 if isgroup "$blogowner"; then
168 isgroup=true; qgrp=`sqlquote "$blogowner"`
169 else
170 isgroup=false
171 fi
172
168 isgrpadmin=false 173 isgrpadmin=false
169 isgrpowner "$user" "$blogowner" && isgrpadmin=true 174 isgrpowner "$user" "$blogowner" && isgrpadmin=true
170 [ x"$user" = x"$blogowner" ] && isgrpadmin=true 175 [ x"$user" = x"$blogowner" ] && isgrpadmin=true
171 176
172 # 2015-10-05 check readable 177 # 2015-10-05 check readable
195 esac 200 esac
196 case $blog_mode in 201 case $blog_mode in
197 *quiz*|*close*|"") # When blog_mode is "", fallback to quiz/close 202 *quiz*|*close*|"") # When blog_mode is "", fallback to quiz/close
198 f_exclusive=1 203 f_exclusive=1
199 if $isgroup; then 204 if $isgroup; then
200 qgrp=`sqlquote "$blogowner"`
201 if $isgrpadmin; then 205 if $isgrpadmin; then
202 F_UNREADABLE="''" 206 F_UNREADABLE="''"
203 else 207 else
204 if [ x"$blog_mode" = x"quiz" ]; then 208 if [ x"$blog_mode" = x"quiz" ]; then
205 F_UNREADABLE="CASE 209 F_UNREADABLE="CASE
276 esac 280 esac
277 fi 281 fi
278 hidebtn='<button type="button" id="hideauth" accesskey="a" title="Shortcut: A 282 hidebtn='<button type="button" id="hideauth" accesskey="a" title="Shortcut: A
279 Hide/Show Author - Useful for summary printing 283 Hide/Show Author - Useful for summary printing
280 OFFにするとまとめ印刷に便利。">著者OFF</button>' 284 OFFにするとまとめ印刷に便利。">著者OFF</button>'
281 href4="${blog_math:+<span id=\"mathjax\">Math</span>} $hidebtn <a href=\"#bottom\" accesskey=\"b\" title=\"Shortcut: B${nl}to the Bottom\"> 末尾へ</a>" 285 href4="${blog_math:+<span id=\"mathjax\">Math</span>} $hidebtn <a href=\"#bottom\" accesskey=\"b\" id=\"tailbtn\" title=\"Shortcut: B${nl}to the Bottom\"> 末尾へ</a>"
282 $isgrpadmin && 286 $isgrpadmin &&
283 href5="<a href=\"?blogseen+$rowid\" accesskey=\"s\" title=\"Shortcut: S${nl}State of Accesses\"> 読刻</a>" 287 href5="<a href=\"?blogseen+$rowid\" accesskey=\"s\" title=\"Shortcut: S${nl}State of Accesses\"> 読刻</a>"
284 quizmodefile=$tmpd/quiz; rm -f "$quizmodefile" # XXX: Global state 288 quizmodefile=$tmpd/quiz; rm -f "$quizmodefile" # XXX: Global state
285 midfile=$tmpd/midfile 289 midfile=$tmpd/midfile
286 290
443 n=0 447 n=0
444 omitline=$td/omitline 448 omitline=$td/omitline
445 #CAT="tail -n $nlimit" 449 #CAT="tail -n $nlimit"
446 CAT=cat 450 CAT=cat
447 limitedmsg="<span class=\"warn\">※最新${nlimit}件のみの表示※</span>" 451 limitedmsg="<span class=\"warn\">※最新${nlimit}件のみの表示※</span>"
448 showalllink="<a title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>" 452 showalllink="<a id=\"showall\" title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>"
449 cat<<-EOF > $omitline 453 cat<<-EOF > $omitline
450 <tr class="warn"> 454 <tr class="warn">
451 <th>:<br>$limitedmsg<br>($((narts-$nlimit-1))件省略)<br>:</th> 455 <th>:<br>$limitedmsg<br>($((narts-$nlimit-1))件省略)<br>:</th>
452 <th>$showalllink</th> 456 <th>$showalllink</th>
453 EOF 457 EOF
647 <button id="reload">最新取得</button></a> / <a 651 <button id="reload">最新取得</button></a> / <a
648 href="#title" id="bottom" accesskey="t" 652 href="#title" id="bottom" accesskey="t"
649 title="Shortcut: T${nl}to the Top">先頭へ</a> 653 title="Shortcut: T${nl}to the Top">先頭へ</a>
650 ${showalllink:+/ `echo $showalllink|sed 's/n:all/&\#bottom/'`$limitedmsg}</p> 654 ${showalllink:+/ `echo $showalllink|sed 's/n:all/&\#bottom/'`$limitedmsg}</p>
651 EOF 655 EOF
656 # Put team list
657 if $usejson && $isgrp; then
658 echo '<table id="team4filter" style="display: none;">'
659 query<<-EOF
660 .mode html
661 SELECT val, json_group_array(b.rowid) mems
662 FROM grp_mem_m a LEFT JOIN user b ON a.user=b.name
663 WHERE gname = $qgrp AND key='team'
664 GROUP BY val;
665 .mode list
666 EOF
667 echo '</table>'
668 fi
652 $iswritable && cat<<-EOF 669 $iswritable && cat<<-EOF
653 <div class="blogcomment"> 670 <div class="blogcomment">
654 <input type="hidden" name="blogid" value="$id"> 671 <input type="hidden" name="blogid" value="$id">
655 <input type="hidden" name="id" value="`genserial`"> 672 <input type="hidden" name="id" value="`genserial`">
656 <input type="hidden" name="stage" value="replyblog"> 673 <input type="hidden" name="stage" value="replyblog">

yatex.org