Mercurial > hgrepos > hgweb.cgi > s4
diff s4-funcs.sh @ 889:5843755e3b30
The beginning of AJAX operations
Frozen/Running can be toggled by ajax button
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Thu, 24 Dec 2020 19:42:58 +0900 |
parents | 7ca1f11ab5e8 |
children | c01b13db3bd3 |
line wrap: on
line diff
--- a/s4-funcs.sh Tue Dec 22 10:58:03 2020 +0900 +++ b/s4-funcs.sh Thu Dec 24 19:42:58 2020 +0900 @@ -2868,10 +2868,18 @@ EOF cond="where a.id in (select id from blog_s where key='owner' and val=$qgrp) order by 稼動状態, ctime desc" colstate="state:稼動状態:frozen=rowclass=凍結" + frzbtn='<button class="toggle-frozen"></button>' DT_CHLD=article:blogid \ DT_QOWNER="$qgrp" \ DT_VIEW=replyblog dumptable html blog \ - "ctime title heading team notify:通知$colmd $colstate" "$cond" + "ctime title heading team notify:通知$colmd $colstate" "$cond" \ + | if [ -n "$iamowner" ] + then + sed -Ee "s,(<TD class=\"稼動状態\">).*(</TD>),\1$frzbtn\2," + else + cat + fi + ## DO not convert to frzbtn when not admin echo "</div> <!-- in showgroupsub -->" getgname="(select gname from grp where rowid=$rowid)" @@ -3724,6 +3732,11 @@ showgroup $grid done } +dt_colhack() { + # FROM: <TD>xxx:yyy</TD> + # TO: <TD class="xxx">yyy</TD> + sed -Ee 's,<TD>([^:<"]+):([^<]*)(</TD>|$),<TD class="\1">\2\3,g' +} dt_rowhack() { # From: <TR> # .... @@ -3737,7 +3750,7 @@ N /<\/TR>/ { s/\n// - s,^<TR>\(.*\)<TD>rowclass=\(.*\)\(</TD></TR>\),<TR class="\2">\1<TD>\2\3, + s,^<TR>\(.*\)<TD\([^>]*\)>rowclass=\(.*\)\(</TD></TR>\),<TR class="\3">\1<TD\2>\3\4, n } $q @@ -3826,6 +3839,11 @@ substr=${substr:-%s} for col in ${3:-`gettbl_s_cols $2`}; do valvar=val + fromtbl=b + if gettblcols "$2" | grep -w "$col" >/dev/null 2>&1; then + # If $col belongs to master table + fromtbl=a; col=${col#a.} + fi case $col in gecos) scols="$scols${scols:+, }${col#}" continue ;; # built-in column name @@ -3836,15 +3854,23 @@ h=${cnd%%=*} v=${cnd#*=} h=`sqlquotestr "$h"` v=`sqlquotestr "$v"` - valvar="CASE val WHEN $h THEN $v END" + if [ x"$fromtbl" = x"b" ]; then + valvar="CASE val WHEN $h THEN $v END" + else + valvar="$h" + fi as=${as%%:*} ;; esac ;; *) as=${col} ;; esac ss=`printf "$substr" "$valvar"` - eav=$eav${eav:+,}" max(case key when '$col' then $ss end) as $as" - scols="$scols${scols:+, }b.$as" + if [ x"$fromtbl" = x"b" ]; then + eav=$eav${eav:+,}" \"$as:\"||coalesce(max(case key when '$col' then $ss end), '') as $as" + else + eav=$eav${eav:+,}" \"$as:\"||$ss as $as" + fi + scols="$scols${scols:+, }${fromtbl}.$as" done #case author when '$user' then a.rowid else '---' end as ID, if [ -n "$DT_SQL" ]; then @@ -3877,7 +3903,7 @@ ## $ddd LINE exists at the end of this function fi printf '.mode list\n.header 0\n' >> $sqlfile - cat<<EOF | sed "s,\(<TR><TD>\)\([1-9][0-9]*\)\(#[0-9a-fxs]*\)*</TD>,\1$elink$dvlink</TD>," | dt_rowhack + cat<<EOF | sed "s,\(<TR><TD>\)\([1-9][0-9]*\)\(#[0-9a-fxs]*\)*</TD>,\1$elink$dvlink</TD>," | dt_colhack | dt_rowhack <div> <!-- for folding by check button (s4-funcs.sh:dumptable()) --> <div class="dumptable"> <table class="b$dt_class">