Mercurial > hgrepos > hgweb.cgi > s4
changeset 263:ebd4af16c493
Old blog dumping code based on sq -html, removed entirely
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 20 Jul 2016 21:50:06 +0859 |
parents | f7939f4297d4 |
children | 9131c7e09112 |
files | s4-blog.sh |
diffstat | 1 files changed, 35 insertions(+), 71 deletions(-) [+] |
line wrap: on
line diff
--- a/s4-blog.sh Wed Jul 20 21:14:38 2016 +0859 +++ b/s4-blog.sh Wed Jul 20 21:50:06 2016 +0859 @@ -140,45 +140,10 @@ lkhome="<a href=\"$myname?home" lke='">' lkedit="<a href=\"$myname?editart" - if false; then - sq -html $db<<EOF | -WITH a_s AS ( - SELECT id, - max(CASE key WHEN 'ctime' THEN val END) TIME, - max(CASE key WHEN 'text' THEN val END) TEXT - FROM article_s - GROUP by id -) -SELECT 'id:'||a.id, - CASE author - WHEN '$user' THEN 'ed:'||a.rowid||':'||$rowid - ELSE 'e0:' - END edit, - 'at:'||(SELECT rowid FROM user WHERE name=author)||':' - ||coalesce((SELECT val FROM user_s - WHERE name=author AND key='gecos'), - author), - 'ti:'||s.TIME, - 'te:'||s.TEXT, - 'im:'||(SELECT group_concat(hex(bin) -FROM (select rowid,id,author from article where blogid in - (select id from blog where rowid=$rowid)) a - LEFT JOIN - a_s s - ON a.id=s.id; -EOF - sed -e "s|^<TR><TD>id:\(.*\)</TD>|<TR id=\"\1\"><TD>|" \ - -e "/^<TR/N" -e 's/\n//' \ - -e "s|<TD>ed:\([0-9]*\):\(.*\)</TD>|$lkedit+\1+\2${lke}編集</a>|" \ - -e "s|<TD>e0:</TD>||" \ - -e "s|^<TD>at:\([0-9]*\):\(.*\)</TD>|$lkhome+\1$lke\2</a>|" \ - -e "s|^<TD>ti:\(.*\)</TD>|\1</TD>|" \ - -e "s|^<TD>te:\(.*\)|<TD>\1|" - else - hlink="$myname?home" elink="$myname?editart" - catlink="$myname?showattc+article_m" - deficon="img/file-icon.png" - sq $db<<EOF | + hlink="$myname?home" elink="$myname?editart" + catlink="$myname?showattc+article_m" + deficon="img/file-icon.png" + sq $db<<EOF | WITH a_s AS ( SELECT id, max(CASE key WHEN 'ctime' THEN val END) TIME, @@ -212,46 +177,45 @@ a_s s ON a.id=s.id; EOF - while IFS='|' read id edit notify uid uname aid tm hte imgids; do - nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\" + while IFS='|' read id edit notify uid uname aid tm hte imgids; do + nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\" name=\"notifyto\" value=\"$uid\">返信通知送信</label>" - cat<<EOF | + cat<<EOF | <tr id="$id"> <td>${edit:+<a href="$elink+$edit">編集</a> }#$aid <a href="$hlink+$uid">$uname</a> $tm ${notify:+$nt}</td><td>`echo "$hte"|unhexize|htmlescape` EOF - hreflink - for i in $imgids; do - mrid=${i%%:*}; i=${i#*:}; sz=`size_h ${i%%:*}` - fn=`echo "${i#*:}"|unhexize` - fnb=$fn"(${sz})" - # echo r=$mrid fn=$fn - case "$fn" in - *.[Pp][Nn][Gg]|*.[Jj][Pp][Gg]|*.[Jj][Pp][Ee][Gg]|*.[Gg][Ii][Ff]) - # fmt=${fn##*.} # jpg:- is slow...why - case "$fn" in - *.[Pp][Nn][Gg]) fmt=png ;; - *.[Gg][Ii][Ff]) fmt=gif ;; - *) fmt=jpeg ;; - esac - sq $db "SELECT hex(bin) FROM article_m WHERE rowid=$mrid" \ - | unhexize \ - | convert -define ${fmt}:size=100x100 -resize 100x100'>' - ${fmt}:- \ - | hexize \ - | sed -e 's/\(..\)/%\1/g' \ - -e "s|^|<a href=\"$catlink+$mrid\"><img src=\"data:image/$fmt,|" \ - -e "s|\$|\">$fnb</a>|" - ;; - *) - echo "<a href=\"$catlink+$mrid\"><img src=\"$deficon\">$fnb</a>" - ;; - esac - done - echo "</td></tr>" + hreflink + for i in $imgids; do + mrid=${i%%:*}; i=${i#*:}; sz=`size_h ${i%%:*}` + fn=`echo "${i#*:}"|unhexize` + fnb=$fn"(${sz})" + # echo r=$mrid fn=$fn + case "$fn" in + *.[Pp][Nn][Gg]|*.[Jj][Pp][Gg]|*.[Jj][Pp][Ee][Gg]|*.[Gg][Ii][Ff]) + # fmt=${fn##*.} # jpg:- is slow...why + case "$fn" in + *.[Pp][Nn][Gg]) fmt=png ;; + *.[Gg][Ii][Ff]) fmt=gif ;; + *) fmt=jpeg ;; + esac + sq $db "SELECT hex(bin) FROM article_m WHERE rowid=$mrid" \ + | unhexize \ + | convert -define ${fmt}:size=100x100 -resize 100x100'>' - ${fmt}:- \ + | hexize \ + | sed -e 's/\(..\)/%\1/g' \ + -e "s|^|<a href=\"$catlink+$mrid\"><img src=\"data:image/$fmt,|" \ + -e "s|\$|\">$fnb</a>|" + ;; + *) + echo "<a href=\"$catlink+$mrid\"><img src=\"$deficon\">$fnb</a>" + ;; + esac done - fi + echo "</td></tr>" + done textform='<div class="fold"> <input type="checkbox" id="cmt" checked><label for="cmt"