Mercurial > hgrepos > hgweb.cgi > s4
annotate s4-blog.sh @ 156:d46bce9072cd
Add link to '#bottom', recover function of auto href at the
beg.of line
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 06 Jan 2016 23:07:05 +0859 |
parents | 511406c0cbbe |
children | 3b2963de55ce |
rev | line source |
---|---|
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1 # |
17 | 2 type cgiinit >/dev/null 2>&1 || . ./s4-funcs.sh |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
3 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
4 blog_genform() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
5 # |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
6 t=$1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
7 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
8 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
9 blog_writable() ( |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
10 # $1=articleid $2=user |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
11 blogowner=`getvalbyid blog owner "$1"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
12 [ x"$blogowner" = x"$2" ] || isuser "$blogowner" || ismember "$2" "$blogowner" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
13 ) |
138
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
14 blog_readable() { |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
15 # $1=articleid $2=user |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
16 mode=`getgroupattr $grp regmode` |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
17 } |
50
13f9b5e5df85
subshellize blog_notify_reply
HIROSE Yuuji <yuuji@gentei.org>
parents:
48
diff
changeset
|
18 blog_notify_reply() ( |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
19 # $1=articleid $2=ReplyingUser $3=WrittenText $4(optional)=Action |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
20 blogowner=`getvalbyid blog owner "$1"` |
28
7ae119a14613
Do not send comment notification when author is board owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
17
diff
changeset
|
21 [ x"$2" = x"$blogowner" ] && return # If author=blogowner, unnecessary |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
22 blogtitle=`getvalbyid blog title "$1"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
23 blogurl="$urlbase?replyblog+$1" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
24 action=${4:-書き込み} |
50
13f9b5e5df85
subshellize blog_notify_reply
HIROSE Yuuji <yuuji@gentei.org>
parents:
48
diff
changeset
|
25 mode=`getvalbyid blog notify "$1"` |
13f9b5e5df85
subshellize blog_notify_reply
HIROSE Yuuji <yuuji@gentei.org>
parents:
48
diff
changeset
|
26 case $mode in |
48 | 27 admin) |
55
7f9f7e898986
Do not send notification to the person-self
HIROSE Yuuji <yuuji@gentei.org>
parents:
54
diff
changeset
|
28 if isgroup "$blogowner"; then |
117 | 29 emails=`getgroupadminmails $blogowner` |
48 | 30 else |
31 emails=`collectemail $blogowner` | |
32 fi | |
33 ;; | |
34 no) return ;; | |
35 *) emails=`collectemail $blogowner` ;; | |
36 esac | |
57 | 37 err notify: user=$user Admins=`getgroupadmins $blogowner` Mode=$mode Emails="[$emails]" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
38 smail "$emails" "${action}通知 $urlbase"<<EOF |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
39 [$blogtitle]板に${action}がありました。 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
40 場所: $blogurl |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
41 題目: $blogtitle |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
42 筆者: `gecos $2` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
43 内容: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
44 `echo "$3"|sed 's/^/> /'` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
45 EOF |
50
13f9b5e5df85
subshellize blog_notify_reply
HIROSE Yuuji <yuuji@gentei.org>
parents:
48
diff
changeset
|
46 ) |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
47 blog_showentry() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
48 # $1=table $2=rowid |
69 | 49 # if [ -n "$2" ]; then |
50 # if [ -n "$imgcached" ]; then | |
51 # bstmpdir=$tmpdir/$imgcached/$thumbxy | |
52 # else | |
53 # bstmpdir=$tmpd | |
54 # # tmpd=`mktempd` | |
55 # # tmpfiles=$tmpfiles" $tmpd" | |
56 # fi | |
57 # fi | |
72
3dc3ddd2d3e5
getcachedir argument contains rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
69
diff
changeset
|
58 td=`getcachedir "article/$2"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
59 tbl=${1%%[!A-Z0-9a-z_]*} rowid=${2%%[!A-Z0-9a-z_]*} |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
60 err rowid=$rowid, '$2'=$2 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
61 ts=${tbl}_s tm=${tbl}_m |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
62 at=article as=article_s am=article_m |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
63 serial=$(($(date +%s)-1420038000))s$$ |
64
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
64 blog_writable $rowid $user && iswritable=true || iswritable=false |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
65 # This function grasps blog entry definiton directly. |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
66 # blog: id |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
67 # blog_s: title,ctime,heading |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
68 # blog_m: *article |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
69 |
138
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
70 # 2015-10-05 check readable |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
71 if ! $iswritable; then |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
72 blogowner=`getvalbyid blog owner "$2"` |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
73 # err blogowner=$blogowner |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
74 if isgroup $blogowner; then |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
75 regmode=`getgroupattr $blogowner regmode` |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
76 # err regmode=$regmode |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
77 if [ x"$regmode" = x"moderated" ]; then |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
78 if ! ismember $user $blogowner; then |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
79 echo "加入してからどうぞ" | html p |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
80 return |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
81 fi |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
82 fi |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
83 fi |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
84 fi |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
85 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
86 err "SELECT id from $tbl where rowid=$rowid" |
2 | 87 id=`query "select id from $tbl where rowid=$rowid;"` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
88 err id=$id |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
89 err "select val from $ts where key='title' and id='$id';" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
90 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
91 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
92 #(1)Display root article |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
93 cat<<EOF |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
94 <form class="replyblog" action="$myname?replyblog+${rowid}#bottom" method="POST" enctype="multipart/form-data"> |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
95 <table class="bloghead"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
96 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
97 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
98 href="<a href=\"?editheading+$rowid\"> 編集 </a>" |
64
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
99 if $iswritable; then |
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
100 href2="<a href=\"?lshandout+$rowid\"> 提出状況 </a>" |
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
101 href3="(<a href=\"?gethandout+$rowid\">ファイル取得</a>)" |
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
102 fi |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
103 cat<<EOF | sq -html $db \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
104 | sed -e "s|\(<TR><TD>\),e,|\1 $href |" \ |
2 | 105 -e "s|,s,\(</TD>\)|$href2$href3\1|" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
106 -- select val from $ts where key="title" and id="$id"; |
2 | 107 select |
108 coalesce((select ",e," from blog where rowid=$rowid and author='$user'),'') | |
109 ||val||" " | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
110 ||case (select val from $ts where key="mode" and id="$id") |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
111 when 'report-closed' then "レポート提出用(自身のファイルのみ参照可),s," |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
112 when 'report-open' then "レポート提出用,s," |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
113 else "" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
114 end |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
115 from $ts where key="ctime" and id="$id"; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
116 select val from $ts where key="heading" and id="$id"; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
117 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
118 cat<<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
119 </table> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
120 <table class="blog_replies"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
121 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
122 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
123 #(2)Display following articles |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
124 textform='<div><table class="b"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
125 <tr><td><textarea name="text" cols="40" rows="4"></textarea></td></tr> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
126 <tr><td>添付ファイル: <input type="file" name="image" multiple></td></tr> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
127 </table> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
128 <input type="submit" value="送信"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
129 <input type="reset" value="リセット"></div> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
130 ' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
131 ## 6/11の次: articleを出して行く |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
132 : <<EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
133 シリアル:id:p:serial: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
134 blogID:blogid:f:blog(id): |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
135 筆者:author:s:owner |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
136 時刻:ctime:s:stamp: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
137 参照元:parent:s:parent: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
138 パス:path:s:path: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
139 本文:text:s:textarea:cols="60" rows="8" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
140 画像:image:m:image: |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
141 stage:stage:x:hidden:value="replyblog" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
142 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
143 article(id, blogid, author) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
144 article_s: Visible = ctime, text Invisible = parent, path |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
145 article_m: image |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
146 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
147 article = hoge|1433812374x20849|yuuji@gentei.org |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
148 article_s = hoge|ctime|string|2015-06-13 12:27:34| |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
149 hoge|text|string|Shall we dance?| |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
150 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
151 ## |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
152 ## |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
153 err "select id from $at where blogid='$id';" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
154 # arts=`sq $db "select a.rowid,a.id, |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
155 #-- coalesce(b.gecos, a.author) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
156 # a.author from $at a |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
157 # LEFT JOIN (select name,val as gecos from user_s where key='gecos') b |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
158 # on a.author=b.name where blogid='$id'";` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
159 arts=`query "select rowid,id,author from $at where blogid='$id';"` |
34 | 160 # err arts="[$arts]" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
161 number=0 |
2 | 162 hrefhome0="<a href=\"?home" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
163 for a in $arts; do |
59 | 164 arid=${a%%\|*} aid=`echo "$a"|cut -d'|' -f2` author=${a##*\|} imgs="" |
133
d5afe98a8b58
debug-off in blog_showentry
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
165 ## err a=$a, aid=$aid, author=$author |
d5afe98a8b58
debug-off in blog_showentry
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
166 ## err td=$td |
59 | 167 val=`getvalbyid article image "$arid" "$td"` |
133
d5afe98a8b58
debug-off in blog_showentry
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
168 ## err val="[$val]" and td as follows: |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
169 |
69 | 170 if [ -n "$val" ]; then |
171 hrfb="$myname?showattc+article_m" | |
172 imgs="<br>"$(echo "$val"\ | |
173 |while read fn; do | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
174 |
69 | 175 #data=`percenthex $td/$fn` |
176 #ct=`cat $td/$fn.content-type` | |
177 sz=`cat $td/$fn.size` | |
178 ri=`cat $td/$fn.rowid` | |
133
d5afe98a8b58
debug-off in blog_showentry
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
179 ## err fn=$fn ct=$ct ri=$ri ls::: "`ls -lF $td/`" |
d5afe98a8b58
debug-off in blog_showentry
HIROSE Yuuji <yuuji@gentei.org>
parents:
128
diff
changeset
|
180 iconhref2 $td/$fn "$hrfb+$ri" "$fn" "$fn($sz)" |
134
12c3f2e334a1
Insert "<br>" after each thumbnail, for test.
HIROSE Yuuji <yuuji@gentei.org>
parents:
133
diff
changeset
|
181 echo "<br>" |
69 | 182 done) |
183 imgs=`echo "$imgs"|tr -d '\n'` # kill newlines for sed | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
184 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
185 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
186 ### number=$((number+1)) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
187 # reply="<input type=\"radio\" name=\"parent\" class=\"replybtn\" \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
188 # value=\"$number\">" |
2 | 189 getgecos="(select rowid from user where name='$author')||':'||\ |
190 coalesce((select val from user_s \ | |
191 where name='$author' and key='gecos'), '$author')||',[/a],'" | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
192 href="$myname?editart+$arid+$rowid" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
193 link="<a href=\"$href\">編集</a>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
194 cat<<EOF | sq -html $db \ |
2 | 195 | sed -e "s|,n,\([0-9]*\):|,n,$hrefhome0+\1\">|" \ |
196 -e 's|,\[/a\],|</a>|' \ | |
197 -e 's/,n,/<br>/g' -e "s|,i,|$imgs|" \ | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
198 -e "s|<TR>\(<TD>\)|<TR id=\"$aid\">\1|" \ |
35
894f93ef24fe
g flag is meaningless because regexp is anchored at the bol
HIROSE Yuuji <yuuji@gentei.org>
parents:
34
diff
changeset
|
199 -e "s|^href=\([-A-Za-z0-9,.:/~_%#&+?]*\)|<a &>\1</a>|" \ |
2 | 200 -e "s|\(<TR.*>\)\(<TD>\),e,|\1\2$link|" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
201 select |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
202 coalesce((select ",e," from article where id='$aid' and author='$user'),"") |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
203 || |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
204 max(case key when 'ctime' then ",n,"||val|| |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
205 ",n,"||$getgecos end) as TIME, |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
206 -- max(case key when 'parent' then val||"への返信" end) as REPLYTO, |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
207 max(case key when 'text' then val||",i," end) as TEXT |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
208 from article_s where id = '$aid' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
209 group by id order by TIME; |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
210 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
211 done |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
212 echo "</table>" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
213 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
214 |
64
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
215 $iswritable && cat<<EOF |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
216 <div class="blogcomment"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
217 <p>コメント記入</p> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
218 <input type="hidden" name="blogid" value="$id"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
219 <input type="hidden" name="stage" value="replyblog"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
220 <input type="hidden" name="serial" value="$serial"> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
221 $textform |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
222 </div> |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
223 EOF |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
224 echo "</form><p id=\"bottom\"></p>" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
225 # Record access log |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
226 acclog blog $rowid |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
227 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
228 |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
229 blog_showentry2() { |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
230 # $1=table $2=rowid |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
231 # if [ -n "$2" ]; then |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
232 # if [ -n "$imgcached" ]; then |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
233 # bstmpdir=$tmpdir/$imgcached/$thumbxy |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
234 # else |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
235 # bstmpdir=$tmpd |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
236 # # tmpd=`mktempd` |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
237 # # tmpfiles=$tmpfiles" $tmpd" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
238 # fi |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
239 # fi |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
240 td=`getcachedir "article/$2"` |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
241 tbl=${1%%[!A-Z0-9a-z_]*} rowid=${2%%[!A-Z0-9a-z_]*} |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
242 err rowid=$rowid, '$2'=$2 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
243 ts=${tbl}_s tm=${tbl}_m |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
244 at=article as=article_s am=article_m |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
245 serial=$(($(date +%s)-1420038000))s$$ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
246 blog_writable $rowid $user && iswritable=true || iswritable=false |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
247 # This function grasps blog entry definiton directly. |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
248 # blog: id |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
249 # blog_s: title,ctime,heading |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
250 # blog_m: *article |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
251 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
252 # 2015-10-05 check readable |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
253 if ! $iswritable; then |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
254 blogowner=`getvalbyid blog owner "$2"` |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
255 # err blogowner=$blogowner |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
256 if isgroup $blogowner; then |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
257 regmode=`getgroupattr $blogowner regmode` |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
258 # err regmode=$regmode |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
259 if [ x"$regmode" = x"moderated" ]; then |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
260 if ! ismember $user $blogowner; then |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
261 echo "加入してからどうぞ" | html p |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
262 return |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
263 fi |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
264 fi |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
265 fi |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
266 fi |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
267 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
268 err "SELECT id from $tbl where rowid=$rowid" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
269 id=`query "select id from $tbl where rowid=$rowid;"` |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
270 err id=$id |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
271 err "select val from $ts where key='title' and id='$id';" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
272 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
273 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
274 #(1)Display root article |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
275 cat<<EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
276 <form class="replyblog" action="$myname?replyblog+${rowid}#bottom" method="POST" enctype="multipart/form-data"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
277 <table class="bloghead"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
278 EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
279 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
280 href="<a href=\"?editheading+$rowid\"> 編集 </a>" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
281 if $iswritable; then |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
282 href2="<a href=\"?lshandout+$rowid\"> 提出状況 </a>" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
283 href3="(<a href=\"?gethandout+$rowid\">ファイル取得</a>)" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
284 fi |
156
d46bce9072cd
Add link to '#bottom', recover function of auto href at the
HIROSE Yuuji <yuuji@gentei.org>
parents:
155
diff
changeset
|
285 href4='<a href="#bottom"> 末尾へ</a>' |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
286 cat<<EOF | sq -html $db \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
287 | sed -e "s|\(<TR><TD>\),e,|\1 $href |" \ |
156
d46bce9072cd
Add link to '#bottom', recover function of auto href at the
HIROSE Yuuji <yuuji@gentei.org>
parents:
155
diff
changeset
|
288 -e "s|,s,\(</TD>\)|$href2$href3$href4\1|" |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
289 -- select val from $ts where key="title" and id="$id"; |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
290 select |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
291 coalesce((select ",e," from blog where rowid=$rowid and author='$user'),'') |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
292 ||val||" " |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
293 ||case (select val from $ts where key="mode" and id="$id") |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
294 when 'report-closed' then "レポート提出用(自身のファイルのみ参照可),s," |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
295 when 'report-open' then "レポート提出用,s," |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
296 else "" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
297 end |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
298 from $ts where key="ctime" and id="$id"; |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
299 select val from $ts where key="heading" and id="$id"; |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
300 EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
301 cat<<EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
302 </table> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
303 <table class="blog_replies"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
304 EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
305 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
306 lkhome="<a href=\"$myname?home" lke='">' |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
307 lkedit="<a href=\"$myname?editart" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
308 if false; then |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
309 sq -html $db<<EOF | |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
310 WITH a_s AS ( |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
311 SELECT id, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
312 max(CASE key WHEN 'ctime' THEN val END) TIME, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
313 max(CASE key WHEN 'text' THEN val END) TEXT |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
314 FROM article_s |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
315 GROUP by id |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
316 ) |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
317 SELECT 'id:'||a.id, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
318 CASE author |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
319 WHEN '$user' THEN 'ed:'||a.rowid||':'||$rowid |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
320 ELSE 'e0:' |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
321 END edit, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
322 'at:'||(SELECT rowid FROM user WHERE name=author)||':' |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
323 ||coalesce((SELECT val FROM user_s |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
324 WHERE name=author AND key='gecos'), |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
325 author), |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
326 'ti:'||s.TIME, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
327 'te:'||s.TEXT, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
328 'im:'||(SELECT group_concat(hex(bin) |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
329 FROM (select rowid,id,author from article where blogid in |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
330 (select id from blog where rowid=$rowid)) a |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
331 LEFT JOIN |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
332 a_s s |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
333 ON a.id=s.id; |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
334 EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
335 sed -e "s|^<TR><TD>id:\(.*\)</TD>|<TR id=\"\1\"><TD>|" \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
336 -e "/^<TR/N" -e 's/\n//' \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
337 -e "s|<TD>ed:\([0-9]*\):\(.*\)</TD>|$lkedit+\1+\2${lke}編集</a>|" \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
338 -e "s|<TD>e0:</TD>||" \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
339 -e "s|^<TD>at:\([0-9]*\):\(.*\)</TD>|$lkhome+\1$lke\2</a>|" \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
340 -e "s|^<TD>ti:\(.*\)</TD>|\1</TD>|" \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
341 -e "s|^<TD>te:\(.*\)|<TD>\1|" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
342 else |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
343 hlink="$myname?home" elink="$myname?editart" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
344 catlink="$myname?showattc+article_m" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
345 deficon="img/file-icon.png" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
346 sq $db<<EOF | |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
347 WITH a_s AS ( |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
348 SELECT id, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
349 max(CASE key WHEN 'ctime' THEN val END) TIME, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
350 max(CASE key WHEN 'text' THEN val END) TEXT |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
351 FROM article_s |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
352 GROUP by id |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
353 ) |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
354 SELECT a.id, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
355 CASE author |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
356 WHEN '$user' THEN a.rowid||'+'||$rowid |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
357 ELSE '' |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
358 END edit, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
359 (SELECT rowid FROM user WHERE name=author) user_rid, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
360 coalesce((SELECT val FROM user_s |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
361 WHERE name=author AND key='gecos'), |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
362 author) uname, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
363 s.TIME, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
364 hex(s.TEXT), |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
365 (SELECT group_concat(rowid||':'||length(bin)||':'||hex(val), ' ') |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
366 FROM article_m |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
367 WHERE id=a.id AND key='image') imxgids |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
368 FROM (select rowid,id,author from article where blogid in |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
369 (select id from blog where rowid=$rowid)) a |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
370 LEFT JOIN |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
371 a_s s |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
372 ON a.id=s.id; |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
373 EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
374 while IFS='|' read id edit uid uname tm hte imgids; do |
156
d46bce9072cd
Add link to '#bottom', recover function of auto href at the
HIROSE Yuuji <yuuji@gentei.org>
parents:
155
diff
changeset
|
375 cat<<EOF | |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
376 <tr id="$id"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
377 <td>${edit:+<a href="$elink+$edit">編集</a>} |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
378 <a href="$hlink+$uid">$uname</a> |
155
511406c0cbbe
Do HTML escape at value editing
HIROSE Yuuji <yuuji@gentei.org>
parents:
154
diff
changeset
|
379 $tm</td><td>`echo "$hte"|unhexize|htmlescape` |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
380 EOF |
156
d46bce9072cd
Add link to '#bottom', recover function of auto href at the
HIROSE Yuuji <yuuji@gentei.org>
parents:
155
diff
changeset
|
381 sed -e "s|^href=\([-A-Za-z0-9,.:/~_%#&+?]*\)|<a &>\1</a>|" |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
382 for i in $imgids; do |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
383 mrid=${i%%:*}; i=${i#*:}; sz=`size_h ${i%%:*}` |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
384 fn=`echo "${i#*:}"|unhexize` |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
385 fnb=$fn"(${sz})" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
386 # echo r=$mrid fn=$fn |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
387 case "$fn" in |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
388 *.[Pp][Nn][Gg]|*.[Jj][Pp][Gg]) |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
389 sq $db "SELECT hex(bin) FROM article_m WHERE rowid=$mrid" \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
390 | unhexize \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
391 | convert -define jpeg:size=100x100 -resize 100x100'>' - jpeg:- \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
392 | hexize \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
393 | sed -e 's/\(..\)/%\1/g' \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
394 -e "s|^|<a href=\"$catlink+$mrid\"><img src=\"data:image/jpeg,|" \ |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
395 -e "s|\$|\">$fnb</a>|" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
396 ;; |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
397 *) |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
398 echo "<a href=\"$catlink+$mrid\"><img src=\"$deficon\">$fnb</a>" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
399 ;; |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
400 esac |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
401 done |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
402 done |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
403 fi |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
404 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
405 textform='<div><table class="b"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
406 <tr><td><textarea name="text" cols="40" rows="4"></textarea></td></tr> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
407 <tr><td>添付ファイル: <input type="file" name="image" multiple></td></tr> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
408 </table> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
409 <input type="submit" value="送信"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
410 <input type="reset" value="リセット"></div> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
411 ' |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
412 echo '</table>' |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
413 |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
414 $iswritable && cat<<EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
415 <div class="blogcomment"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
416 <p>コメント記入</p> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
417 <input type="hidden" name="blogid" value="$id"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
418 <input type="hidden" name="stage" value="replyblog"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
419 <input type="hidden" name="serial" value="$serial"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
420 $textform |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
421 </div> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
422 EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
423 echo "</form><p id=\"bottom\"></p>" |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
424 # Record access log |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
425 acclog blog $rowid |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
426 } |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
427 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
428 lshandout() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
429 # $1=rowid of blog |
64
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
430 if ! blog_writable $1 $user; then |
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
431 echo "メンバー以外は利用できません。" | html p; return |
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
432 fi |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
433 time=`getvalbyid blog ctime $1|colrm 11` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
434 owner=`getvalbyid blog owner $1` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
435 title=`getvalbyid blog title $1` |
2 | 436 ge=`gecos $owner` |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
437 lshandoutsub $owner "$@" \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
438 |m4 -D_TITLE_="提出状況" \ |
67 | 439 -D_FORMHEAD_="$time [$title]@${ge:-$owner}" \ |
440 -D_FORM_="syscmd(cat)" -D_DUMPHEAD_= -D_DUMPTABLE_= \ | |
441 $layout/html.m4.html $layout/form+dump-whead.m4.html | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
442 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
443 lshandoutsub() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
444 # $1=owner $2=rowid of blog |
2 | 445 if isgroup $1; then |
446 sample="(select user from grp_mem where gname='$1')" | |
447 else | |
448 sample="(select distinct author as user from arts)" | |
67 | 449 echo "(集計は板への投稿者のみ)" | html p |
2 | 450 fi |
451 sql="with arts as (select id,author from article \ | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
452 where blogid=(select id from blog where rowid=$2))\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
453 select (select rowid from user where name=c0.user)||' '|| \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
454 coalesce((select val from user_s where name=c0.user \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
455 and key='gecos'),\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
456 c0.user) as 'メンバー',\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
457 sum(case when c1.key is not null then 1 else 0 end)\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
458 as 'コメント記入',\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
459 sum(case when c2.key is not null then 1 else 0 end)\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
460 as 'ファイルの提出'\ |
2 | 461 from $sample c0 \ |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
462 left join (select id,author from arts) a\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
463 on c0.user=a.author\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
464 left join (select id,key from article_s where key='text') c1\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
465 on a.id=c1.id left join (select id,key from article_m ) c2\ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
466 on c1.id=c2.id group by c0.user order by c0.user;" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
467 err ishandoutsub: sql="$sql" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
468 echo '<table class="b td2r td3r">' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
469 hrb="<a href=\"?home+" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
470 echo "$sql" | sq -header -html $db \ |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
471 | sed -e "s,\(<TR><TD>\)\([^ ]*\) \(.*\)</TD>,\1$hrb\2\">\3</TD>," -e 's,<TD>0</TD>,<TD class="warn">0</TD>,' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
472 echo '</table>' |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
473 } |
2 | 474 gethandout() { |
475 # $1=rowid of blog | |
64
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
476 if ! blog_writable $1 $user; then |
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
477 echo "メンバー以外は利用できません。" | html p; return |
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
478 fi |
2 | 479 i=0 |
480 bd=$tmpd/archive.$$ | |
481 mkdir $bd | |
482 query "select m.rowid,author,m.val from article a join article_m m\ | |
483 on a.id=m.id where blogid=(select id from blog where rowid=$1)\ | |
484 and m.key in ('image', 'document', 'binary');" \ | |
485 | while IFS='|' read rowid author filename; do | |
63 | 486 # err isfilereadable $user article_m $rowid |
487 isfilereadable $user article_m $rowid || continue | |
488 # err ok | |
2 | 489 i=$((i+1)) |
490 dir=`printf $bd/%03d $i` | |
491 mkdir $dir | |
492 query "select quote(bin) from article_m where rowid=$rowid;" \ | |
8 | 493 | unhexize > $dir/$filename |
2 | 494 done |
495 if [ ! -d $bd/001 ]; then | |
496 contenttype; echo | |
67 | 497 echo "取得できるファイルがありませんでした。" | html p |
2 | 498 return |
499 fi | |
500 (cd $bd | |
501 err cdto$bd; (pwd; ls -lFa) 1>&3 | |
502 tar zcf .archive.tar.gz * && mv .archive.tar.gz archive.tar.gz | |
503 ) | |
504 arc=$bd/archive.tar.gz | |
505 echo "Content-type: application/x-gzip" | |
506 echo "Content-Length: `cat $arc|wc -c`" | |
507 echo "Content-Disposition: filename=\"archive.tar.gz\"" | |
508 echo | |
509 cat $arc | |
510 } | |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
511 lsmyfile() { # $1(optional)=SortBy |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
512 case "$1" in |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
513 ""|CTIME-DESC) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
514 by="CTIME" ord="DESC" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
515 CTIME*) by="CTIME" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
516 FILE*) by="FILE" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
517 OWNER*) by="OWNER" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
518 TITLE*) by="TITLE" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
519 esac |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
520 case "$1" in |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
521 *DESC) ord="DESC" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
522 esac |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
523 case "$ord" in |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
524 DESC) lkod="" jord="降順" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
525 *) lkod="-DESC" jord="昇順" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
526 esac |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
527 sql="select m.val||'/'||m.rowid FILE, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
528 coalesce( |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
529 case when (select name from user where name=bs.owner) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
530 is not null |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
531 then (select val from user_s where name=bs.owner |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
532 and key='gecos') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
533 when (select gname from grp where gname=bs.owner) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
534 is not null |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
535 then (select val from grp_s where gname=bs.owner |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
536 and key='gecos') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
537 else |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
538 null |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
539 end, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
540 bs.owner |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
541 ) OWNER, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
542 a_s.val CTIME, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
543 ',t,'||bs.title||':'||b.rowid||'#'||a.id TITLE |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
544 from (select rowid,id,val from article_m where id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
545 in (select id from article where author='$user') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
546 and type like 'file:%') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
547 m left join article a on m.id=a.id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
548 left join article_s a_s on a.id=a_s.id and a_s.key='ctime' |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
549 left join (select id, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
550 max(case key when 'owner' then val end) as owner, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
551 max(case key when 'title' then val end) as title |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
552 from blog_s group by id) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
553 bs on a.blogid=bs.id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
554 left join blog b on bs.id=b.id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
555 where m.val is not null order by $by $ord;" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
556 err lshandoutbyauthor: sql=`echo "$sql"` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
557 title="個人提出ファイル" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
558 m4 -D_TITLE_=$title $layout/html.m4.html |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
559 hra="<a href=\"?lsmyfile+" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
560 hrb="<a href=\"?showattc+article_m+" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
561 hrc="<a href=\"?replyblog+" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
562 (echo '<table class="b">' |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
563 echo "$sql"|sq -html -header $db ) \ |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
564 | sed -e "s|\(<TR><TD>\)\([^/]*\)/\([0-9]*\)|\1$hrb\3\">\2</a>|" \ |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
565 -e "s|,t,\(.*\):\([^<]*\)\(</TD>\)|$hrc\2\">\1</a>\3|" \ |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
566 -e "s|\(<TH>\)\([A-Z]*\)\(</TH>\)|\1$hra\2$lkod\">\2</a>|" \ |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
567 | m4 -D_TITLE_=$title -D_FORM_="<p>($by$jord)</p>" \ |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
568 -D_DUMPTABLE_="syscmd(cat)" $layout/form+dump.m4.html |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
569 echo '</table>' |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
570 } |
78 | 571 searchart() { |
572 kwd=`getpar kwd` | |
573 if [ -z "$kwd" ]; then | |
574 echo "検索語を指定してください" | html p; return | |
575 fi | |
576 owner=`getpar owner` | |
577 owner=${owner:-$1} | |
578 echo "「$kwd」による検索結果" | html p | |
579 if [ -n "$owner" ]; then | |
580 cond="where key='owner' and val='$owner'" | |
581 if isuser $owner; then | |
582 echo "(`linkhome $owner` さんの記録からの検索)" | html p | |
583 else | |
584 linkhome $owner 1>&3 | |
585 echo "(`linkhome $owner` グループからの検索)" | html p | |
586 fi | |
587 fi | |
588 # article_s: id=article-id, key='text', val='TEXT' | |
589 # article: id=article-id, blogid=blogkd | |
590 # blog: id=blog-id, author=LeaderAuthor | |
591 # blog_s: id=blog-id, key='title', val='BLOG-TITLE' | |
592 # WANT: blog-ROWid,article-id,val(TEXT) | |
593 sql="select b.rowid||'#'||x.id as '', | |
594 b.title as TITLE, | |
595 substr(x.val, 0, 80) as TEXT | |
596 from (select blog.rowid,blog.*,bs.val as title from blog join blog_s bs | |
597 on blog.id=bs.id and bs.key='title') b | |
598 join | |
599 (select a.id,a.blogid,s.val from article a join article_s s | |
600 on a.id=s.id where s.val like '%$kwd%') | |
601 x on b.id=x.blogid | |
602 where b.id in (select id from blog_s | |
603 $cond);" | |
604 sedopt="s,<TR><TD>\([^<]*\)</TD>,<TR><TD><a\ | |
605 href=\"?replyblog+\1\">VIEW</a></TD>," | |
606 cat<<EOF | |
607 <table class="b searchart"> | |
608 `sq -header -html $db "$sql"|sed "$sedopt"` | |
609 </table> | |
610 EOF | |
611 } | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
612 listblog() ( |
67 | 613 # $1={user,group} |
614 qow=`sqlquote $1` | |
615 cond="where a.id in (select id from blog_s where key='owner' and val=$qow) order by ctime desc" | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
616 DT_CHLD=article:blogid |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
617 cgi_form searchart<<EOF |
128 | 618 <label>`cgi_text kwd`という語を含む記事をこの一覧から検索</label> |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
619 `cgi_hidden owner $user` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
620 EOF |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
621 dumptable html blog 'ctime title heading' "$cond" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
622 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
623 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
624 blog_addentry() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
625 # $1=GRPname(if it is a group) |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
626 grprowid=$1 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
627 rowid=`getpar rowid` |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
628 err blog_addentry0: rowid=$rowid |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
629 if [ -n "$grprowid" ]; then |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
630 owner=`getgroupbyid $grprowid` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
631 else |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
632 owner=`getpar owner` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
633 fi |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
634 err blog-add: \$1=$1 rowid=$rowid owner=$owner |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
635 if isgroup $owner; then |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
636 groupmode=1 listing=$owner guide="[${owner}]" GF_OWNER=$owner |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
637 else |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
638 usermode=1 listing=$user guide="[個人]" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
639 fi |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
640 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
641 if [ -n "`getpar title`" ]; then |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
642 if [ "$usermode" ]; then |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
643 err usermode: user=$user owner=$owner |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
644 if [ x"$user" != x"$owner" ]; then |
67 | 645 echo "他人の日記は書けません" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
646 return 2 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
647 fi |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
648 elif [ "$groupmode" ]; then # if write to group log |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
649 grp=$owner #\`getpar grp\` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
650 err ismember: $user $grp |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
651 if ! ismember "$user" "$grp"; then |
67 | 652 echo "(話題作成はこのグループに加入してから)" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
653 return 3 |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
654 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
655 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
656 par2table $formdir/blog.def |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
657 serial=`getpar serial` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
658 err SERIAL: $serial ROWID=$rowid listing=$listing |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
659 id="" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
660 if [ -n "$rowid" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
661 # Here, id becomes NULL when removal of entries at par2table |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
662 id=`query "select rowid from blog where rowid=$rowid;"` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
663 elif [ -n "$serial" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
664 # If new blog leader created, traverse to its head. |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
665 id=`query "select rowid from blog where id='$serial';"` |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
666 err new-Leader: "select rowid from blog where id='$serial';" id=$id |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
667 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
668 if [ -n "$id" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
669 ## If new aritcle is entered, JUMP to blog_reply |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
670 blog_reply $id |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
671 return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
672 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
673 fi |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
674 echo "${guide}新規話題作成" > $tmpd/title.$$ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
675 listblog $listing > $tmpd/listblog.$$ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
676 genform $formdir/blog.def \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
677 | m4 -D_TITLE_="spaste(\`$tmpd/title.$$')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
678 -D_FORMHEAD_="序文は簡単に詳しくはコメントに" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
679 -D_DUMPHEAD_="これまでの蓄積" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
680 -D_FORM_="syscmd(\`cat')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
681 -D_DUMPTABLE_="spaste(\`$tmpd/listblog.$$')" \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
682 $layout/html.m4.html \ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
683 $layout/form+dump-whead.m4.html |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
684 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
685 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
686 blog_reply() { |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
687 rowid=$1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
688 err rowid=$1 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
689 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
690 if [ -z "$rowid" ]; then |
67 | 691 echo "表示する日記番号が未指定です。" | html p |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
692 return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
693 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
694 title=`getvalbyid blog title $rowid` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
695 owner=`getvalbyid blog owner $rowid` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
696 if isuser "$owner"; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
697 subtitle="`gecos $owner` さんの話題" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
698 else |
16
636df1c1bdf2
Track group by rowid in URLs
HIROSE Yuuji <yuuji@gentei.org>
parents:
13
diff
changeset
|
699 grprowid=`query "select rowid from grp where gname=\"$owner\";"` |
54
d08e556f3462
In group mode, link anchor changed from gecos to gname
HIROSE Yuuji <yuuji@gentei.org>
parents:
50
diff
changeset
|
700 subtitle="グループ <a href=\"?grp+$grprowid\">$owner</a> での話題" |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
701 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
702 if [ -z "$title" ]; then |
67 | 703 echo "日記番号指定が無効です。" | html p |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
704 return |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
705 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
706 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
707 text=`getpar text` |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
708 if [ -n "$text" ]; then |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
709 if blog_writable $rowid $user; then |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
710 par2table $formdir/article.def |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
711 st=$? # ; err par2t-st=$st |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
712 case $st in |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
713 0|4) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
714 [ "$st" = "4" ] && act="書込削除" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
715 blog_notify_reply $rowid $user "$text" $act ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
716 esac |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
717 else |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
718 title="$title(加入してないので書き込み不可)" |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
719 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
720 fi |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
721 def=$formdir/article.def |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
722 echo "$title" > $tmpd/title.$$ |
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
723 echo "$subtitle" > $tmpd/subtitle.$$ |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
724 ${BLOG_SHOW:-blog_showentry} blog $rowid \ |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
725 | m4 -D_TITLE_="spaste(\`$tmpd/title.$$')" -D_BODYCLASS_=general \ |
156
d46bce9072cd
Add link to '#bottom', recover function of auto href at the
HIROSE Yuuji <yuuji@gentei.org>
parents:
155
diff
changeset
|
726 -D_FORMHEAD_="spaste(\`$tmpd/subtitle.$$')" \ |
d46bce9072cd
Add link to '#bottom', recover function of auto href at the
HIROSE Yuuji <yuuji@gentei.org>
parents:
155
diff
changeset
|
727 -D_FORM_='' \ |
67 | 728 -D_DUMPTABLE_="syscmd(cat)" -D_DUMPHEAD_="" \ |
729 $layout/html.m4.html $layout/form+dump-whead.m4.html | |
0
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
730 } |