s4
changeset 291:1df64f0490ca
`|col|col|...' like table conversion enabled
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Tue, 23 Aug 2016 09:14:42 +0859 |
parents | 8a1012410035 |
children | 3866eb7c2a23 |
files | examples/common/default/default.css s4-blog.sh s4-funcs.sh |
diffstat | 3 files changed, 55 insertions(+), 24 deletions(-) [+] |
line diff
1.1 --- a/examples/common/default/default.css Mon Aug 22 16:05:58 2016 +0859 1.2 +++ b/examples/common/default/default.css Tue Aug 23 09:14:42 2016 +0859 1.3 @@ -80,7 +80,7 @@ 1.4 white-space: pre-wrap; 1.5 } 1.6 table.blog_replies+p.update_link {margin-top: 0; margin-bottom: 14em;} 1.7 -.blog_replies td:nth-child(2) { 1.8 +.blog_replies td.repl { 1.9 vertical-align: top; min-width: 30em; height: 3em; 1.10 max-width: 50em; 1.11 } 1.12 @@ -91,6 +91,15 @@ 1.13 .blog_replies td.new { /* New Article from last visit */ 1.14 background: white 1.15 } 1.16 +table.mini, table.mini tr, table.mini th, table.mini td { 1.17 + margin: 0; border-width: 0; 1.18 + border-collapse: collapse; 1.19 + vertical-align: top; width: auto; height: 1em; 1.20 +} 1.21 +table.mini th {text-align: justify;} 1.22 +table.mini td, table.mini th {padding: 1px 1ex;} 1.23 +table.mini {margin-left: 1em; border-left: 2px solid #686;} 1.24 + 1.25 p.profimg {float: left; max-width: 400px; max-height: 400px; 1.26 overflow: hidden; margin-right: 1em; 1.27 padding: 0; border: white 1px solid; box-shadow: 2px 3px 4px
2.1 --- a/s4-blog.sh Mon Aug 22 16:05:58 2016 +0859 2.2 +++ b/s4-blog.sh Tue Aug 23 09:14:42 2016 +0859 2.3 @@ -68,6 +68,7 @@ 2.4 # fi 2.5 # fi 2.6 td=`getcachedir "article/$2"` 2.7 + [ -d "$td" ] || mkdir -p $td 2.8 tbl=${1%%[!A-Z0-9a-z_]*} rowid=${2%%[!A-Z0-9a-z_]*} 2.9 err rowid=$rowid, '$2'=$2 2.10 ts=${tbl}_s tm=${tbl}_m 2.11 @@ -184,14 +185,15 @@ 2.12 while IFS='|' read id edit notify uid uname aid tm new hte imgids; do 2.13 nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\" 2.14 name=\"notifyto\" value=\"$uid\">返信通知送信</label>" 2.15 - cat<<EOF | 2.16 + cat<<EOF 2.17 <tr id="$id"> 2.18 <td${new:+ class="new"}>${edit:+<a href="$elink+$edit">編集</a> }#$aid 2.19 <a href="$hlink+$uid">$uname</a> 2.20 $tm 2.21 -${notify:+$nt}</td><td id="$aid">`echo "$hte"|unhexize|htmlescape` 2.22 +${notify:+$nt}</td> 2.23 EOF 2.24 - hreflink 2.25 + echo -n "<td id=\"$aid\" class=\"repl\">" 2.26 + echo "$hte"|unhexize|htmlescape|hreflink|minitbl 2.27 usecache='' tsfile=$td/$id.stamp 2.28 for i in $imgids; do 2.29 mrid=${i%%:*}; i=${i#*:}; sz=`size_h ${i%%:*}` 2.30 @@ -231,7 +233,7 @@ 2.31 | sed -e 's/\(..\)/%\1/g' \ 2.32 -e "s|^|<a href=\"$catlink+$mrid\"><img src=\"data:image/$fmt,|" \ 2.33 -e "s|\$|\">$fnb</a>|" 2.34 - [ -d $td ] || mkdir -p "$td" 2.35 + # [ -d $td ] || mkdir -p "$td" 2.36 echo $tm > $tsfile 2.37 fi 2.38 ;;
3.1 --- a/s4-funcs.sh Mon Aug 22 16:05:58 2016 +0859 3.2 +++ b/s4-funcs.sh Tue Aug 23 09:14:42 2016 +0859 3.3 @@ -457,6 +457,30 @@ 3.4 -e "s|^href=\($_hrefptn\)|<a &>\1</a>|" \ 3.5 -e "s|^iframe=\($_hrefptn\)|<iframe src=\"\1\"></iframe>|" 3.6 } 3.7 +minitbl() { 3.8 + sed -n ' 3.9 + /^|[^|]/ {; # If the line begin with "|" 3.10 + s,|$,,; # Remove trailing "|" first 3.11 + s,|\* *\([^|]*\) *,<th>\1</th>,g; # "|*..." to "<th>...</th>" 3.12 + s,| *\([^|]*\) *,<td>\1</td>,g; # "|..." to "<td>...</td>" 3.13 + s,^,<tr>,; s,$,</tr>,; # Enclose with "<tr>" and "</tr>" 3.14 + H; # Concat this line to HoldSpace 3.15 + s/.*//; # Delete PatternSpace for finalization 3.16 + $ b cont 3.17 + d; # If in final line, output the rest, else jump to next turn 3.18 + } 3.19 + :cont 3.20 + x; # For non-"|" lines, check HoldSpace 3.21 + /^./ {; # If HoldSpace has "|" table elements 3.22 + s|^|<table class="mini">|; # Enclose whole elements like this: 3.23 + # s|$|</table>|; # <table class="mini">..\n..</table> 3.24 + p; # Print whole "table" element 3.25 + s/.*//; # Erase all when done. 3.26 + x; s|^|</table>|; x; # Preppend /table to the next line 3.27 + } 3.28 + x; # Back to the newest line 3.29 + p; # Print rest' 3.30 +} 3.31 acclog() ( 3.32 # $1=table, $2=rowid 3.33 n=${2%%[!0-9]*} # Remove non-digit chars from $2(should be rowid) 3.34 @@ -2094,32 +2118,27 @@ 3.35 ORDER by a.gecos;" 3.36 err grpaction: `echo "$sql"` 3.37 tf=$tmpd/title.$$ 3.38 - echo "グループ[<a href=\"?grp+$grid\">$grp<a>]参加メンバーに対する操作" > $tf 3.39 - cmmsg="<div class=\"fold\"> 3.40 -`cgi_radio rm commission id=\"cmadmin\"`<label 3.41 - for=\"cmadmin\">下でチェックした人にグループ管理者委任</label> 3.42 + echo "グループ[<a href=\"?grp+$grid\">$grp</a>]参加メンバーに対する操作" > $tf 3.43 + cmmsg="`cgi_radio rm commission id=\"cmadmin\"`<label 3.44 + for=\"cmadmin\">グループ管理者委任</label> 3.45 <div><p>このグループでの全権を付与します。信頼できる人に託してください。 3.46 -</p></div></div>" 3.47 - excmsg="<div class=\"fold\"> 3.48 -`cgi_radio rm yes `下でチェックした人のグループ登録解除 3.49 -<div> 3.50 -本当に消します! `cgi_checkbox confirm yes` 確認 3.51 +</p></div>" 3.52 + excmsg="`cgi_radio rm yes id=\"conf\"`<label 3.53 + for=\"conf\">グループ登録解除</label> 3.54 +<div>本当に消します! `cgi_checkbox confirm yes` 確認 3.55 <p>この操作による通知は本人に行きません。 3.56 あらかじめ通知するか、登録解除してよい状況かしっかり確認してください。</p> 3.57 -</div> 3.58 </div>" 3.59 # Get team list to which current user belongs into $hexteams 3.60 myhexteams=$(hexteams "$grp" "$user") 3.61 allhexteams=$(hexteams "$grp") 3.62 if [ -n "$myhexteams" ]; then 3.63 - rmteammsg="<div class=\"fold\"> 3.64 -`cgi_radio rm rmteam 'id=\"cmrmteam\"'`<label 3.65 + rmteammsg="`cgi_radio rm rmteam 'id=\"cmrmteam\"'`<label 3.66 for=\"cmrmteam\">下でチェックした人からチーム属性を除去する</label> 3.67 <div>チーム属性:`cgi_select_h rmteam \"2d2d2d\" $myhexteams` 3.68 を除去します: `cgi_checkbox teamconfirm yes` 確認 3.69 <p>この操作による通知は本人に行きません。 3.70 あらかじめ通知するか、登録解除してよい状況かしっかり確認してください。</p> 3.71 -</div> 3.72 </div><!-- end of $rmteammsg --> 3.73 " 3.74 fi 3.75 @@ -2136,21 +2155,22 @@ 3.76 -D_SUBTITLE_="チェック後操作ボタン" \ 3.77 -D_FORM_="syscmd(cat)" -D_DUMPTABLE_="" \ 3.78 $layout/form+dump.m4.html 3.79 -<div class="fold"> 3.80 +<p>下でチェックした人を対象として:</p> 3.81 +<div class="foldtabs"> 3.82 `cgi_radio rm addteam 'id="cmteam"'`<label 3.83 -for="cmteam">下でチェックした人に同じチーム属性を与える</label> 3.84 +for="cmteam">同じチーム属性を付与</label> 3.85 <div>チーム名:`cgi_text team "" 'id="inteam" list="teams"'` 3.86 `cgi_datalist_h teams $allhexteams` 3.87 -</div></div> 3.88 +</div> 3.89 ${rmteammsg} 3.90 -<div class="fold"> 3.91 `cgi_radio rm send id="sendmsg"`<label 3.92 - for="sendmsg">下でチェックした人にメッセージを送信する</label> 3.93 + for="sendmsg">メッセージ送信</label> 3.94 <div> 3.95 `cgi_textarea text "" cols=40` 3.96 </div> 3.97 +${isowner:+$cmmsg$excmsg} 3.98 +`cgi_radio rm close id="x"`<label for="x">×</label> 3.99 </div> 3.100 -${isowner:+$cmmsg$excmsg} 3.101 <h4>$grp 参加者一覧</h4> 3.102 <table class="td2r"> 3.103 `sq $db -header -html "$sql"`