Mercurial > hgrepos > hgweb.cgi > s4
annotate s4-blog.sh @ 945:29342754a2d0 draft
Catch undefined error when MathJax not loaded
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Mon, 25 Oct 2021 23:25:56 +0900 |
parents | 5d70fa029f8d |
children | 420ad90116e6 |
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 |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
4 # Global error flags |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
5 BLOG_NOTMEM=1 |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
6 BLOG_FROZEN=2 |
399
db25589d864c
Add frozen tag to lshandoutall listings
HIROSE Yuuji <yuuji@gentei.org>
parents:
397
diff
changeset
|
7 FROZEN_TAG='<span class="frozen">[凍結]</span>' |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
8 |
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
|
9 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
|
10 # |
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 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
|
12 } |
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 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
14 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
|
15 # $1=articleid $2=user |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
16 # Return: $?=0 - Writable |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
17 # =1 - NOT Writable because user is not a member |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
18 # =2 - NOT Writable because blog is frozen |
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
|
19 blogowner=`getvalbyid blog owner "$1"` |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
20 state=`getvalbyid blog state "$1"` |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
21 rc=0 |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
22 [ x"$blogowner" = x"$2" ] || isuser "$blogowner" || ismember "$2" "$blogowner" || rc=$((rc+$BLOG_NOTMEM)) |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
23 [ "$state" = "frozen" ] && rc=$((rc+$BLOG_FROZEN)) |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
24 return $rc |
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
|
25 ) |
138
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
26 blog_readable() { |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
27 # $1=articleid $2=user |
768 | 28 mode=`getgroupattr "$grp" regmode` |
138
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
29 } |
587
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
30 blog_getteam() { |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
31 # $1=rowid of blog |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
32 blogid="${1%%[!A-Z0-9a-z_]*}" |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
33 # team cannot get `getvalbyid blog team "$blogid"` because it's not |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
34 # defined in blog.def. Yes, it is Illegal USE!! |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
35 query "SELECT val FROM blog_s |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
36 WHERE id=(SELECT id FROM blog WHERE rowid=$blogid) |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
37 AND key='team';" |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
38 } |
50
13f9b5e5df85
subshellize blog_notify_reply
HIROSE Yuuji <yuuji@gentei.org>
parents:
48
diff
changeset
|
39 blog_notify_reply() ( |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
40 # $1=blogid $2=ReplyingUser $3=WrittenText $4(optional)=Action |
411
e30fe590a53e
Allow replymark in other than the first line.
HIROSE Yuuji <yuuji@gentei.org>
parents:
410
diff
changeset
|
41 blogid="${1%%[!A-Z0-9a-z_]*}" |
e30fe590a53e
Allow replymark in other than the first line.
HIROSE Yuuji <yuuji@gentei.org>
parents:
410
diff
changeset
|
42 blogowner=`getvalbyid blog owner "$blogid"` |
e30fe590a53e
Allow replymark in other than the first line.
HIROSE Yuuji <yuuji@gentei.org>
parents:
410
diff
changeset
|
43 blogtitle=`getvalbyid blog title "$blogid"` |
e30fe590a53e
Allow replymark in other than the first line.
HIROSE Yuuji <yuuji@gentei.org>
parents:
410
diff
changeset
|
44 blogurl="$urlbase?replyblog+$blogid" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
45 action=${4:-書き込み} |
411
e30fe590a53e
Allow replymark in other than the first line.
HIROSE Yuuji <yuuji@gentei.org>
parents:
410
diff
changeset
|
46 mode=`getvalbyid blog notify "$blogid"` |
473
677597199031
Send notification to '>###' mark on diary as well as on group blog.
HIROSE Yuuji <yuuji@gentei.org>
parents:
470
diff
changeset
|
47 isgroup "$blogowner" && _isgroup=true || _isgroup=false |
238
45b7facac49e
Do not exclude submitting user from new article notification.
HIROSE Yuuji <yuuji@gentei.org>
parents:
222
diff
changeset
|
48 ### EXCEPT=`sqlquote "$user"` ## User should receive to feal some annoyance |
50
13f9b5e5df85
subshellize blog_notify_reply
HIROSE Yuuji <yuuji@gentei.org>
parents:
48
diff
changeset
|
49 case $mode in |
48 | 50 admin) |
473
677597199031
Send notification to '>###' mark on diary as well as on group blog.
HIROSE Yuuji <yuuji@gentei.org>
parents:
470
diff
changeset
|
51 if $_isgroup; then |
768 | 52 emails=`getgroupadminmails "$blogowner"` |
48 | 53 else |
768 | 54 emails=`collectemail "$blogowner"` |
48 | 55 fi |
170
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
56 notifyto=`getpar notifyto` |
191
24e0f2b4d51b
Variable name mistake fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
189
diff
changeset
|
57 if [ -n "$notifyto" ]; then |
170
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
58 emails=$emails" `email4groupbyuid \"$blogowner\" $notifyto`" |
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
59 fi |
48 | 60 ;; |
849
7d9ad05aefee
Do not collect group-email when getting notify-mode seems to fail
HIROSE Yuuji <yuuji@gentei.org>
parents:
843
diff
changeset
|
61 no|"") emails="" ;; # 2020-0630 Omit email when heavy load...(XXX) |
587
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
62 *) team=`blog_getteam "$blogid"` |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
63 # team cannot get by `getvalbyid blog team "$blogid"` |
768 | 64 emails=`TEAM=$team collectemail "$blogowner"` ;; |
48 | 65 esac |
410
c1b4a9dba1c9
Direct reply notification fired by ">#NNN" in the first line
HIROSE Yuuji <yuuji@gentei.org>
parents:
409
diff
changeset
|
66 ## 2017-0210 Respond to the direct reply mark such as: >#1234 |
413
933df1a150e0
replymark should be treated with utf-8
HIROSE Yuuji <yuuji@gentei.org>
parents:
412
diff
changeset
|
67 replymark=`echo "$3"|nkf -w -Z0|grep '^ *>#'` |
410
c1b4a9dba1c9
Direct reply notification fired by ">#NNN" in the first line
HIROSE Yuuji <yuuji@gentei.org>
parents:
409
diff
changeset
|
68 authgecos=`gecos $2` |
878
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
69 ## 2020-1209 If the first line begins with '## ', use it as Subject |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
70 firstline=`echo "$3"|head -1|nkf -w -Z0` |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
71 if [ -z "$4" ]; then |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
72 if [ -n "$replymark" ]; then |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
73 # If the action is new subscription($4="") and has ">#123" marks... |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
74 ids=`echo "$replymark"|sed 's/[^#0-9]*#\([0-9]*\)[^#0-9]*/\1 /g'` |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
75 ids=`echo $ids|tr -dc '[0-9 ]'|tr ' ' ','` |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
76 # -> 123,345,347 |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
77 unames=`query "SELECT distinct author FROM article \ |
410
c1b4a9dba1c9
Direct reply notification fired by ">#NNN" in the first line
HIROSE Yuuji <yuuji@gentei.org>
parents:
409
diff
changeset
|
78 WHERE rowid in ($ids)\ |
411
e30fe590a53e
Allow replymark in other than the first line.
HIROSE Yuuji <yuuji@gentei.org>
parents:
410
diff
changeset
|
79 AND blogid=(SELECT id FROM blog WHERE rowid=$blogid);"` |
878
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
80 if [ -n "$unames" ]; then |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
81 e4g=$(if $_isgroup; then |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
82 email4group "$blogowner" $unames |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
83 else |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
84 for u in $unames; do |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
85 collectemail $u |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
86 done |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
87 fi) |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
88 emails=$emails" $e4g" |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
89 for e in $unames; do |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
90 g=`gecos $e` |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
91 whom=$whom"${whom:+,}${g:-$e}さん" |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
92 done |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
93 action="${whom}への返信" |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
94 fi |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
95 elif echo "$firstline" | grep -q "^## "; then |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
96 subject=${firstline#\#\# } |
411
e30fe590a53e
Allow replymark in other than the first line.
HIROSE Yuuji <yuuji@gentei.org>
parents:
410
diff
changeset
|
97 fi |
430
ce497c515996
Skip notify check when replymark is null and author=owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
429
diff
changeset
|
98 else |
878
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
99 # This else block is not symmetry, check later(2020-1209) |
430
ce497c515996
Skip notify check when replymark is null and author=owner
HIROSE Yuuji <yuuji@gentei.org>
parents:
429
diff
changeset
|
100 [ x"$2" = x"$blogowner" ] && return # If author=blogowner, unnecessary |
410
c1b4a9dba1c9
Direct reply notification fired by ">#NNN" in the first line
HIROSE Yuuji <yuuji@gentei.org>
parents:
409
diff
changeset
|
101 fi |
c1b4a9dba1c9
Direct reply notification fired by ">#NNN" in the first line
HIROSE Yuuji <yuuji@gentei.org>
parents:
409
diff
changeset
|
102 test -z "$emails" && return |
878
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
103 sj=${subject:-${action}通知} |
768 | 104 err notify: user=$user Admins=`getgroupadmins "$blogowner"` Mode=$mode Emails="[$emails]" |
749 | 105 quotedowner=`echo $blogowner | nkf -jM | tr -d '\n"'` |
615
a2d595d5605b
Set NO-REPLY address to From: header of new article notification.
HIROSE Yuuji <yuuji@gentei.org>
parents:
597
diff
changeset
|
106 MAIL_FROM=$noreply_from \ |
749 | 107 SMAIL_TO="\"$quotedowner\" readers <$noreply>" \ |
878
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
108 smail "$emails" "$sj $urlbase"<<EOF |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
109 [$blogtitle]板に${action}がありました。 |
615
a2d595d5605b
Set NO-REPLY address to From: header of new article notification.
HIROSE Yuuji <yuuji@gentei.org>
parents:
597
diff
changeset
|
110 ※※※このメイルには返信できません(返信は次のURLへ)※※※ |
432
99526bd0f2d1
Notify "Notification mail cannot be sent back".
HIROSE Yuuji <yuuji@gentei.org>
parents:
430
diff
changeset
|
111 場所: $blogurl (返信先) |
410
c1b4a9dba1c9
Direct reply notification fired by ">#NNN" in the first line
HIROSE Yuuji <yuuji@gentei.org>
parents:
409
diff
changeset
|
112 所有: $blogowner |
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
|
113 題目: $blogtitle |
410
c1b4a9dba1c9
Direct reply notification fired by ">#NNN" in the first line
HIROSE Yuuji <yuuji@gentei.org>
parents:
409
diff
changeset
|
114 筆者: $authgecos |
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
|
115 内容: |
879
188ad98d443f
Do not add prefix ">" to subscription notification.
HIROSE Yuuji <yuuji@gentei.org>
parents:
878
diff
changeset
|
116 `echo "$3"|sed 's/^/ /'` |
623
5d857faac912
Add a blank line between message body and footer
HIROSE Yuuji <yuuji@gentei.org>
parents:
621
diff
changeset
|
117 |
5d857faac912
Add a blank line between message body and footer
HIROSE Yuuji <yuuji@gentei.org>
parents:
621
diff
changeset
|
118 ※※このメイルに返信しても通知者には伝わりません。 |
5d857faac912
Add a blank line between message body and footer
HIROSE Yuuji <yuuji@gentei.org>
parents:
621
diff
changeset
|
119 ※※上記URLから${S4NAME:-s4}掲示板に書き込んでください。 |
621 | 120 EOF |
50
13f9b5e5df85
subshellize blog_notify_reply
HIROSE Yuuji <yuuji@gentei.org>
parents:
48
diff
changeset
|
121 ) |
192
50e6195130b3
blog_showentry2() is now blog_showentry() (Old code removed)
HIROSE Yuuji <yuuji@gentei.org>
parents:
191
diff
changeset
|
122 |
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
|
123 blog_showentry() { |
801
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
124 # $1=table $2=rowid $3(optional)=control-sequence |
69 | 125 # if [ -n "$2" ]; then |
126 # if [ -n "$imgcached" ]; then | |
127 # bstmpdir=$tmpdir/$imgcached/$thumbxy | |
128 # else | |
129 # bstmpdir=$tmpd | |
130 # # tmpd=`mktempd` | |
131 # # tmpfiles=$tmpfiles" $tmpd" | |
132 # fi | |
133 # fi | |
801
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
134 control=$3 |
72
3dc3ddd2d3e5
getcachedir argument contains rowid
HIROSE Yuuji <yuuji@gentei.org>
parents:
69
diff
changeset
|
135 td=`getcachedir "article/$2"` |
291
1df64f0490ca
`|col|col|...' like table conversion enabled
HIROSE Yuuji <yuuji@gentei.org>
parents:
288
diff
changeset
|
136 [ -d "$td" ] || mkdir -p $td |
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
|
137 tbl=${1%%[!A-Z0-9a-z_]*} rowid=${2%%[!A-Z0-9a-z_]*} |
793 | 138 err blog_showentry: rowid=$rowid, '$2'=$2 user=$user |
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
|
139 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
|
140 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
|
141 serial=$(($(date +%s)-1420038000))s$$ |
557
591838015ac3
Put inaccessible mark on such attached file icon.
HIROSE Yuuji <yuuji@gentei.org>
parents:
513
diff
changeset
|
142 cannotread='<div class="relative"><img class="overlap" src="img/key.png" alt="(読み取り不可)"></div>' |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
143 blog_writable $rowid $user |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
144 rc=$? |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
145 if [ $rc = 0 ]; then |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
146 iswritable=true |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
147 ismem=true |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
148 else |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
149 iswritable=false |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
150 if [ $((rc & $BLOG_NOTMEM)) -gt 0 ]; then |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
151 ismem=false |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
152 else |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
153 ismem=true |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
154 fi |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
155 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
|
156 # 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
|
157 # 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
|
158 # 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
|
159 # 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
|
160 |
443
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
161 blogowner=`getvalbyid blog owner "$2"` |
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
162 isgroup "$blogowner" && isgroup=true || isgroup=false |
680
455d31b22d33
Flag "isgrpowner" should be set even if the blog is frozen
HIROSE Yuuji <yuuji@gentei.org>
parents:
658
diff
changeset
|
163 isgrpadmin=false |
455d31b22d33
Flag "isgrpowner" should be set even if the blog is frozen
HIROSE Yuuji <yuuji@gentei.org>
parents:
658
diff
changeset
|
164 isgrpowner "$user" "$blogowner" && isgrpadmin=true |
924
80048f546db6
Set isgrpadmin when viewing personal blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
923
diff
changeset
|
165 [ x"$user" = x"$blogowner" ] && isgrpadmin=true |
681 | 166 |
138
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
167 # 2015-10-05 check readable |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
168 if ! $iswritable; then |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
169 # err blogowner=$blogowner |
443
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
170 if $isgroup; then |
768 | 171 regmode=`getgroupattr "$blogowner" regmode` |
138
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
172 # err regmode=$regmode |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
173 if [ x"$regmode" = x"moderated" ]; then |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
174 # if ! ismember $user $blogowner; then |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
175 if ! $ismem; then |
138
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
176 echo "加入してからどうぞ" | html p |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
177 return |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
178 fi |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
179 fi |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
180 fi |
130114486d8c
Blog of moderated group cannot be read by outsider.
HIROSE Yuuji <yuuji@gentei.org>
parents:
134
diff
changeset
|
181 fi |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
182 err "blog_showentry Entered: `gdate +%S.%03N` blogrowid=$rowid" |
587
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
183 blog_notify=`getvalbyid blog notify "$rowid"` |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
184 blog_team=`blog_getteam "$rowid"` |
592 | 185 blog_mode=`getvalbyid blog mode "$rowid"` |
942 | 186 blog_math=`getvalbyid blog mathjax "$rowid"` |
587
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
187 case "$blog_notify" in # "all", "admin" or "no" (or NULL) |
1e40019d1bb1
Indicate notification mode in submit button
HIROSE Yuuji <yuuji@gentei.org>
parents:
586
diff
changeset
|
188 admin) notifyto=adm ;; |
170
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
189 *) notifyto="" ;; |
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
190 esac |
592 | 191 case $blog_mode in |
850
f11b80b4d005
When blog_mode is "", fallback to quiz/close
HIROSE Yuuji <yuuji@gentei.org>
parents:
849
diff
changeset
|
192 *quiz*|*close*|"") # When blog_mode is "", fallback to quiz/close |
695
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
193 f_exclusive=1 |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
194 if $isgroup; then |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
195 qgrp=`sqlquote "$blogowner"` |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
196 if $isgrpadmin; then |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
197 F_UNREADABLE="''" |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
198 else |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
199 if [ x"$blog_mode" = x"quiz" ]; then |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
200 F_UNREADABLE="CASE |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
201 WHEN author IN (SELECT user FROM grp_adm WHERE gname=$qgrp) |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
202 THEN '' |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
203 WHEN author = '$user' |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
204 THEN '' |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
205 ELSE 'Unreadable' |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
206 END" |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
207 elif [ x"$blog_mode" = x"report-closed" ]; then |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
208 F_UNREADABLE="CASE |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
209 WHEN author = '$user' |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
210 THEN '' |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
211 ELSE 'Unreadable' |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
212 END" |
695
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
213 else |
696
4ebe5184a3e3
String 'Unreadable' should contain quotes
HIROSE Yuuji <yuuji@gentei.org>
parents:
695
diff
changeset
|
214 F_UNREADABLE="'Unreadable'" |
695
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
215 fi |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
216 fi |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
217 else # User blog |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
218 if [ x"$blog_mode" = x"quiz" ]; then |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
219 F_UNREADABLE="CASE |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
220 WHEN author = '$blogowner' |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
221 THEN '' ELSE 'Unreadable' |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
222 END" |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
223 else |
696
4ebe5184a3e3
String 'Unreadable' should contain quotes
HIROSE Yuuji <yuuji@gentei.org>
parents:
695
diff
changeset
|
224 F_UNREADABLE="'Unreadable'" |
695
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
225 fi |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
226 fi |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
227 ;; |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
228 *) f_exclusive='' |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
229 F_UNREADABLE="''" |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
230 ;; |
557
591838015ac3
Put inaccessible mark on such attached file icon.
HIROSE Yuuji <yuuji@gentei.org>
parents:
513
diff
changeset
|
231 esac |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
232 |
335
a120ba2d719b
Show link to the beginning of page at the bottom of page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
333
diff
changeset
|
233 # err "SELECT id from $tbl where rowid=$rowid" |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
234 id=`query "select id from $tbl where rowid=$rowid;"` |
335
a120ba2d719b
Show link to the beginning of page at the bottom of page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
333
diff
changeset
|
235 #err id=$id |
a120ba2d719b
Show link to the beginning of page at the bottom of page.
HIROSE Yuuji <yuuji@gentei.org>
parents:
333
diff
changeset
|
236 #err "select val from $ts where key='title' and id='$id';" |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
237 |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
238 ## Parse control sequence |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
239 nlimit=$listartlimit |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
240 case "$control" in |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
241 n:[Aa][Ll][Ll]) |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
242 unset nlimit ;; |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
243 n:*) |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
244 nlimit=${control##*:} |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
245 nlimit=${nlimit%%[!A-Z0-9a-z_]*} |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
246 ;; |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
247 f:[Aa][Ll][Ll]) ;; |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
248 f:2???-??-??*) # f:2020-12-27T08:02:43 |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
249 fetch=${control#f:} |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
250 fetch_ajax=`echo "'$fetch'"|tr T ' '` |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
251 esac |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
252 err control=$control fetch_ajax=$fetch_ajax |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
253 #(1)Display root article |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
254 cat<<EOF |
239
25e0b1eaf04d
Degrade fixed: Explicit notify works again.
HIROSE Yuuji <yuuji@gentei.org>
parents:
238
diff
changeset
|
255 <form class="replyblog" action="$myname?replyblog+${rowid}#bottom" method="POST" enctype="multipart/form-data"> |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
256 <table class="bloghead"> |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
257 EOF |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
258 |
702
2c5ddb0b5f4c
Add more shortcuts and baloon help messages
HIROSE Yuuji <yuuji@gentei.org>
parents:
696
diff
changeset
|
259 href="<a href=\"?editheading+$rowid\" accesskey=\"e\" title=\"Shortcut: E${nl}Edit\"> 編集 </a>" |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
260 if $ismem; then |
592 | 261 case $blog_mode in |
593 | 262 *report*|*quiz*|*enquete*) |
702
2c5ddb0b5f4c
Add more shortcuts and baloon help messages
HIROSE Yuuji <yuuji@gentei.org>
parents:
696
diff
changeset
|
263 href2="<a href=\"?lshandout+$rowid\" accesskey=\"l\" title=\"Shortcut: L${nl}List Handouts\"> 提出状況 </a>" |
774
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
264 case "$isgrpadmin$blog_mode" in |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
265 false*closed*|false*quiz|false*enquete*) ;; |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
266 *) |
866
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
267 href3="(ファイル取得[<a href=\"?gethandout+$rowid\" accesskey=\"f\" title=\"Shortcut: F${nl}File Retrieval\">記事順</a>|<a href=\"?gethandout+$rowid+by_uname\" accesskey=\"u\" title=\"Shortcut: F${nl}File Retrieval by User\">著者順</a>])" |
774
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
268 ;; |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
269 esac |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
270 ;; |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
271 esac |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
272 fi |
942 | 273 href4="${blog_math:+Math} <a href=\"#bottom\" accesskey=\"b\" title=\"Shortcut: B${nl}to the Bottom\"> 末尾へ</a>" |
465
4c6a3bacfec3
Show read-time link only to group administrators
HIROSE Yuuji <yuuji@gentei.org>
parents:
464
diff
changeset
|
274 $isgrpadmin && |
702
2c5ddb0b5f4c
Add more shortcuts and baloon help messages
HIROSE Yuuji <yuuji@gentei.org>
parents:
696
diff
changeset
|
275 href5="<a href=\"?blogseen+$rowid\" accesskey=\"s\" title=\"Shortcut: S${nl}State of Accesses\"> 読刻</a>" |
638
b29e31dc3fbd
Quiz-detection SQL file should be located in temporary dir
HIROSE Yuuji <yuuji@gentei.org>
parents:
632
diff
changeset
|
276 quizmodefile=$tmpd/quiz; rm -f "$quizmodefile" # XXX: Global state |
640
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
277 midfile=$tmpd/midfile |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
278 |
640
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
279 query<<-EOF > $midfile |
293
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
280 SELECT coalesce((SELECT "yes" FROM blog |
585
dfa90fbc05bd
Group admin can edit any blog attributes.
HIROSE Yuuji <yuuji@gentei.org>
parents:
579
diff
changeset
|
281 -- GrpAdmin CAN EDIT heading since 2019-08-15 |
dfa90fbc05bd
Group admin can edit any blog attributes.
HIROSE Yuuji <yuuji@gentei.org>
parents:
579
diff
changeset
|
282 WHERE '$isgrpadmin' = 'true' |
dfa90fbc05bd
Group admin can edit any blog attributes.
HIROSE Yuuji <yuuji@gentei.org>
parents:
579
diff
changeset
|
283 OR (rowid=$rowid AND author='$user')), |
293
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
284 ''), |
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
285 max(CASE key WHEN 'ctime' THEN val END) ctime, |
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
286 max(CASE key WHEN 'heading' THEN hex(val) END) heading, |
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
287 CASE (SELECT val FROM $ts WHERE key="mode" AND id="$id") |
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
288 WHEN 'report-closed' THEN 'レポート提出用(closed)' |
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
289 WHEN 'report-open' THEN 'レポート提出用(open)' |
442 | 290 WHEN 'quiz' THEN 'クイズ' |
592 | 291 WHEN 'enquete' THEN '集計' |
293
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
292 ELSE '' |
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
293 END |
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
294 FROM $ts WHERE id='$id' GROUP BY id; |
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
295 EOF |
640
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
296 if test -s $midfile && IFS='|' read edit ctime hexhead blogtype < $midfile |
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
297 then |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
298 if [ -z "$fetch_ajax" ]; then # UUUUU |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
299 |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
300 cat<<-EOF |
648
8ec02e0fd1d5
Allow gethandout even if blog is in frozen mode.
HIROSE Yuuji <yuuji@gentei.org>
parents:
643
diff
changeset
|
301 <tr><td>${edit:+$href }$ctime $blogtype $href2${edit:+$href3} $href4 $href5</td></tr> |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
302 <tr class="preface${frozen_class:+ }$frozen_class"> |
632
c3e163403cdf
Do htmlescape in heading of blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
631
diff
changeset
|
303 <td>`echo "$hexhead"|unhexize|htmlescape|hreflink|minitbl`</td></tr> |
293
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
304 </table> |
6c281c9899e5
Allow WikiStyle notation in blog heading
HIROSE Yuuji <yuuji@gentei.org>
parents:
291
diff
changeset
|
305 EOF |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
306 case "$blogtype" in |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
307 "クイズ"|"XXXX集計") |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
308 echo "${blogtype}モードは本人と管理者の書き込みのみが表示されます。" |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
309 ;; |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
310 esac | html p 'class="warn"' |
801
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
311 |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
312 fi # UUUUU |
594
3dbb63414f0b
TEST: show all articles to everyone in enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
593
diff
changeset
|
313 if [ x"$blogtype" = x"クイズ" -o x"$blogtype" = x"XXXX集計" ]; then |
443
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
314 if $isgroup; then |
640
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
315 # Failsafe to query timeout |
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
316 qgrp=`sqlquote "$blogowner"` |
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
317 cat<<-EOF > $quizmodefile |
443
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
318 AND (author IN (SELECT user FROM grp_adm WHERE gname=$qgrp) |
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
319 OR |
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
320 author='$user') |
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
321 EOF |
720
f92df08e64ef
Use previously set variable instead of calling function
HIROSE Yuuji <yuuji@gentei.org>
parents:
707
diff
changeset
|
322 if $isgrpadmin; then # |
640
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
323 : > $quizmodefile |
443
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
324 fi |
640
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
325 else # if user-blog |
446
39823dfee44f
Display warning about quiz mode on the top of articles
HIROSE Yuuji <yuuji@gentei.org>
parents:
443
diff
changeset
|
326 if [ x"$user" != x"$blogowner" ]; then |
39823dfee44f
Display warning about quiz mode on the top of articles
HIROSE Yuuji <yuuji@gentei.org>
parents:
443
diff
changeset
|
327 cat<<-EOF > $quizmodefile |
39823dfee44f
Display warning about quiz mode on the top of articles
HIROSE Yuuji <yuuji@gentei.org>
parents:
443
diff
changeset
|
328 AND author IN ('$blogowner', '$user') |
39823dfee44f
Display warning about quiz mode on the top of articles
HIROSE Yuuji <yuuji@gentei.org>
parents:
443
diff
changeset
|
329 EOF |
39823dfee44f
Display warning about quiz mode on the top of articles
HIROSE Yuuji <yuuji@gentei.org>
parents:
443
diff
changeset
|
330 fi |
443
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
331 fi |
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
332 fi |
640
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
333 else # Cannot read SQL output |
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
334 echo "時間をおいて繋いでください(Please visit later)." | html p |
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
335 return |
b7aeab02d242
Check the SQL output size in case of DB timeout
HIROSE Yuuji <yuuji@gentei.org>
parents:
639
diff
changeset
|
336 fi |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
337 |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
338 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
|
339 lkedit="<a href=\"$myname?editart" |
263
ebd4af16c493
Old blog dumping code based on sq -html, removed entirely
HIROSE Yuuji <yuuji@gentei.org>
parents:
261
diff
changeset
|
340 hlink="$myname?home" elink="$myname?editart" |
ebd4af16c493
Old blog dumping code based on sq -html, removed entirely
HIROSE Yuuji <yuuji@gentei.org>
parents:
261
diff
changeset
|
341 catlink="$myname?showattc+article_m" |
ebd4af16c493
Old blog dumping code based on sq -html, removed entirely
HIROSE Yuuji <yuuji@gentei.org>
parents:
261
diff
changeset
|
342 deficon="img/file-icon.png" |
286
1c4f13f0813e
Add newer article flag representing by time string decoration.
HIROSE Yuuji <yuuji@gentei.org>
parents:
283
diff
changeset
|
343 # 2016-08-15 Newer flag introduced |
1c4f13f0813e
Add newer article flag representing by time string decoration.
HIROSE Yuuji <yuuji@gentei.org>
parents:
283
diff
changeset
|
344 atime=`query "SELECT time FROM acclog |
1c4f13f0813e
Add newer article flag representing by time string decoration.
HIROSE Yuuji <yuuji@gentei.org>
parents:
283
diff
changeset
|
345 WHERE tbl='blog' AND tblrowid=$rowid AND user='$user';"` |
333
002cc900200a
Nonexistent Icon cleaning is too heavy, put it after loop
HIROSE Yuuji <yuuji@gentei.org>
parents:
331
diff
changeset
|
346 iconcleaner=$tmpd/iconcleaner.$$ |
443
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
347 [ -s $quizmodefile ] && cond_qz=`cat $quizmodefile` |
442 | 348 # *** DO NOT USE query(), use "sq $db" instead here *** |
381
879d7f1cd676
More explanatory comment about previous commit.
HIROSE Yuuji <yuuji@gentei.org>
parents:
380
diff
changeset
|
349 # because the next block in pipe line uses query() repeatedly. |
629
b1ddb2559d77
TEST: Use intermediate file instead of query-pipe to shorten db-lock
HIROSE Yuuji <yuuji@gentei.org>
parents:
623
diff
changeset
|
350 ###### TEST: 2020-04-23 Use intermediate file to shorten duration of db-lock |
b1ddb2559d77
TEST: Use intermediate file instead of query-pipe to shorten db-lock
HIROSE Yuuji <yuuji@gentei.org>
parents:
623
diff
changeset
|
351 ###### sq $db<<EOF | |
b1ddb2559d77
TEST: Use intermediate file instead of query-pipe to shorten db-lock
HIROSE Yuuji <yuuji@gentei.org>
parents:
623
diff
changeset
|
352 query <<EOF > $midfile |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
353 WITH a_s AS ( |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
354 SELECT id, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
355 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
|
356 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
|
357 FROM article_s |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
358 GROUP by id |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
359 ) |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
360 SELECT a.id, |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
361 CASE author |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
362 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
|
363 ELSE '' |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
364 END edit, |
170
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
365 CASE -- 「通知送信」ボタンの有無 |
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
366 WHEN '$notifyto' = '' THEN '' -- 不要モードならなし |
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
367 WHEN '$user' = author THEN '' -- 筆者自身ならなし |
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
368 ELSE "yes" |
45d6954af516
TEST: notifyto button added for evaluation
HIROSE Yuuji <yuuji@gentei.org>
parents:
168
diff
changeset
|
369 END notify, |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
370 (SELECT rowid FROM user WHERE name=author) user_rid, |
570
9328392f7c55
Attach user account name as baloon on author icon and name
HIROSE Yuuji <yuuji@gentei.org>
parents:
559
diff
changeset
|
371 author, |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
372 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
|
373 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
|
374 author) uname, |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
304
diff
changeset
|
375 (SELECT val FROM user_s WHERE name=author AND key='$iconcachekey') |
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
304
diff
changeset
|
376 icon, |
183
b641b5393c40
TEST: Put rowid of article for convenience to reference
HIROSE Yuuji <yuuji@gentei.org>
parents:
170
diff
changeset
|
377 a.rowid, |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
378 s.TIME, |
571 | 379 CASE WHEN s.TIME < '2019-05' |
572
95f2b54ea6d5
Forgot to display time in Wareki
HIROSE Yuuji <yuuji@gentei.org>
parents:
571
diff
changeset
|
380 THEN printf('平成%d年%d月%d日%s', |
571 | 381 substr(s.TIME, 1, 4)-1988, |
382 substr(s.TIME, 6, 2), | |
572
95f2b54ea6d5
Forgot to display time in Wareki
HIROSE Yuuji <yuuji@gentei.org>
parents:
571
diff
changeset
|
383 substr(s.TIME, 9, 2), |
95f2b54ea6d5
Forgot to display time in Wareki
HIROSE Yuuji <yuuji@gentei.org>
parents:
571
diff
changeset
|
384 substr(s.TIME, 12) |
95f2b54ea6d5
Forgot to display time in Wareki
HIROSE Yuuji <yuuji@gentei.org>
parents:
571
diff
changeset
|
385 ) |
571 | 386 WHEN s.TIME < '2020' |
574
e4e207222ee9
Do not forget to display time
HIROSE Yuuji <yuuji@gentei.org>
parents:
573
diff
changeset
|
387 THEN printf('令和元年%d月%d日%s', |
571 | 388 substr(s.TIME, 6, 2), |
572
95f2b54ea6d5
Forgot to display time in Wareki
HIROSE Yuuji <yuuji@gentei.org>
parents:
571
diff
changeset
|
389 substr(s.TIME, 9, 2), |
95f2b54ea6d5
Forgot to display time in Wareki
HIROSE Yuuji <yuuji@gentei.org>
parents:
571
diff
changeset
|
390 substr(s.TIME, 12)) |
571 | 391 WHEN s.TIME < '2050' |
574
e4e207222ee9
Do not forget to display time
HIROSE Yuuji <yuuji@gentei.org>
parents:
573
diff
changeset
|
392 THEN printf('令和%d年%d月%d日%s', |
571 | 393 substr(s.TIME, 1, 4)-2018, |
394 substr(s.TIME, 6, 2), | |
572
95f2b54ea6d5
Forgot to display time in Wareki
HIROSE Yuuji <yuuji@gentei.org>
parents:
571
diff
changeset
|
395 substr(s.TIME, 9, 2), |
95f2b54ea6d5
Forgot to display time in Wareki
HIROSE Yuuji <yuuji@gentei.org>
parents:
571
diff
changeset
|
396 substr(s.TIME, 12)) |
571 | 397 ELSE s.TIME |
398 END reki, | |
286
1c4f13f0813e
Add newer article flag representing by time string decoration.
HIROSE Yuuji <yuuji@gentei.org>
parents:
283
diff
changeset
|
399 CASE WHEN s.TIME > '$atime' THEN 'new' ELSE '' END newer, |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
400 hex(s.TEXT), |
695
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
401 |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
402 $F_UNREADABLE cannotread, |
5cf0ba49aeab
Attached file of admin in quiz-mode blog can be accessible by normal users
HIROSE Yuuji <yuuji@gentei.org>
parents:
681
diff
changeset
|
403 |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
404 (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
|
405 FROM article_m |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
406 WHERE id=a.id AND key='image') imxgids |
443
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
407 FROM (select rowid,id,author from article |
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
408 where blogid in |
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
409 (select id from blog where rowid=$rowid) |
f1744a954888
New blog mode "quiz" introduced,
HIROSE Yuuji <yuuji@gentei.org>
parents:
442
diff
changeset
|
410 $cond_qz) a |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
411 LEFT JOIN |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
412 a_s s |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
413 ON a.id=s.id |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
414 ${fetch_ajax:+WHERE s.TIME > $fetch_ajax}; |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
415 EOF |
643 | 416 if [ $? -ne 0 -a ! -s $midfile ]; then |
642
209d74364eca
Typo of reply address, fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
641
diff
changeset
|
417 echo "時間をおいてください(Visit later please)." | html p |
209d74364eca
Typo of reply address, fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
641
diff
changeset
|
418 return |
209d74364eca
Typo of reply address, fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
641
diff
changeset
|
419 fi |
942 | 420 echo "${blog_math:+$mathjax}" |
803
45322d035c12
Link to "ShowAll" moved into blog_replies table
HIROSE Yuuji <yuuji@gentei.org>
parents:
801
diff
changeset
|
421 echo '<table class="blog_replies"> <!-- blog:blog_showentry() main table -->' |
807
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
422 # If, nLimit = 50 |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
423 # show article:1, hide(2, 3), show(4, ...) |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
424 # Therefore hide 2 or more article when narts>53 |
803
45322d035c12
Link to "ShowAll" moved into blog_replies table
HIROSE Yuuji <yuuji@gentei.org>
parents:
801
diff
changeset
|
425 narts=`wc -l < $midfile` |
807
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
426 if [ -n "$nlimit" -a "$narts" -gt "$((nlimit+2))" ]; then |
803
45322d035c12
Link to "ShowAll" moved into blog_replies table
HIROSE Yuuji <yuuji@gentei.org>
parents:
801
diff
changeset
|
427 newtop=`cat -n $midfile | grep "|new|" | head -1 | cut -f1` |
45322d035c12
Link to "ShowAll" moved into blog_replies table
HIROSE Yuuji <yuuji@gentei.org>
parents:
801
diff
changeset
|
428 if [ -n "$newtop" ]; then |
45322d035c12
Link to "ShowAll" moved into blog_replies table
HIROSE Yuuji <yuuji@gentei.org>
parents:
801
diff
changeset
|
429 afternew=$((narts-newtop+1)) |
807
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
430 [ $afternew -gt $((nlimit+2)) ] && nlimit=$((afternew+0)) |
803
45322d035c12
Link to "ShowAll" moved into blog_replies table
HIROSE Yuuji <yuuji@gentei.org>
parents:
801
diff
changeset
|
431 err Newtop=$newtop lines=$narts afternew=$afternew nlim=$nilmit |
45322d035c12
Link to "ShowAll" moved into blog_replies table
HIROSE Yuuji <yuuji@gentei.org>
parents:
801
diff
changeset
|
432 fi |
804
39e59b5b2131
Display ShowAll links only when $nlimit < $narts
HIROSE Yuuji <yuuji@gentei.org>
parents:
803
diff
changeset
|
433 fi |
807
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
434 if [ $nlimit -lt $((narts-2)) ]; then |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
435 n=0 |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
436 omitline=$td/omitline |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
437 #CAT="tail -n $nlimit" |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
438 CAT=cat |
803
45322d035c12
Link to "ShowAll" moved into blog_replies table
HIROSE Yuuji <yuuji@gentei.org>
parents:
801
diff
changeset
|
439 limitedmsg="<span class=\"warn\">※最新${nlimit}件のみの表示※</span>" |
801
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
440 showalllink="<a title=\"Show All\" href=\"?replyblog+$rowid+n:all\">全件表示</a>" |
807
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
441 cat<<-EOF > $omitline |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
442 <tr class="warn"> |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
443 <th>:<br>$limitedmsg<br>($((narts-$nlimit-1))件省略)<br>:</th> |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
444 <th>$showalllink</td></th> |
803
45322d035c12
Link to "ShowAll" moved into blog_replies table
HIROSE Yuuji <yuuji@gentei.org>
parents:
801
diff
changeset
|
445 EOF |
801
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
446 else |
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
447 CAT=cat |
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
448 fi |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
449 err "blog_showentry Started: `gdate +%S.%03N` ${fetch_ajax:+ajax}" |
801
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
450 # Start blog_replies table |
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
451 $CAT $midfile | |
942 | 452 while IFS='|' read -r id edit notify uid author uname icon aid \ |
571 | 453 tm reki new hte fa imgids |
557
591838015ac3
Put inaccessible mark on such attached file icon.
HIROSE Yuuji <yuuji@gentei.org>
parents:
513
diff
changeset
|
454 do |
807
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
455 if [ -n "$omitline" ]; then |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
456 n=$((n+1)) |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
457 if [ $n -eq 1 ]; then |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
458 : |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
459 elif [ $n -eq 2 ]; then |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
460 cat $omitline |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
461 continue |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
462 elif [ $n -lt $((narts-nlimit+1)) ]; then |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
463 continue |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
464 fi |
f5f3f932339b
Always showing article No.1
HIROSE Yuuji <yuuji@gentei.org>
parents:
805
diff
changeset
|
465 fi |
629
b1ddb2559d77
TEST: Use intermediate file instead of query-pipe to shorten db-lock
HIROSE Yuuji <yuuji@gentei.org>
parents:
623
diff
changeset
|
466 mf2=$tmpd/midfile2 |
407
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
467 cachefile="$td/$id.row.html" |
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
468 stampfile="$td/$id.row.stamp" |
408
138a0c6b09a7
Edit link in cached row file should be determined dynamically.
HIROSE Yuuji <yuuji@gentei.org>
parents:
407
diff
changeset
|
469 editlink="${edit:+<a href="$elink+$edit">編集</a> }" |
409
388639a80a23
Also notify rule in cached file should be generated dynamically.
HIROSE Yuuji <yuuji@gentei.org>
parents:
408
diff
changeset
|
470 nt="<label style=\"font-size: 70%;\"><input type=\"checkbox\"\ |
388639a80a23
Also notify rule in cached file should be generated dynamically.
HIROSE Yuuji <yuuji@gentei.org>
parents:
408
diff
changeset
|
471 name=\"notifyto\" value=\"$uid\">返信通知送信</label>" |
559
2f580c147434
File accessibility flag behavior corrected
HIROSE Yuuji <yuuji@gentei.org>
parents:
557
diff
changeset
|
472 # fa is file accessibility flag # err "----r=$aid fa=[$fa]----" |
406
1af18eeeffb3
Cache strategy revised to trace icon cache renewal
HIROSE Yuuji <yuuji@gentei.org>
parents:
405
diff
changeset
|
473 |
1af18eeeffb3
Cache strategy revised to trace icon cache renewal
HIROSE Yuuji <yuuji@gentei.org>
parents:
405
diff
changeset
|
474 # First, check the availability of user-icon. |
1af18eeeffb3
Cache strategy revised to trace icon cache renewal
HIROSE Yuuji <yuuji@gentei.org>
parents:
405
diff
changeset
|
475 # If not existent, clear and reset row cache by rm $stampfile |
407
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
476 if [ ! -s "$icon" ]; then |
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
477 rm -f "$stampfile"; unset stampfile |
406
1af18eeeffb3
Cache strategy revised to trace icon cache renewal
HIROSE Yuuji <yuuji@gentei.org>
parents:
405
diff
changeset
|
478 fi |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
479 if test -s "$stampfile" && |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
480 test -s "$cachefile" && |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
481 { ts=`cat "$stampfile"`; test -n "$ts"; } && |
707
19ee38a90e22
Call /bin/test for "string > string'
HIROSE Yuuji <yuuji@gentei.org>
parents:
704
diff
changeset
|
482 /bin/test "$ts" '>' "$tm" && # Cache timestamp is newer |
422
a868a34ca3bc
Do not use article cache when user-icon is newer than cache.
HIROSE Yuuji <yuuji@gentei.org>
parents:
421
diff
changeset
|
483 test "$stampfile" -nt "$icon"; then # UserIcon is older |
a868a34ca3bc
Do not use article cache when user-icon is newer than cache.
HIROSE Yuuji <yuuji@gentei.org>
parents:
421
diff
changeset
|
484 : Nothing to do |
322
18be0c210dc8
First implementation of icon display in blog_replies.
HIROSE Yuuji <yuuji@gentei.org>
parents:
304
diff
changeset
|
485 else |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
486 { ######## New ROW creation begins here ######## >$cachefile |
641
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
487 cachestamp=$tmpd/cache.$$.stamp |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
488 touch $cachestamp |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
489 tdcls="__NEWCLS__repatt" |
407
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
490 if [ -s "$icon" ]; then |
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
491 icfn=`echo "$icon"|htmlescape` |
570
9328392f7c55
Attach user account name as baloon on author icon and name
HIROSE Yuuji <yuuji@gentei.org>
parents:
559
diff
changeset
|
492 picon="<p class=\"proficon\"><a href=\"$hlink+$uid\" title=\"${author%@*}\"><img src=\"$icfn\"></a></p>" |
407
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
493 else |
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
494 echo "DELETE FROM user_s WHERE key='$iconcachekey' AND |
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
495 val=`sqlquotestr \"$icon\"`;" >> $iconcleaner |
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
496 picon="" |
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
497 fi |
406
1af18eeeffb3
Cache strategy revised to trace icon cache renewal
HIROSE Yuuji <yuuji@gentei.org>
parents:
405
diff
changeset
|
498 |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
499 cat<<EOF |
283 | 500 <tr id="$id"> |
420
0f6b4939ee8f
Placehold link is not effective. So replace it to normal link.
HIROSE Yuuji <yuuji@gentei.org>
parents:
419
diff
changeset
|
501 <td class="$tdcls">${picon}__EDIT__<a href="#$aid">#$aid</a> |
749 | 502 <a href="$hlink+$uid" title="${author%@*}">`echo $uname|htmlescape`</a> |
571 | 503 <span title="$tm">${reki:-$tm}</span> |
409
388639a80a23
Also notify rule in cached file should be generated dynamically.
HIROSE Yuuji <yuuji@gentei.org>
parents:
408
diff
changeset
|
504 <__NOTIFY__></td> |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
505 EOF |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
506 echo -n "<td id=\"$aid\" class=\"repl\">" |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
507 echo "$hte"|unhexize|htmlescape|hreflink|minitbl |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
508 usecache='' tsfile=$td/$id.stamp |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
509 for i in $imgids; do |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
510 mrid=${i%%:*}; i=${i#*:}; sz=`size_h ${i%%:*}` |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
511 _href="href=\"$catlink+$mrid\"" |
939
6c2f8bb3cc6e
Activate direct link to attached files
HIROSE Yuuji <yuuji@gentei.org>
parents:
924
diff
changeset
|
512 _href_raw="href=\"$catlink+$mrid+raw\"" |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
513 fn=`echo "${i#*:}"|unhexize` |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
514 fnb=$fn"(${sz})" |
263
ebd4af16c493
Old blog dumping code based on sq -html, removed entirely
HIROSE Yuuji <yuuji@gentei.org>
parents:
261
diff
changeset
|
515 case "$fn" in |
407
4d912c2d48df
Little bit spped up the judgement on necessity of cache re-creation
HIROSE Yuuji <yuuji@gentei.org>
parents:
406
diff
changeset
|
516 *.[Pp][Nn][Gg]|*.[Jj][Pp][Gg]|*.[Jj][Pp][Ee][Gg]|*.[GgTt][Ii][Ff]) |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
517 # fmt=${fn##*.} # convert - jpg:- is slow...why |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
518 case "$fn" in |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
519 *.[Pp][Nn][Gg]) fmt=png ;; |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
520 *.[Gg][Ii][Ff]) fmt=gif ;; |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
521 *) fmt=jpeg ;; |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
522 esac |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
523 outfile=$td/$mrid-${fn%.*}.$fmt |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
524 #err fn=$fn outfile=$outfile |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
525 #err "usecache=$usecache `ls -l $outfile`" |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
526 #err tm=$tm |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
527 #err tsfile=$tsfile=`cat $tsfile` |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
528 if [ -s "$outfile" ] && # $outfile should be > 0 |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
529 { [ "$usecache" ] || # And usecache flag is true, or... |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
530 { [ -s "$tsfile" ] && [ x"`cat $tsfile`" = x"$tm" ] |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
531 };}; then |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
532 usecache=1 # Set usecache flag on |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
533 cat<<-EOF |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
534 <__UNCLICKABLE__><a $_href><img src="$outfile"> |
264
9131c7e09112
Use cache file for article images.
HIROSE Yuuji <yuuji@gentei.org>
parents:
263
diff
changeset
|
535 $fnb</a> |
9131c7e09112
Use cache file for article images.
HIROSE Yuuji <yuuji@gentei.org>
parents:
263
diff
changeset
|
536 EOF |
404
084a4d35c98f
Create row stamp ONLY WHEN imgcache is active
HIROSE Yuuji <yuuji@gentei.org>
parents:
403
diff
changeset
|
537 # !!NOTE!! Create row stamp ONLY WHEN imgcache is active |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
538 else |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
539 query "SELECT hex(bin) FROM article_m WHERE rowid=$mrid;" \ |
629
b1ddb2559d77
TEST: Use intermediate file instead of query-pipe to shorten db-lock
HIROSE Yuuji <yuuji@gentei.org>
parents:
623
diff
changeset
|
540 > $mf2 # Stop query here 2020-04-23 |
641
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
541 if cat $mf2 | unhexize \ |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
542 | convert -define ${fmt}:size=100x100 -resize 100x100'>' \ |
641
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
543 - ${fmt}:- > $outfile |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
544 then |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
545 cat "$outfile" \ |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
546 | hexize \ |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
547 | sed -e 's/\(..\)/%\1/g' \ |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
548 -e "s|^|<__UNCLICKABLE__><a $_href><img src=\"data:image/$fmt,|" \ |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
549 -e "s|\$|\">$fnb</a>|" |
641
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
550 unset stampfile # img data stream is not suitable to cache |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
551 echo $tm > $tsfile |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
552 else # Failed to convert |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
553 rm -f $outfile |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
554 echo "<__UNCLICKABLE__><a $_href>$fnb</a>" |
641
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
555 fi |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
556 fi |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
557 ;; |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
558 *) |
939
6c2f8bb3cc6e
Activate direct link to attached files
HIROSE Yuuji <yuuji@gentei.org>
parents:
924
diff
changeset
|
559 echo -n "<__UNCLICKABLE__><a $_href><img src=\"$deficon\">$fnb</a>" |
6c2f8bb3cc6e
Activate direct link to attached files
HIROSE Yuuji <yuuji@gentei.org>
parents:
924
diff
changeset
|
560 echo "[<a ${_href_raw}>Direct</a>]" |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
561 ;; |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
562 esac |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
563 done |
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
564 echo "</td></tr>" |
641
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
565 } > "$cachefile.$$" ######## New ROW Creation Ends here ######## |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
566 # Care about race condition |
800 | 567 if [ -z "$hte" -a -s $cachefile -a $cachefile -nt $cachestamp ]; then |
641
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
568 # If other process have created cache, give up to serve our file |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
569 rm -f $cachefile.$$ |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
570 else |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
571 mv -f $cachefile.$$ $cachefile |
a1bcb043589e
Cache file creation cares concurrent creation by other processes
HIROSE Yuuji <yuuji@gentei.org>
parents:
640
diff
changeset
|
572 fi |
406
1af18eeeffb3
Cache strategy revised to trace icon cache renewal
HIROSE Yuuji <yuuji@gentei.org>
parents:
405
diff
changeset
|
573 test -n "$stampfile" && date "+%F %T" > $stampfile |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
574 fi |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
575 if [ -n "$fa" ]; then |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
576 replhref="s/a href=[^>]*>/a>/" |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
577 else |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
578 replhref="" |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
579 fi |
403
3ea86fe63490
Introduce row-cache for replyblog()
HIROSE Yuuji <yuuji@gentei.org>
parents:
402
diff
changeset
|
580 # Printing a cached row |
409
388639a80a23
Also notify rule in cached file should be generated dynamically.
HIROSE Yuuji <yuuji@gentei.org>
parents:
408
diff
changeset
|
581 sed -e "/^<td class=/s/__NEWCLS__/$new${new:+ }/" \ |
388639a80a23
Also notify rule in cached file should be generated dynamically.
HIROSE Yuuji <yuuji@gentei.org>
parents:
408
diff
changeset
|
582 -e "/^<td class=/s,__EDIT__,$editlink," \ |
388639a80a23
Also notify rule in cached file should be generated dynamically.
HIROSE Yuuji <yuuji@gentei.org>
parents:
408
diff
changeset
|
583 -e "/^<__NOTIFY__>/s,,${notify:+$nt}," \ |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
584 ${replhref:+-e "/^<__UNCLICKABLE__>/$replhref"} \ |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
585 ${replhref:+-e "/^<__UNREADABLE__>/$replhref"} \ |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
586 -e "/<__UNCLICKABLE__>/s///" \ |
559
2f580c147434
File accessibility flag behavior corrected
HIROSE Yuuji <yuuji@gentei.org>
parents:
557
diff
changeset
|
587 -e "/<__UNREADABLE__>/s,,${fa:+$cannotread}," \ |
408
138a0c6b09a7
Edit link in cached row file should be determined dynamically.
HIROSE Yuuji <yuuji@gentei.org>
parents:
407
diff
changeset
|
588 $cachefile |
263
ebd4af16c493
Old blog dumping code based on sq -html, removed entirely
HIROSE Yuuji <yuuji@gentei.org>
parents:
261
diff
changeset
|
589 done |
452
30ab12e54324
Ballon help for s4-WikiStyle added
HIROSE Yuuji <yuuji@gentei.org>
parents:
451
diff
changeset
|
590 |
843
a0dcf6477310
Add markdown conversion of <ol>
HIROSE Yuuji <yuuji@gentei.org>
parents:
838
diff
changeset
|
591 help="=== コメントに使用できる特殊記法(記号は全て半角) === |
452
30ab12e54324
Ballon help for s4-WikiStyle added
HIROSE Yuuji <yuuji@gentei.org>
parents:
451
diff
changeset
|
592 行頭に href=URL でURLへのリンク |
30ab12e54324
Ballon help for s4-WikiStyle added
HIROSE Yuuji <yuuji@gentei.org>
parents:
451
diff
changeset
|
593 行頭に iframe=URL でURL先を開く iframe |
843
a0dcf6477310
Add markdown conversion of <ol>
HIROSE Yuuji <yuuji@gentei.org>
parents:
838
diff
changeset
|
594 行頭「* 」で箇条書、次の行頭空白で継続、行頭詰めると箇条書終わり |
a0dcf6477310
Add markdown conversion of <ol>
HIROSE Yuuji <yuuji@gentei.org>
parents:
838
diff
changeset
|
595 行頭「1. 」で番号付、2行目以降も「1. 」で勝手に番号増える、行頭詰めで終わり |
452
30ab12e54324
Ballon help for s4-WikiStyle added
HIROSE Yuuji <yuuji@gentei.org>
parents:
451
diff
changeset
|
596 [[#記事番号]] でs4内の記事番号に飛ぶリンク |
479
077dc1763239
Inhibit escaping required chars from hash-tag search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
474
diff
changeset
|
597 [[#検索キーワード]] でs4内の記事検索(記号はいくつか使えない) |
495
59cd8278a5b5
Trailing 2 consecutive SPC will be translated to <br>
HIROSE Yuuji <yuuji@gentei.org>
parents:
493
diff
changeset
|
598 [[URL]] でURLへのリンク、 [[URL|文字列]]でアンカー文字列指定 |
59cd8278a5b5
Trailing 2 consecutive SPC will be translated to <br>
HIROSE Yuuji <yuuji@gentei.org>
parents:
493
diff
changeset
|
599 {{画像URL}} でインライン画像、 {{画像URL|幅}} でピクセル幅指定 |
59cd8278a5b5
Trailing 2 consecutive SPC will be translated to <br>
HIROSE Yuuji <yuuji@gentei.org>
parents:
493
diff
changeset
|
600 {{{URL}}} でURL先を開く iframe、 {{{URL|高さ}}} ピクセル高さ指定 |
59cd8278a5b5
Trailing 2 consecutive SPC will be translated to <br>
HIROSE Yuuji <yuuji@gentei.org>
parents:
493
diff
changeset
|
601 行頭: ## 大見出し, ### 中見出し, #### 小見出し |
59cd8278a5b5
Trailing 2 consecutive SPC will be translated to <br>
HIROSE Yuuji <yuuji@gentei.org>
parents:
493
diff
changeset
|
602 行末の2連続スペースで強制改行(<br>) |
487
b17bdc798dc5
Help for emphasizing notations
HIROSE Yuuji <yuuji@gentei.org>
parents:
479
diff
changeset
|
603 |*見出し列|列2|列3… と行頭から始まる縦棒区切り行を続けて表 |
503 | 604 ' *語群* ' で強調(両側の空白必要、** でもっと強調。*の代わりに _ でも可) |
605 - [ ] と - [x] でチェックボックス" | |
452
30ab12e54324
Ballon help for s4-WikiStyle added
HIROSE Yuuji <yuuji@gentei.org>
parents:
451
diff
changeset
|
606 touchhelp="${touchpanel:+<p class=\"help\">$help</p>}" |
513 | 607 filehelp="《添付の注意》 |
608 $file_accept_help" | |
878
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
609 ntmode="通知モード=$blog_notify${blog_team:+ (team=$blog_team)} |
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
610 記事の1行目を「## 」(半角シャープシャープ空白=大見出し) |
884
4e755437dbcb
Fix tooltip help more precise
HIROSE Yuuji <yuuji@gentei.org>
parents:
879
diff
changeset
|
611 にするとそれより後ろの部分がSubject(件名)になります。 |
878
85a20c87bf97
Use the "## "heading in the first as Subject of notification email.
HIROSE Yuuji <yuuji@gentei.org>
parents:
875
diff
changeset
|
612 If the first line begins with "## ", sent it as Subject of email." |
837
a6462eea48be
Multiple files upload for tablets added and file renaming fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
823
diff
changeset
|
613 textform=$(cat<<-EOF |
a6462eea48be
Multiple files upload for tablets added and file renaming fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
823
diff
changeset
|
614 <div class="fold"> |
341 | 615 <input type="checkbox" id="cmt" checked><label |
616 accesskey="c" title="C" for="cmt">コメントする</label><div> | |
193 | 617 <table class="b"> |
837
a6462eea48be
Multiple files upload for tablets added and file renaming fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
823
diff
changeset
|
618 <tr><td><textarea id="text" name="text" cols="72" rows="4" title="$help"> |
a6462eea48be
Multiple files upload for tablets added and file renaming fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
823
diff
changeset
|
619 </textarea>$touchhelp</td></tr> |
a6462eea48be
Multiple files upload for tablets added and file renaming fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
823
diff
changeset
|
620 <tr><td>添付ファイル(${filesize_max_MB}以下): |
a6462eea48be
Multiple files upload for tablets added and file renaming fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
823
diff
changeset
|
621 `cgi_file image "" "$file_accept title=\"$filehelp\" multiple"` |
a6462eea48be
Multiple files upload for tablets added and file renaming fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
823
diff
changeset
|
622 </td></tr> |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
623 </table> |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
624 <input type="hidden" name="fetchtime" value="`date +%FT%T`"> |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
625 <input type="hidden" name="filesize_max" value="$filesize_max"> |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
626 <input type="submit" id="c" value="送信" class="$blog_notify" title="$ntmode"> |
193 | 627 <input type="reset" value="リセット"></div></div> |
837
a6462eea48be
Multiple files upload for tablets added and file renaming fixed
HIROSE Yuuji <yuuji@gentei.org>
parents:
823
diff
changeset
|
628 EOF |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
629 ) |
219
e2dea2f63a69
Duplicate posting by reload avoided
HIROSE Yuuji <yuuji@gentei.org>
parents:
208
diff
changeset
|
630 cat<<-EOF |
239
25e0b1eaf04d
Degrade fixed: Explicit notify works again.
HIROSE Yuuji <yuuji@gentei.org>
parents:
238
diff
changeset
|
631 </table> <!-- end of s4-blog:blog_showentry() main table --> |
900
1fa8b4440f8f
Update button changed to ajax
HIROSE Yuuji <yuuji@gentei.org>
parents:
898
diff
changeset
|
632 <p class="update_link"><a href="?reload/$rowid" accesskey="r" |
908 | 633 title="Shortcut: R${nl}Get New"> |
634 <button id="reload">最新取得</button></a> / <a | |
704
e6f88f9e7dfd
Add more shortcuts and baloon help messages
HIROSE Yuuji <yuuji@gentei.org>
parents:
702
diff
changeset
|
635 href="#title" id="bottom" accesskey="t" |
801
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
636 title="Shortcut: T${nl}to the Top">先頭へ</a> |
823
ab6bb3efd40e
Showall link at the bottom points to also bottom
HIROSE Yuuji <yuuji@gentei.org>
parents:
819
diff
changeset
|
637 ${showalllink:+/ `echo $showalllink|sed 's/n:all/&\#bottom/'`$limitedmsg}</p> |
219
e2dea2f63a69
Duplicate posting by reload avoided
HIROSE Yuuji <yuuji@gentei.org>
parents:
208
diff
changeset
|
638 EOF |
e2dea2f63a69
Duplicate posting by reload avoided
HIROSE Yuuji <yuuji@gentei.org>
parents:
208
diff
changeset
|
639 $iswritable && cat<<-EOF |
e2dea2f63a69
Duplicate posting by reload avoided
HIROSE Yuuji <yuuji@gentei.org>
parents:
208
diff
changeset
|
640 <div class="blogcomment"> |
239
25e0b1eaf04d
Degrade fixed: Explicit notify works again.
HIROSE Yuuji <yuuji@gentei.org>
parents:
238
diff
changeset
|
641 <input type="hidden" name="blogid" value="$id"> |
268
138da0f3a2e5
Duplicate post by reloading or back+submit, dissolved
HIROSE Yuuji <yuuji@gentei.org>
parents:
264
diff
changeset
|
642 <input type="hidden" name="id" value="`genserial`"> |
239
25e0b1eaf04d
Degrade fixed: Explicit notify works again.
HIROSE Yuuji <yuuji@gentei.org>
parents:
238
diff
changeset
|
643 <input type="hidden" name="stage" value="replyblog"> |
25e0b1eaf04d
Degrade fixed: Explicit notify works again.
HIROSE Yuuji <yuuji@gentei.org>
parents:
238
diff
changeset
|
644 $textform |
25e0b1eaf04d
Degrade fixed: Explicit notify works again.
HIROSE Yuuji <yuuji@gentei.org>
parents:
238
diff
changeset
|
645 </div> |
25e0b1eaf04d
Degrade fixed: Explicit notify works again.
HIROSE Yuuji <yuuji@gentei.org>
parents:
238
diff
changeset
|
646 </form> <!-- End of s4-blog:blog_showentry() main form --> |
25e0b1eaf04d
Degrade fixed: Explicit notify works again.
HIROSE Yuuji <yuuji@gentei.org>
parents:
238
diff
changeset
|
647 EOF |
333
002cc900200a
Nonexistent Icon cleaning is too heavy, put it after loop
HIROSE Yuuji <yuuji@gentei.org>
parents:
331
diff
changeset
|
648 # Clean up orphaned icon cache |
406
1af18eeeffb3
Cache strategy revised to trace icon cache renewal
HIROSE Yuuji <yuuji@gentei.org>
parents:
405
diff
changeset
|
649 [ -s $iconcleaner ] && query ".read '$iconcleaner'" |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
650 # Record access log |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
651 acclog blog $rowid |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
652 err "blog_showentry Finished: `gdate +%S.%03N` ${fetch_ajax:+ajax}" |
154
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
653 } |
75598f2d3118
TEST: blog_showentry2 - constructing loop by output from single SQL
HIROSE Yuuji <yuuji@gentei.org>
parents:
138
diff
changeset
|
654 |
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
|
655 lshandout() { |
749 | 656 # $1=rowid of blog (numericalized in s4.cgi) |
401
6dc23f0b7279
Allow lshandout on frozen board
HIROSE Yuuji <yuuji@gentei.org>
parents:
399
diff
changeset
|
657 blog_writable $1 $user |
461
d7b23ad0e2e8
Variable name error, fixed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
455
diff
changeset
|
658 rc=$? # =0: writable, $BLOG_NOTMEM bit set => not member |
401
6dc23f0b7279
Allow lshandout on frozen board
HIROSE Yuuji <yuuji@gentei.org>
parents:
399
diff
changeset
|
659 if [ $((rc & $BLOG_NOTMEM)) -gt 0 ] ; then |
64
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
660 echo "メンバー以外は利用できません。" | html p; return |
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
661 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
|
662 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
|
663 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
|
664 title=`getvalbyid blog title $1` |
749 | 665 ge=`gecos "$owner"` |
942 | 666 htmlowner=`printf '%s' "${ge:-$owner}"|htmlescape` |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
667 fh=$tmpd/formhead |
749 | 668 echo "$time [$title]@$htmlowner" > $fh |
669 lshandoutsub "$owner" "$@" \ | |
189 | 670 |_m4 -D_TITLE_="提出状況" \ |
838
985ee9a09783
Hyperlinks in TITLE cannot be used..
HIROSE Yuuji <yuuji@gentei.org>
parents:
837
diff
changeset
|
671 -D_H1_="提出状況" \ |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
672 -D_FORMHEAD_="syscmd(cat $fh)" \ |
189 | 673 -D_FORM_="syscmd(cat)" -D_DUMPHEAD_= -D_DUMPTABLE_= \ |
674 $layout/html.m4.html $layout/form+dump-whead.m4.html | |
942 | 675 gn=`printf '%s' "$owner"|htmlescape` |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
676 echo "<p><a href=\"?lshandoutall+$1\">グループ $gn すべてのレポート板集計</a></p>" |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
677 } |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
678 gethandoutcsv() { |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
679 # contenttype; echo |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
680 CATCSV=1 lshandoutall "$1" |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
681 } |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
682 gethandoutcsv2() { |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
683 # contenttype; echo |
557
591838015ac3
Put inaccessible mark on such attached file icon.
HIROSE Yuuji <yuuji@gentei.org>
parents:
513
diff
changeset
|
684 SQL=$(cat<<-EOF |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
685 WITH this_blog_articles AS ( |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
686 SELECT rtb.id bid, rtb.brid, a.id aid, author, title, ctime |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
687 FROM report_type_blogs rtb JOIN article a ON rtb.id=a.blogid |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
688 ), text_or_file AS ( |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
689 SELECT bid, author, title, ctime, 'text' shu, count(val) cnt |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
690 FROM this_blog_articles tba, article_s s |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
691 ON tba.aid=s.id |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
692 WHERE key='text' |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
693 GROUP by bid, author |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
694 UNION |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
695 SELECT bid, author, title, ctime, 'file' shu, count(val) cnt |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
696 FROM this_blog_articles tba, article_m m |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
697 ON tba.aid=m.id |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
698 WHERE key='image' |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
699 GROUP by bid, author |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
700 ), count_list AS ( |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
701 SELECT author, |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
702 substr(ctime, 1, 10)||upper(substr(shu, 1, 1)) unit, |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
703 cnt |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
704 FROM text_or_file |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
705 ) |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
706 SELECT gecos "名前", |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
707 substr(author, 1, instr(author, '@')-1) "uname", |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
708 unit, |
374
59e31510f574
Avoid to use "count" as column name(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
373
diff
changeset
|
709 cnt "post" |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
710 FROM count_list cl JOIN gecoses g ON cl.author=g.name; |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
711 EOF |
557
591838015ac3
Put inaccessible mark on such attached file icon.
HIROSE Yuuji <yuuji@gentei.org>
parents:
513
diff
changeset
|
712 ) gethandoutcsv "$1" |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
713 } |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
714 lshandout_ulink_table() { |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
715 # NO Args. Read stdin as SQL |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
716 echo '<table class="b td3rr td3evw">' |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
717 hrb="<a href=\"?home+" |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
718 # echo "$sql" | sq -header -html $db \ # Formerly, this is called via sq() |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
719 |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
720 printf ".mode html\n.header ON\n" | query |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
721 cat | query \ |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
722 | sed -e "s,\(<TR><TD>\)\([^ ]*\) \(.*\)</TD>,\1$hrb\2\">\3</TD>," -e 's,<TD>0</TD>,<TD class="warn">0</TD>,' |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
723 echo '</table>' |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
724 printf ".mode list\n.header OFF\n" | query |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
725 } |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
726 lshandoutall() { |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
727 # $1=rowid of blog |
402
58c291b6a81f
Allow lshandoutall and gethandout on frozen board
HIROSE Yuuji <yuuji@gentei.org>
parents:
401
diff
changeset
|
728 blog_writable $1 $user |
461
d7b23ad0e2e8
Variable name error, fixed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
455
diff
changeset
|
729 rc=$? # =0: writable, $BLOG_NOTMEM bit set => not member |
402
58c291b6a81f
Allow lshandoutall and gethandout on frozen board
HIROSE Yuuji <yuuji@gentei.org>
parents:
401
diff
changeset
|
730 if [ $((rc & $BLOG_NOTMEM)) -gt 0 ] ; then |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
731 echo "メンバー以外は利用できません。" | html p; return |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
732 fi |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
733 rowid=$(($1 + 0)) |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
734 owner=`getvalbyid blog owner $1` |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
735 qowner=`sqlquotestr "$owner"` |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
736 |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
737 query<<-EOF |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
738 CREATE TEMPORARY TABLE IF NOT EXISTS report_type_blogs AS |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
739 WITH blog_owner_mode AS ( |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
740 SELECT id, |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
741 blog.rowid brid, |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
742 max(CASE key WHEN 'owner' THEN val END) owner, |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
743 max(CASE key WHEN 'mode' THEN val END) mode, |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
744 max(CASE key WHEN 'title' THEN val END) title, |
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
745 max(CASE key WHEN 'ctime' THEN val END) ctime |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
746 FROM blog NATURAL JOIN blog_s |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
747 GROUP BY id |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
748 ) |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
749 SELECT id, brid, title, ctime FROM blog_owner_mode |
493
d879d9d1acb7
Assume quiz board as report because we need handout-summary on quiz.
HIROSE Yuuji <yuuji@gentei.org>
parents:
488
diff
changeset
|
750 /* WHERE owner=$qowner AND mode LIKE '%report%'; */ |
d879d9d1acb7
Assume quiz board as report because we need handout-summary on quiz.
HIROSE Yuuji <yuuji@gentei.org>
parents:
488
diff
changeset
|
751 WHERE owner=$qowner |
d879d9d1acb7
Assume quiz board as report because we need handout-summary on quiz.
HIROSE Yuuji <yuuji@gentei.org>
parents:
488
diff
changeset
|
752 AND |
592 | 753 (mode LIKE '%report%' OR mode LIKE '%quiz%' |
754 OR mode LIKE '%enquete%'); | |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
755 /* ↑これでレポート形式の blogid 一覧を得る */ |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
756 EOF |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
757 if [ -z "$CATCSV" ]; then |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
758 _m4 -D_TITLE_="提出状況" $layout/html.m4.html |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
759 ge=`gecos "$owner"` |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
760 tbls="" |
942 | 761 grptxt=`printf '%s' "${ge:-$owner}"|htmlescape` |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
762 echo "<h1>$grptxt 書き込み状況一覧</h1>" |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
763 fi |
375
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
764 if [ -z "$SQL" ]; then |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
765 bridlist=`query "SELECT brid FROM report_type_blogs;"` |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
766 for brid in $bridlist; do # Skip this loop if $SQL set |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
767 brid=$(($brid + 0)) # Ensure to be a number |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
768 [ $brid = 0 ] && continue |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
769 time=`getvalbyid blog ctime $brid|colrm 11` |
920
7149f283294b
Header string in SQL should not be htmlescaped
HIROSE Yuuji <yuuji@gentei.org>
parents:
908
diff
changeset
|
770 title=`getvalbyid blog title $brid` |
942 | 771 titleH=`printf '%s' "$title"|htmlescape` |
399
db25589d864c
Add frozen tag to lshandoutall listings
HIROSE Yuuji <yuuji@gentei.org>
parents:
397
diff
changeset
|
772 state=`getvalbyid blog state $brid|htmlescape` |
375
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
773 tt="handout_$brid" |
399
db25589d864c
Add frozen tag to lshandoutall listings
HIROSE Yuuji <yuuji@gentei.org>
parents:
397
diff
changeset
|
774 [ "$state" = "frozen" ] && frozen=" $FROZEN_TAG" || frozen="" |
375
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
775 if [ -z "$CATCSV" ]; then |
920
7149f283294b
Header string in SQL should not be htmlescaped
HIROSE Yuuji <yuuji@gentei.org>
parents:
908
diff
changeset
|
776 echo "<h2>$time - <a href=\"?replyblog+$brid\">$titleH</a>$frozen</h2>" |
375
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
777 lshandoutsub "$owner" $brid "$tt" |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
778 else |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
779 lshandoutsub "$owner" $brid "$tt" >/dev/null # Only create temp.table |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
780 fi |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
781 tbls="$tbls${tbls:+ NATURAL JOIN }$tt" |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
782 done |
b971fa6ebcb1
Do not call lshandoutsub if $SQL set(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
374
diff
changeset
|
783 fi |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
784 sql=${SQL:-"SELECT * FROM $tbls;"} |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
785 if [ -z "$CATCSV" ]; then |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
786 echo "<hr><h2>総合</h2>" |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
787 echo "$sql" | lshandout_ulink_table |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
788 echo "<h2>総合(<a href=\"?gethandoutcsv+$rowid\">CSV</a>)</h2>" |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
789 printf ".mode csv\n.header ON\n" | query |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
790 echo '<pre class="list">' |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
791 echo "$sql" | query | sed 's/^"[0-9]* /"/' |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
792 echo "</pre>" |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
793 echo "<pre><a href=\"?gethandoutcsv2+$rowid\">縦持ちCSV</a></pre>" |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
794 else |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
795 contenttype "Application/CSV" |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
796 printf ".mode csv\n.header ON\n" | query >/dev/null |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
797 fn=report-count.csv |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
798 printf 'Content-Disposition: filename="%s"\n' "$fn" |
379 | 799 outfile=$tmpd/out-$$.csv |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
800 echo "$sql" | query | sed 's/^"[0-9]* /"/' > $outfile |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
801 echo "Content-Length: " `cat $outfile | wc -c`; echo |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
802 |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
803 cat $outfile |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
804 exit 0 |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
805 fi |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
806 printf ".mode list\n.header OFF\n.separator |\n" | query |
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
|
807 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
808 lshandoutsub() { |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
809 # $1=owner $2=rowid of blog &optional $3=temp_table name |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
810 qgname=`sqlquote "$1"` |
436
e1bdad674c09
Quote arguments that hold group name.
HIROSE Yuuji <yuuji@gentei.org>
parents:
432
diff
changeset
|
811 if isgroup "$1"; then |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
812 sample="(select user from grp_mem where gname=$qgname)" |
2 | 813 else |
814 sample="(select distinct author as user from arts)" | |
67 | 815 echo "(集計は板への投稿者のみ)" | html p |
2 | 816 fi |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
817 tmpname="${3:-handout_$2}" |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
818 sql="CREATE TEMPORARY TABLE IF NOT EXISTS $tmpname AS |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
819 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
|
820 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
|
821 select (select rowid from user where name=c0.user)||' '|| \ |
366
884cd7c66917
Use gecoses table instead of coalesce().
HIROSE Yuuji <yuuji@gentei.org>
parents:
365
diff
changeset
|
822 (select gecos from gecoses where name=c0.user) as 'メンバー',\ |
373
57a2e6acf005
Add link to creating normalized csv(gethandoutcsv2)
HIROSE Yuuji <yuuji@gentei.org>
parents:
369
diff
changeset
|
823 substr(c0.user, 1, instr(c0.user, '@')-1) 'uname',\ |
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
|
824 sum(case when c1.key is not null then 1 else 0 end)\ |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
825 as '[$title] コメント記入',\ |
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
|
826 sum(case when c2.key is not null then 1 else 0 end)\ |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
827 as '[$title] ファイルの提出'\ |
2 | 828 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
|
829 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
|
830 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
|
831 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
|
832 on a.id=c1.id left join (select id,key from article_m ) c2\ |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
833 on c1.id=c2.id group by c0.user order by c0.user;\ |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
834 \ |
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
835 SELECT * FROM $tmpname;" |
597
85fe09f92e13
Suppress SQL debug-out at ishandoutsub.
HIROSE Yuuji <yuuji@gentei.org>
parents:
595
diff
changeset
|
836 # err ishandoutsub: sql="$sql" |
369
5f01ead0174f
Add feature of scoring up all report-style blogs.
HIROSE Yuuji <yuuji@gentei.org>
parents:
367
diff
changeset
|
837 echo "$sql" | lshandout_ulink_table |
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
|
838 } |
2 | 839 gethandout() { |
840 # $1=rowid of blog | |
579
6e727ab07c98
Sanitize argument from cgi with numericalize()
HIROSE Yuuji <yuuji@gentei.org>
parents:
574
diff
changeset
|
841 rid=`numericalize "$1"` |
866
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
842 test x"$2" = x"by_uname" && by_uname="$2" |
579
6e727ab07c98
Sanitize argument from cgi with numericalize()
HIROSE Yuuji <yuuji@gentei.org>
parents:
574
diff
changeset
|
843 blog_writable $rid $user |
461
d7b23ad0e2e8
Variable name error, fixed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
455
diff
changeset
|
844 rc=$? # =0: writable, $BLOG_NOTMEM bit set => not member |
402
58c291b6a81f
Allow lshandoutall and gethandout on frozen board
HIROSE Yuuji <yuuji@gentei.org>
parents:
401
diff
changeset
|
845 if [ $((rc & $BLOG_NOTMEM)) -gt 0 ] ; then |
592 | 846 contenttype; echo |
64
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
847 echo "メンバー以外は利用できません。" | html p; return |
54bbd7ce3766
Inhibit non-group-member from *handout
HIROSE Yuuji <yuuji@gentei.org>
parents:
63
diff
changeset
|
848 fi |
592 | 849 # Here, this blog is writable by $user |
774
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
850 mode=`getvalbyid blog mode $1` |
592 | 851 owner=`getvalbyid blog owner $1` |
774
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
852 blogauthor=`getvalbyid blog author $1` |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
853 isopenblogauthor=false |
592 | 854 if [ x"$user" = x"$owner" ]; then |
855 : OK | |
856 elif isgrpowner "$user" "$owner"; then | |
857 : OK | |
774
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
858 elif [ x"$blogauthor" = x"$user" ]; then |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
859 # Non-admin Author of blog cannot do gethandout() in report-closed mode |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
860 # for avoidance the risk of fake report-closed blog. |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
861 case "$mode" in # Only report-open can be handled by blog author |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
862 *open*) isopenblogauthor=true ;; |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
863 esac |
592 | 864 else |
865 contenttype; echo | |
774
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
866 echo "グループ管理者のみ取得できます。" | html p; return |
592 | 867 fi |
868 copy2csv=false | |
869 blogid=`getvalbyid blog id $1` | |
870 isgroup "$owner" && isgroup=true || isgroup=false | |
871 isgrpowner "$user" "$owner" && isgrpadmin=true || isgrpadmin=false | |
872 | |
2 | 873 i=0 |
629
b1ddb2559d77
TEST: Use intermediate file instead of query-pipe to shorten db-lock
HIROSE Yuuji <yuuji@gentei.org>
parents:
623
diff
changeset
|
874 midfile=$tmpd/midfile |
2 | 875 bd=$tmpd/archive.$$ |
876 mkdir $bd | |
592 | 877 case "$mode" in |
616
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
878 *quiz*) |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
879 copy2csv=true ;; |
592 | 880 *enquete*) |
881 copy2csv=true | |
882 csvline=`getvalbyid blog heading $1 | grep "..*,." | head -1` | |
883 # Create CSV-base table for questionnaire | |
884 # If heading in blog_s has at least 1 CSV line, | |
885 # we take the line as column list. | |
886 # Otherwise we produce two column CSV as below: | |
887 # USER,ANSWER | |
595
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
888 query "DROP TABLE IF EXISTS tmp_q;" |
592 | 889 if [ -n "$csvline" ]; then |
595
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
890 query <<-EOF |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
891 CREATE TEMPORARY TABLE tmp_q("user", $csvline); |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
892 EOF |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
893 if [ $? != 0 ]; then |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
894 contenttype; echo |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
895 cat <<-EOF | html p; exit |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
896 掲示板のヘッダにあるCSV定義が不正でCSV出力できません。 |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
897 $csvline |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
898 空白なしの項目名を半角カンマ区切りで1行で書いてください。 |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
899 EOF |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
900 fi |
592 | 901 else |
902 query <<-EOF | |
903 CREATE TEMPORARY TABLE tmp_q(user text PRIMARY KEY, answer); | |
904 EOF | |
905 fi | |
906 esac | |
595
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
907 if $copy2csv; then |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
908 mkdir $bd/$rid |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
909 outcsv=$bd/$rid/migrate-$rid.csv |
616
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
910 fullcsv=$bd/$rid/all-text-full-$rid.csv |
595
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
911 sq "$db" <<-EOF | tr '|' ',' > $outcsv |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
912 SELECT author as "USER", |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
913 replace(val, x'0a', ',') as "${csvline:-ANSWER}" |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
914 FROM article a JOIN article_s s ON a.id=s.id |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
915 AND blogid=(SELECT id FROM blog WHERE rowid=$rid) |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
916 AND s.key='text'; |
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
917 EOF |
616
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
918 sq "$db" <<-EOF > $fullcsv |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
919 .mode csv |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
920 .head 1 |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
921 SELECT author as "ユーザ", |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
922 (SELECT gecos FROM gecoses g WHERE author=g.name) as "表示名", |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
923 val as "テキスト" |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
924 FROM article a JOIN article_s s ON a.id=s.id |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
925 AND blogid=(SELECT id FROM blog WHERE rowid=$rid) |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
926 AND s.key='text'; |
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
927 EOF |
595
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
928 fi |
629
b1ddb2559d77
TEST: Use intermediate file instead of query-pipe to shorten db-lock
HIROSE Yuuji <yuuji@gentei.org>
parents:
623
diff
changeset
|
929 query <<-EOF > $midfile # Using tempfile for quick db-unlock |
616
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
930 SELECT a.rowid, a.id artid, a.author, hex(s.val) |
592 | 931 FROM article a JOIN article_s s ON a.id=s.id |
866
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
932 WHERE blogid=(SELECT id FROM blog WHERE rowid=$rid) |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
933 ORDER BY a.rowid; |
592 | 934 EOF |
629
b1ddb2559d77
TEST: Use intermediate file instead of query-pipe to shorten db-lock
HIROSE Yuuji <yuuji@gentei.org>
parents:
623
diff
changeset
|
935 cat $midfile | while IFS='|' read rowid artid author text; do |
774
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
936 $isgrpowner || $isopenblogauthor \ |
8a7d5326055d
Only report-open can be handled by blog author
HIROSE Yuuji <yuuji@gentei.org>
parents:
768
diff
changeset
|
937 || isfilereadable $user article_s $rowid || continue |
866
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
938 if [ "$by_uname" ]; then |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
939 dir=`printf $bd/%d/%s "$rid" "$author"` |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
940 else |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
941 dir=`printf $bd/%d/%06d "$rid" "$rowid"` |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
942 fi |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
943 txt=`printf %06d $rowid`.txt |
867 | 944 test -d "$dir" || mkdir -p "$dir" |
945 echo "$author" > "$dir"/Author.txt | |
946 echo "$text" | unhexize > "$dir/$txt" | |
592 | 947 i=0 |
948 query "SELECT m.rowid, m.val FROM article_m m \ | |
949 WHERE id='$artid' AND m.key IN ('image', 'document', 'binary');" \ | |
950 | while IFS='|' read mrowid filename; do | |
620
2635182219dc
Avoid use of $((i++)) for FreeBSD sh.
HIROSE Yuuji <yuuji@gentei.org>
parents:
616
diff
changeset
|
951 i=$((i+1)) |
866
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
952 if [ "$by_uname" ]; then |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
953 outfile=`printf "%s/%06d-%s" "$dir" $rowid "$filename"` |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
954 else |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
955 outfile=`printf "%s/%02d-%s" "$dir" $i "$filename"` |
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
956 fi |
592 | 957 query "SELECT quote(bin) FROM article_m WHERE rowid=$mrowid;" \ |
866
a2e2bf4ee7eb
Archive report files order by uname.
HIROSE Yuuji <yuuji@gentei.org>
parents:
862
diff
changeset
|
958 | unhexize > "$outfile" |
592 | 959 done |
960 done | |
961 if [ ! -d $bd/$rid ]; then | |
2 | 962 contenttype; echo |
67 | 963 echo "取得できるファイルがありませんでした。" | html p |
2 | 964 return |
965 fi | |
592 | 966 |
967 if $copy2csv; then | |
616
56b4430125da
Produce multi-line text into csv in quiz/enquete mode
HIROSE Yuuji <yuuji@gentei.org>
parents:
615
diff
changeset
|
968 query <<-EOF > $bd/$rid/all-text-1stline-$rid.csv |
592 | 969 .mode csv |
970 .head 1 | |
766
d39c915daeda
Ensure tmp_q table to be temporary
HIROSE Yuuji <yuuji@gentei.org>
parents:
749
diff
changeset
|
971 CREATE TEMPORARY TABLE IF NOT EXISTS tmp_q("user", "TEXT"); |
595
d4fe749996fd
csvline enabled in heading of enquete mode blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
594
diff
changeset
|
972 .import $outcsv tmp_q |
592 | 973 SELECT * FROM tmp_q; |
974 .mode list | |
975 .head 0 | |
976 EOF | |
977 fi | |
978 err "BDLIST: `ls -l $bd`" | |
923 | 979 rm "$outcsv" |
592 | 980 arcname=archive-$rid.tar.gz |
658
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
981 ### outstdout=true |
2 | 982 (cd $bd |
592 | 983 # query() CANNOT BE used in this subshell |
658
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
984 if [ "$outstdout" ]; then |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
985 cat <<-EOF |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
986 Content-type: application/x-gzip |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
987 Content-Disposition: filename="$arcname" |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
988 |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
989 EOF |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
990 tar zcf - $rid |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
991 return |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
992 else |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
993 tar zcf .archive.tar.gz $rid && mv .archive.tar.gz "$arcname" |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
994 err Creating tar archive "`ls -l "$arcname"`" |
ef138b0c44a5
Preparation of speed-up archive generation initially off-ed
HIROSE Yuuji <yuuji@gentei.org>
parents:
649
diff
changeset
|
995 fi |
2 | 996 ) |
592 | 997 arcfile=$bd/$arcname |
2 | 998 echo "Content-type: application/x-gzip" |
592 | 999 echo "Content-Length: `cat $arcfile|wc -c`" |
1000 echo "Content-Disposition: filename=\"$arcname\"" | |
2 | 1001 echo |
592 | 1002 cat $arcfile |
2 | 1003 } |
462
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1004 blogseen() { # $1 = blogid |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1005 blogid=${1%%[!0-9]*} |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1006 if [ -z "$blogid" ]; then |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1007 echo "Invalid blog id" | html p; exit |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1008 fi |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1009 blog_writable "$blogid" "$user" |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1010 rc=$? # =0: writable, $BLOG_NOTMEM bit set => not member |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1011 if [ $((rc & $BLOG_NOTMEM)) -gt 0 ] ; then |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1012 echo "メンバー以外は利用できません。" | html p; return |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1013 fi |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1014 owner=`getvalbyid blog owner $rowid` |
467
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1015 qowner=`sqlquotestr "$owner"` |
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1016 grprowid=`query "SELECT rowid FROM grp WHERE gname=$qowner;"` |
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1017 ge=`gecos "$owner" | htmlescape` |
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1018 title=`getvalbyid blog title $rowid | htmlescape` |
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1019 h1="アクセス時刻" |
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1020 link2board="<a href=\"?replyblog+$rowid\">$title</a>" |
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1021 link2group="<a href=\"?grp+$grprowid\">$ge</a>" |
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1022 _m4 -D_TITLE_="$h1" $layout/html.m4.html |
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1023 echo "$h1" | html h1 |
598f00f1b995
Offer links to board and group home in read-time table
HIROSE Yuuji <yuuji@gentei.org>
parents:
466
diff
changeset
|
1024 echo "[$link2board]@$link2group" | html h2 |
462
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1025 warn=' class="warn"' |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1026 cat <<-EOF |
464
6591b5308ddd
Garbage in here-document removed
HIROSE Yuuji <yuuji@gentei.org>
parents:
463
diff
changeset
|
1027 <table class="b"> |
462
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1028 <tr><th>メンバー</th><th>uname</th><th>最終閲覧時刻</th></tr> |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1029 EOF |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1030 query <<-EOF | |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1031 WITH grpmem as ( |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1032 SELECT user, (SELECT gecos FROM gecoses WHERE name=user) gecos |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1033 FROM grp_mem |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1034 WHERE gname=(SELECT val FROM blog_s |
463 | 1035 WHERE id=(select id from blog where rowid=$blogid) |
462
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1036 AND key='owner') |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1037 ), acctime AS ( |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1038 SELECT user, max(time) atime |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1039 FROM tblaccesses |
463 | 1040 WHERE tbl='blog' AND tblrowid=$blogid |
462
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1041 GROUP BY user |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1042 ) |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1043 SELECT g.user, |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1044 (SELECT rowid FROM user u WHERE u.name=g.user), |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1045 hex(gecos), |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1046 atime |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1047 FROM grpmem g LEFT JOIN acctime t |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1048 ON g.user = t.user |
470
4e185146fc00
Fix SQL for listing all members
HIROSE Yuuji <yuuji@gentei.org>
parents:
467
diff
changeset
|
1049 GROUP BY g.user |
462
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1050 ORDER BY atime DESC; |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1051 EOF |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1052 while IFS='|' read u uid hexge time; do |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1053 td=${time:+"<td>"} # If the variable time is set, td=<td> |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1054 td=${td:-"<td$warn>"} # else td=<td class="warn"> |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1055 cat <<-EOF |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1056 <tr> |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1057 <td><a href="?home+$uid">`echo "$hexge"|unhexize|htmlescape`</a></td> |
942 | 1058 <td>`printf '%s' "${u%%@*}"|htmlescape`</td> |
462
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1059 $td${time:----}</td></tr> |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1060 EOF |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1061 done |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1062 cat <<-EOF |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1063 </table> |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1064 <p><a href="?replyblog+$rowid">[$title]に戻る</a></p> |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1065 </html> |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1066 EOF |
e8bde2d9cb0b
New feature - show blog-seen time table, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
461
diff
changeset
|
1067 } |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1068 lsmyfile() { # $1(optional)=SortBy |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1069 case "$1" in |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1070 ""|CTIME-DESC) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1071 by="CTIME" ord="DESC" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1072 CTIME*) by="CTIME" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1073 FILE*) by="FILE" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1074 OWNER*) by="OWNER" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1075 TITLE*) by="TITLE" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1076 esac |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1077 case "$1" in |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1078 *DESC) ord="DESC" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1079 esac |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1080 case "$ord" in |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1081 DESC) lkod="" jord="降順" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1082 *) lkod="-DESC" jord="昇順" ;; |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1083 esac |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1084 sql="select m.val||'/'||m.rowid FILE, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1085 coalesce( |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1086 case when (select name from user where name=bs.owner) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1087 is not null |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1088 then (select val from user_s where name=bs.owner |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1089 and key='gecos') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1090 when (select gname from grp where gname=bs.owner) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1091 is not null |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1092 then (select val from grp_s where gname=bs.owner |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1093 and key='gecos') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1094 else |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1095 null |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1096 end, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1097 bs.owner |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1098 ) OWNER, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1099 a_s.val CTIME, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1100 ',t,'||bs.title||':'||b.rowid||'#'||a.id TITLE |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1101 from (select rowid,id,val from article_m where id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1102 in (select id from article where author='$user') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1103 and type like 'file:%') |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1104 m left join article a on m.id=a.id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1105 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
|
1106 left join (select id, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1107 max(case key when 'owner' then val end) as owner, |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1108 max(case key when 'title' then val end) as title |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1109 from blog_s group by id) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1110 bs on a.blogid=bs.id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1111 left join blog b on bs.id=b.id |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1112 where m.val is not null order by $by $ord;" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1113 err lshandoutbyauthor: sql=`echo "$sql"` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1114 title="個人提出ファイル" |
189 | 1115 _m4 -D_TITLE_=$title $layout/html.m4.html |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1116 hra="<a href=\"?lsmyfile+" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1117 hrb="<a href=\"?showattc+article_m+" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1118 hrc="<a href=\"?replyblog+" |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1119 (echo '<table class="b">' |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1120 echo "$sql"|sq -html -header $db ) \ |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1121 | 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
|
1122 -e "s|,t,\(.*\):\([^<]*\)\(</TD>\)|$hrc\2\">\1</a>\3|" \ |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1123 -e "s|\(<TH>\)\([A-Z]*\)\(</TH>\)|\1$hra\2$lkod\">\2</a>|" \ |
189 | 1124 | _m4 -D_TITLE_=$title -D_FORM_="<p>($by$jord)</p>" \ |
1125 -D_DUMPTABLE_="syscmd(cat)" $layout/form+dump.m4.html | |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1126 echo '</table>' |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1127 } |
875
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1128 getteamcsv() { |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1129 gid=`numericalize "$1"` |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1130 grp=`getgroupbyid "$gid"` |
921 | 1131 extra="$2" |
1132 err "gid=$gid grp=$grp extra=$extra" | |
875
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1133 if ! isgrpowner "$user" "$grp"; then |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1134 contentytpe 'text/plain; charset="utf-8"'; echo |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1135 echo "管理者メンバー以外は利用できません。" | html p; return |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1136 fi |
921 | 1137 fn="Team-$gid" |
1138 case "$extra" in | |
1139 "") ;; | |
1140 name) | |
1141 fn=${fn}-with-name | |
1142 xSQL=", | |
1143 substr(user, 1, instr(user, '@')-1) \"uname\", | |
1144 coalesce((SELECT gecos FROM gecoses WHERE name=user), user) gecos" ;; | |
1145 esac | |
922 | 1146 fn="$fn.csv" |
921 | 1147 csv="$tmpd/$fn.csv" |
875
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1148 err csv=$csv |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1149 # We can leave csv mode here because this scripts will exit soon |
921 | 1150 query <<-EOF > "$csv" |
875
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1151 .mode csv |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1152 .head 1 |
921 | 1153 SELECT val "ルーム名を事前割り当て", user "メールアドレス" $xSQL |
875
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1154 FROM grp_mem_m |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1155 WHERE key='team' |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1156 AND gname=(SELECT gname FROM grp WHERE rowid=$gid) |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1157 ORDER BY val; |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1158 EOF |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1159 contenttype 'text/plain; charset="utf-8"' |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1160 echo "Content-Disposition: filename=\"$fn\"" |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1161 echo "Content-Length: " `cat $csv | wc -c`; echo |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1162 cat $csv |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1163 exit |
380167e9cfcf
Add link to generate csv file for Zoom(TM) pre-assigned rooms
HIROSE Yuuji <yuuji@gentei.org>
parents:
867
diff
changeset
|
1164 } |
78 | 1165 searchart() { |
862
ee91a512b63a
Navigation menu should be output via _m4
HIROSE Yuuji <yuuji@gentei.org>
parents:
860
diff
changeset
|
1166 _m4 -D_TITLE_="検索結果" $layout/html.m4.html |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1167 kwd=`getpar kwd|nkf -wZ1` # Convert Zenkaku-SPC to ASCII-SPC |
510
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1168 bloglist=`getpar bloglist|sed 's/[^0-9,]//g'` |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1169 kwdgrp="" |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1170 authcond="" |
78 | 1171 if [ -z "$kwd" ]; then |
1172 echo "検索語を指定してください" | html p; return | |
1173 fi | |
510
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1174 if logstart "$searchlog"; then |
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1175 { echo "kwd=$kwd" |
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1176 test -n "$bloglist" && echo "bloglist=$bloglist" |
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1177 } >> $searchlog |
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1178 logend "$searchlog" |
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1179 fi |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1180 if expr x"$kwd" : 'x#[1-9][0-9]*$' >/dev/null 1>&2; then |
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1181 # Like '#1234', assume as artID |
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1182 rowid=$((${kwd#\#} + 0)) # Force to be a number |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1183 kc="ar.rowid = $rowid" |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1184 else |
942 | 1185 for k in `printf '%s' "$kwd" | sed "s/'/''/g"`; do # With wrap quotes |
488
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1186 ctime="" |
344
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1187 if expr x"$k" : 'x@[><= ]*[1-9][][0-9]*-[][0-9:-]*$' >/dev/null >&2; then |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1188 # '@<2016-10-10' -> ctime < '2016-10-10' |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1189 # '@>=2016-10-10' -> ctime >= '2016-10-10' |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1190 # '@2016-10-10' -> ctime GLOB '@2016-10-10' |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1191 k=${k#@} |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1192 case "$k" in |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1193 [\<\>]*) op=${k%%[!<>=]*}; ctime=${k##*[><= ]} ;; |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1194 *) op='GLOB'; ctime="${k##*[><= ]}*" ;; |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1195 esac |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1196 kc=$kc${kc:+" AND "}"ctime $op '${ctime}'" |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1197 # Not sure GROUP BY a.blogid is comfortable for searchers...? |
331
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
326
diff
changeset
|
1198 ##### kwdgrp=" GROUP BY a.blogid" ## Add this to lessen results |
304
ab11a49bd64e
Sort search result by "DATE DESC, TITLE, x.ctime"
HIROSE Yuuji <yuuji@gentei.org>
parents:
303
diff
changeset
|
1199 elif [ x"$k" = x"@today" -o x"$k" = x"@今日" ]; then |
ab11a49bd64e
Sort search result by "DATE DESC, TITLE, x.ctime"
HIROSE Yuuji <yuuji@gentei.org>
parents:
303
diff
changeset
|
1200 ctime=`date +%F` |
488
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1201 elif n=`expr x"$k" : 'x@\([0-9]*\)days*'` >/dev/null >&2; then |
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1202 ctime=`query "SELECT datetime('now', 'localtime', '-$n days');"` |
344
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1203 elif [ x"$k" = x"@week" ]; then |
7ff49d1c2987
Support '<', '>' for date search keyword
HIROSE Yuuji <yuuji@gentei.org>
parents:
341
diff
changeset
|
1204 ctime=`query "SELECT datetime('now', 'localtime', '-7 days');"` |
488
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1205 elif n=`expr x"$k" : 'x@\([0-9]*\)weeks*'` >/dev/null >&2; then |
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1206 n=$((n * 7)) |
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1207 ctime=`query "SELECT datetime('now', 'localtime', '-$n days');"` |
352
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1208 elif [ x"$k" = x"@month" ]; then |
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1209 ctime=`query "SELECT datetime('now', 'localtime', '-1 month');"` |
488
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1210 elif n=`expr x"$k" : 'x@\([0-9]*\)months*'` >/dev/null >&2; then |
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1211 ctime=`query "SELECT datetime('now', 'localtime', '-$n month');"` |
352
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1212 elif [ x"$k" = x"@year" ]; then |
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1213 ctime=`query "SELECT datetime('now', 'localtime', '-1 year');"` |
488
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1214 elif n=`expr x"$k" : 'x@\([0-9]*\)years*'` >/dev/null >&2; then |
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1215 ctime=`query "SELECT datetime('now', 'localtime', '-$n year');"` |
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1216 fi |
9f5b08b205bf
Allow numeric argument for day(s)/week(s)/month(s)/year(s)
HIROSE Yuuji <yuuji@gentei.org>
parents:
487
diff
changeset
|
1217 if [ -n "$ctime" ]; then |
352
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1218 kc=$kc${kc:+" AND "}"ctime > '${ctime}'" |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1219 else |
510
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1220 e="" |
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1221 case "$k" in |
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1222 *${likeesc}*) e="" ;; # Giving up char-escaping |
942 | 1223 *%*|*_*) k=`printf '%s' "$k"|sed "s/\([%_]\)/${likeesc}\1/g"` |
510
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1224 e=" ESCAPE '$likeesc'" ;; |
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1225 esac |
2a70b6c7ffad
Add search-log and %-escaping
HIROSE Yuuji <yuuji@gentei.org>
parents:
509
diff
changeset
|
1226 kc=$kc${kc:+" AND "}"content LIKE '%$k%'$e" |
301
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1227 fi |
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1228 done |
ba0730073d6f
Add (1)article-ID search, (2)DATE search
HIROSE Yuuji <yuuji@gentei.org>
parents:
293
diff
changeset
|
1229 fi |
942 | 1230 kwd=`printf '%s' "$kwd"|htmlescape` |
78 | 1231 owner=`getpar owner` |
1232 owner=${owner:-$1} | |
747
42cc0aeaa498
Avoid to pass gname to searchart()
HIROSE Yuuji <yuuji@gentei.org>
parents:
720
diff
changeset
|
1233 grid=`getpar grid` |
508
944739c3ac5c
Continuous search available
HIROSE Yuuji <yuuji@gentei.org>
parents:
503
diff
changeset
|
1234 msg="" |
747
42cc0aeaa498
Avoid to pass gname to searchart()
HIROSE Yuuji <yuuji@gentei.org>
parents:
720
diff
changeset
|
1235 if [ -n "$grid" ]; then |
42cc0aeaa498
Avoid to pass gname to searchart()
HIROSE Yuuji <yuuji@gentei.org>
parents:
720
diff
changeset
|
1236 grp=`getgroupbyid "$grid"` |
42cc0aeaa498
Avoid to pass gname to searchart()
HIROSE Yuuji <yuuji@gentei.org>
parents:
720
diff
changeset
|
1237 qgrp=`sqlquote "$grp"` |
42cc0aeaa498
Avoid to pass gname to searchart()
HIROSE Yuuji <yuuji@gentei.org>
parents:
720
diff
changeset
|
1238 cond="WHERE key='owner' AND val=$qgrp" |
42cc0aeaa498
Avoid to pass gname to searchart()
HIROSE Yuuji <yuuji@gentei.org>
parents:
720
diff
changeset
|
1239 msg="(`linkhome $grid` グループから)" |
42cc0aeaa498
Avoid to pass gname to searchart()
HIROSE Yuuji <yuuji@gentei.org>
parents:
720
diff
changeset
|
1240 elif [ -n "$owner" ]; then |
78 | 1241 cond="where key='owner' and val='$owner'" |
747
42cc0aeaa498
Avoid to pass gname to searchart()
HIROSE Yuuji <yuuji@gentei.org>
parents:
720
diff
changeset
|
1242 msg="(`linkhome $owner` さんの記録から)" |
331
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
326
diff
changeset
|
1243 elif { author=`getpar author`; test -n "$author"; }; then |
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
326
diff
changeset
|
1244 atptn=`sqlquotestr $author` |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1245 #kc="$kc${kc:+ AND }author=$atptn" |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1246 authcond="WHERE author=$atptn" |
331
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
326
diff
changeset
|
1247 if isuser $author; then |
509
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1248 msg="(`linkhome $author` さんの書き込みから)" |
331
1a60dfc56bb0
Search form in other user's home restrict author to that one.
HIROSE Yuuji <yuuji@gentei.org>
parents:
326
diff
changeset
|
1249 fi |
78 | 1250 fi |
509
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1251 if [ -n "$bloglist" ]; then |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1252 blogcond="AND bl.rid IN ($bloglist)" |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1253 fi |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1254 |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1255 sf=`search_form "$search_form_args" "$kwd" | sed '1d;$d'` # rm <div></div> |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1256 echo "$sf" | sed -e "/POST SENTENCE/s/.*/__PS__/" -e "/EOF/q" \ |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1257 | _m4 -D__PS__="による検索結果$msg" |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1258 echo "(上記入力窓で再検索すると下記の掲示板のみに絞って再検索します)" \ |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1259 | html p 'class="small"' |
78 | 1260 # article_s: id=article-id, key='text', val='TEXT' |
1261 # article: id=article-id, blogid=blogkd | |
1262 # blog: id=blog-id, author=LeaderAuthor | |
1263 # blog_s: id=blog-id, key='title', val='BLOG-TITLE' | |
1264 # WANT: blog-ROWid,article-id,val(TEXT) | |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1265 sql2="`sql4readableblogs` -- Extract user-readable blogs |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1266 -- 0.3sec |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1267 WITH artsm AS ( |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1268 SELECT a.id,ctime, text || ' ' || coalesce(files, '') content |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1269 FROM article a |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1270 LEFT JOIN |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1271 (SELECT ars.id, ctime, text, coalesce(files, '') files |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1272 FROM (SELECT id, |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1273 max(CASE key WHEN 'ctime' THEN val END) ctime, |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1274 max(CASE key WHEN 'text' THEN val END) text |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1275 FROM article_s |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1276 GROUP BY id) ars |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1277 LEFT JOIN |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1278 (SELECT id, group_concat(val) files |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1279 FROM article_m |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1280 WHERE type LIKE 'file:%' |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1281 GROUP BY id) arm |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1282 ON ars.id=arm.id |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1283 ) ar |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1284 ON a.id=ar.id |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1285 ), ar AS ( |
338
291a3eeed05e
Show author in search result
HIROSE Yuuji <yuuji@gentei.org>
parents:
337
diff
changeset
|
1286 SELECT a.rowid, a.blogid, a.id, a.author, ctime, content |
291a3eeed05e
Show author in search result
HIROSE Yuuji <yuuji@gentei.org>
parents:
337
diff
changeset
|
1287 FROM article a JOIN artsm ON a.id=artsm.id |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1288 $authcond |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1289 ), bl AS ( |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1290 SELECT blg.rid, blg.*, blog_s.val TITLE |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1291 FROM readableblogs blg JOIN blog_s ON blg.id=blog_s.id AND blog_s.key='title' |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1292 ) |
819
b64e18808bb6
Links from keyword search should contain n:all
HIROSE Yuuji <yuuji@gentei.org>
parents:
808
diff
changeset
|
1293 SELECT bl.rid||'+n:all#'||ar.id '', |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1294 bl.title TITLE, |
338
291a3eeed05e
Show author in search result
HIROSE Yuuji <yuuji@gentei.org>
parents:
337
diff
changeset
|
1295 (SELECT gecos FROM gecoses WHERE name=ar.author) AUTHOR, |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1296 substr(ctime, 0, 11) DATE, |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1297 substr(content, 0, 78) TEXT |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1298 FROM ar JOIN bl |
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1299 ON ar.blogid=bl.id |
509
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1300 WHERE $kc AND bl.id IN (SELECT id FROM blog_s $cond) $blogcond |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1301 ORDER by DATE DESC, TITLE, ctime;" |
78 | 1302 sedopt="s,<TR><TD>\([^<]*\)</TD>,<TR><TD><a\ |
1303 href=\"?replyblog+\1\">VIEW</a></TD>," | |
337
48d0b6c4de65
Revise SQL for article search drastically for speed.
HIROSE Yuuji <yuuji@gentei.org>
parents:
336
diff
changeset
|
1304 # echo "$sql2" > tmp/sql.out |
352
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1305 result=$tmpd/result.$$ |
78 | 1306 cat<<EOF |
1307 <table class="b searchart"> | |
352
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1308 `sq -header -html $db "$sql2"|sed "$sedopt"|tee $result` |
78 | 1309 </table> |
1310 EOF | |
352
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1311 if [ -s "$result" ]; then |
356
c087423c8234
Most of debugging code deactivated
HIROSE Yuuji <yuuji@gentei.org>
parents:
352
diff
changeset
|
1312 found=$((`grep "^<TR><TD>" $result | wc -l` + 0)) # Cast to INT |
352
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1313 one=${found%1} |
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1314 echo "$found match${one:+es} found" |
509
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1315 # <a href="?replyblog+39#12345">VIEW</a> |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1316 # -> 39,49,55, -> 39,49,55 |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1317 # -> <input type="hidden" name="bloglist" value="39,49,55"> |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1318 sed -n "/.*href=.*replyblog\+\([0-9][0-9]*\).*/s//\1/p" "$result" \ |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1319 | sort | uniq | tr '\n' ',' \ |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1320 | sed -e 's/,$//' \ |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1321 -e 's/^/<input type="hidden" name="bloglist" value="/' \ |
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1322 -e 's/$/">/' |
352
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1323 else |
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1324 echo orz... |
dd0c70353869
More HELP text for search form. Add search result report.
HIROSE Yuuji <yuuji@gentei.org>
parents:
344
diff
changeset
|
1325 fi |
509
d34b8f36501c
Progressive search does not restrict author
HIROSE Yuuji <yuuji@gentei.org>
parents:
508
diff
changeset
|
1326 echo "$sf" | sed "1,/-- EOF/d" # Close <form> |
78 | 1327 } |
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
|
1328 listblog() ( |
67 | 1329 # $1={user,group} |
749 | 1330 qow=`sqlquote "$1"` |
67 | 1331 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
|
1332 cgi_form searchart<<EOF |
128 | 1333 <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
|
1334 `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
|
1335 EOF |
573
9a4504aef7ac
Narrow the blog range at listblog for user's blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
572
diff
changeset
|
1336 DT_CHLD=article:blogid DT_QOWNER=$qow \ |
9a4504aef7ac
Narrow the blog range at listblog for user's blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
572
diff
changeset
|
1337 dumptable html blog 'ctime title heading' "$cond" |
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
|
1338 ) |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1339 |
889
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1340 blog_setval() { |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1341 # $1=GRProwID $2=key $3=value |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1342 # RETURN VALUE(JSON): |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1343 # {code: EXIT_CODE, message: MESSAGE} |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1344 # This function will be called via ajax control of fetch() suite, |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1345 # so we need to return JSON text string and exit directly. |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1346 rid=`numericalize $1` |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1347 blogowner=`getvalbyid blog owner "$rid"` |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1348 contenttype "application/json; charset=utf-8"; echo |
890
bc52f605f41d
Log message for blog_setfrozen more informative
HIROSE Yuuji <yuuji@gentei.org>
parents:
889
diff
changeset
|
1349 if [ -z "$blogowner" ]; then |
bc52f605f41d
Log message for blog_setfrozen more informative
HIROSE Yuuji <yuuji@gentei.org>
parents:
889
diff
changeset
|
1350 msg="不当な掲示板です"; code=1 |
bc52f605f41d
Log message for blog_setfrozen more informative
HIROSE Yuuji <yuuji@gentei.org>
parents:
889
diff
changeset
|
1351 elif ! isgroup "$blogowner"; then |
bc52f605f41d
Log message for blog_setfrozen more informative
HIROSE Yuuji <yuuji@gentei.org>
parents:
889
diff
changeset
|
1352 msg="グループのみの操作です"; code=2 |
889
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1353 elif ! isgrpowner "$user" "$blogowner"; then |
890
bc52f605f41d
Log message for blog_setfrozen more informative
HIROSE Yuuji <yuuji@gentei.org>
parents:
889
diff
changeset
|
1354 msg="グループ管理者のみの操作です"; code=3 |
889
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1355 else # With full permission |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1356 blogid=`query "SELECT id FROM blog WHERE rowid=$rid;"` |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1357 dbsetbyid blog "$blogid" "$2" "$3" |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1358 code=0 |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1359 fi |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1360 # echo "{\"code\": $code, \"message\": \"foo\"}"; exit |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1361 newval=`getvalbyid blog "$2" "$1"` |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1362 alert="${msg:+, \"alert\": \"$msg\"}" |
890
bc52f605f41d
Log message for blog_setfrozen more informative
HIROSE Yuuji <yuuji@gentei.org>
parents:
889
diff
changeset
|
1363 json=$(cat <<-EOF |
942 | 1364 {"code": $code, "$2": "`printf '%s' "$newval"|sed 's/"/\\\\"/g'`"$alert} |
889
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1365 EOF |
890
bc52f605f41d
Log message for blog_setfrozen more informative
HIROSE Yuuji <yuuji@gentei.org>
parents:
889
diff
changeset
|
1366 ) |
bc52f605f41d
Log message for blog_setfrozen more informative
HIROSE Yuuji <yuuji@gentei.org>
parents:
889
diff
changeset
|
1367 err blog_setval: returning JSON: "$json" |
942 | 1368 printf '%s\n' "$json" |
889
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1369 exit |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1370 } |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1371 |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1372 blog_setfrozen() { |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1373 # $1=GRProwID $2=val={ "frozen" | "" } |
890
bc52f605f41d
Log message for blog_setfrozen more informative
HIROSE Yuuji <yuuji@gentei.org>
parents:
889
diff
changeset
|
1374 err blog_setfrozen: getvalbyid-blog-$1=`getvalbyid blog state "$1"` |
889
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1375 case `getvalbyid blog state "$1"` in |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1376 [Ff][Rr]*) newval="" ;; |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1377 *) newval="frozen" ;; |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1378 esac |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1379 blog_setval "$1" state $newval |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1380 } |
5843755e3b30
The beginning of AJAX operations
HIROSE Yuuji <yuuji@gentei.org>
parents:
885
diff
changeset
|
1381 |
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
|
1382 blog_addentry() { |
749 | 1383 # $1=GRProwID(if it is a group) |
579
6e727ab07c98
Sanitize argument from cgi with numericalize()
HIROSE Yuuji <yuuji@gentei.org>
parents:
574
diff
changeset
|
1384 grprowid=`numericalize $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
|
1385 rowid=`getpar rowid` |
356
c087423c8234
Most of debugging code deactivated
HIROSE Yuuji <yuuji@gentei.org>
parents:
352
diff
changeset
|
1386 ## err blog_addentry0: rowid=$rowid |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1387 if [ -n "$grprowid" ]; then |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1388 owner=`getgroupbyid $grprowid` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1389 else |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1390 owner=`getpar owner` |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1391 fi |
942 | 1392 htmlowner=`printf '%s' $owner|htmlescape` |
579
6e727ab07c98
Sanitize argument from cgi with numericalize()
HIROSE Yuuji <yuuji@gentei.org>
parents:
574
diff
changeset
|
1393 err blog-add: \$1=$grprowid rowid=$rowid owner=$owner |
436
e1bdad674c09
Quote arguments that hold group name.
HIROSE Yuuji <yuuji@gentei.org>
parents:
432
diff
changeset
|
1394 if isgroup "$owner"; then |
749 | 1395 if [ -z "$grprowid" ]; then |
1396 qgrp=`sqlquote "$owner"` # Inefficient... | |
1397 grprowid=`query "SELECT rowid FROM grp WHERE gname=$qgrp;"` | |
1398 fi | |
838
985ee9a09783
Hyperlinks in TITLE cannot be used..
HIROSE Yuuji <yuuji@gentei.org>
parents:
837
diff
changeset
|
1399 groupmode=1 listing=$owner GF_OWNER=$owner |
985ee9a09783
Hyperlinks in TITLE cannot be used..
HIROSE Yuuji <yuuji@gentei.org>
parents:
837
diff
changeset
|
1400 titleguide="[$owner]" guide="[`linkhome $grprowid`]" |
860
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1401 GF_ARGS=$(mvteamform "$owner") |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1402 else |
838
985ee9a09783
Hyperlinks in TITLE cannot be used..
HIROSE Yuuji <yuuji@gentei.org>
parents:
837
diff
changeset
|
1403 usermode=1 listing=$user guide="[個人]" titleguide=$guide |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1404 fi |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1405 |
860
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1406 title=`getpar title` |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1407 if [ -n "$title" ]; then |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1408 if [ "$usermode" ]; then |
122
0681534f9451
When deleting group, remove all blos that belong it.
HIROSE Yuuji <yuuji@gentei.org>
parents:
117
diff
changeset
|
1409 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
|
1410 if [ x"$user" != x"$owner" ]; then |
67 | 1411 echo "他人の日記は書けません" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1412 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
|
1413 fi |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1414 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
|
1415 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
|
1416 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
|
1417 if ! ismember "$user" "$grp"; then |
67 | 1418 echo "(話題作成はこのグループに加入してから)" | html p |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1419 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
|
1420 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
|
1421 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
|
1422 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
|
1423 serial=`getpar serial` |
356
c087423c8234
Most of debugging code deactivated
HIROSE Yuuji <yuuji@gentei.org>
parents:
352
diff
changeset
|
1424 ## err SERIAL: $serial ROWID=$rowid listing=$listing |
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
|
1425 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
|
1426 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
|
1427 # 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
|
1428 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
|
1429 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
|
1430 # 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
|
1431 id=`query "select rowid from blog where id='$serial';"` |
356
c087423c8234
Most of debugging code deactivated
HIROSE Yuuji <yuuji@gentei.org>
parents:
352
diff
changeset
|
1432 ## 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
|
1433 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
|
1434 if [ -n "$id" ]; then |
860
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1435 ## If modifying existing blog, JUMP to blog_reply |
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
|
1436 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
|
1437 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
|
1438 fi |
860
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1439 # Newly created blog comes here: |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1440 mv2team=`getpar mv2team` |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1441 if [ -n "$mv2team" -a -n "$groupmode" ]; then |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1442 # For newly created BLOG, assign team-name if necessary and correct |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1443 qmt=`sqlquote "$mv2team"` |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1444 qowner=`sqlquote "$owner"` |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1445 team=$(query "SELECT val FROM grp_mem_m |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1446 WHERE key='team' AND val=$qmt AND gname=$qowner;") |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1447 if [ -n "$team" ]; then # If it is valid team name |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1448 qtt=`sqlquote "$title"` |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1449 # We should acquire newly created blog id from title step by step |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1450 thisblog=$(query \ |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1451 "SELECT id FROM blog_s |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1452 WHERE id IN (SELECT id FROM blog_s |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1453 WHERE key='owner' AND val=$qowner) |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1454 AND key='title' AND val=$qtt;") |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1455 if [ -n "$thisblog" ]; then |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1456 query "REPLACE INTO blog_s(id, key, type, val) |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1457 VALUES('$thisblog', 'team', 'string', $qmt);" |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1458 fi |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1459 fi |
7cb0edec73bd
Allow users to assign team name to new blog
HIROSE Yuuji <yuuji@gentei.org>
parents:
856
diff
changeset
|
1460 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
|
1461 fi |
838
985ee9a09783
Hyperlinks in TITLE cannot be used..
HIROSE Yuuji <yuuji@gentei.org>
parents:
837
diff
changeset
|
1462 echo "${titleguide}新規話題作成" > $tmpd/title.$$ |
985ee9a09783
Hyperlinks in TITLE cannot be used..
HIROSE Yuuji <yuuji@gentei.org>
parents:
837
diff
changeset
|
1463 echo "${guide}新規話題作成" > $tmpd/h1.$$ |
749 | 1464 listblog "$listing" > $tmpd/listblog.$$ |
81
ddc8a4c0b8d9
All macro-expanding by m4 bypassed via syscmd or spaste
HIROSE Yuuji <yuuji@gentei.org>
parents:
80
diff
changeset
|
1465 genform $formdir/blog.def \ |
189 | 1466 | _m4 -D_TITLE_="spaste(\`$tmpd/title.$$')" \ |
838
985ee9a09783
Hyperlinks in TITLE cannot be used..
HIROSE Yuuji <yuuji@gentei.org>
parents:
837
diff
changeset
|
1467 -D_H1_="spaste(\`$tmpd/h1.$$')" \ |
189 | 1468 -D_FORMHEAD_="序文は簡単に詳しくはコメントに" \ |
1469 -D_DUMPHEAD_="これまでの蓄積" \ | |
1470 -D_FORM_="syscmd(\`cat')" \ | |
1471 -D_DUMPTABLE_="spaste(\`$tmpd/listblog.$$')" \ | |
1472 $layout/html.m4.html \ | |
1473 $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
|
1474 } |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1475 |
379 | 1476 blog_reply() { # Posting to blog article |
801
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
1477 # $1=rowid $2=control-sequence |
579
6e727ab07c98
Sanitize argument from cgi with numericalize()
HIROSE Yuuji <yuuji@gentei.org>
parents:
574
diff
changeset
|
1478 rowid=`numericalize $1` # Ensure (already purified in s4.cgi) |
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
|
1479 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1480 if [ -z "$rowid" ]; then |
67 | 1481 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
|
1482 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
|
1483 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
|
1484 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
|
1485 owner=`getvalbyid blog owner $rowid` |
942 | 1486 htmlowner=`printf '%s' $owner|htmlescape` |
466
929a925f10d8
Group name used at the following query should be quoted.
HIROSE Yuuji <yuuji@gentei.org>
parents:
465
diff
changeset
|
1487 qowner=`sqlquotestr "$owner"` |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1488 if [ -z "$title" ]; then |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1489 echo "日記番号指定が無効です。" | html p |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1490 return |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1491 fi |
885
4c02a9f862d7
Prefix process id in all log entries
HIROSE Yuuji <yuuji@gentei.org>
parents:
884
diff
changeset
|
1492 err "blog_reply Started: `gdate +%S.%03N` blogrowid=$rowid" |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1493 blog_writable $rowid $user; rc=$? |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1494 if [ $rc = 0 ]; then |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1495 iswritable=true |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1496 else |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1497 iswritable=false |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1498 if [ $((rc & $BLOG_FROZEN)) -gt 0 ]; then |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1499 isfrozen=true |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1500 frozen_class='frozen"' |
399
db25589d864c
Add frozen tag to lshandoutall listings
HIROSE Yuuji <yuuji@gentei.org>
parents:
397
diff
changeset
|
1501 frozen_flag=$FROZEN_TAG |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1502 fi |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1503 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
|
1504 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
|
1505 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
|
1506 else |
466
929a925f10d8
Group name used at the following query should be quoted.
HIROSE Yuuji <yuuji@gentei.org>
parents:
465
diff
changeset
|
1507 grprowid=`query "select rowid from grp where gname=$qowner;"` |
341 | 1508 subtitle="グループ |
749 | 1509 <a href=\"?grp+$grprowid\" accesskey=\"h\" title=\"H\">$htmlowner</a> での話題 |
222
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1510 `query \"SELECT printf('(チーム:%s)', val)\ |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1511 FROM blog_s |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1512 WHERE id=(SELECT id FROM blog WHERE rowid=$rowid) |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1513 AND key='team'; |
d320c73bf16f
Add "team" attributes in groups.
HIROSE Yuuji <yuuji@gentei.org>
parents:
219
diff
changeset
|
1514 \"|htmlescape`" |
288
d50996dc2664
Function `grpaction' should be provided with moderated/ismember class
HIROSE Yuuji <yuuji@gentei.org>
parents:
287
diff
changeset
|
1515 memclass=`grp_getbodyclass "$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
|
1516 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
|
1517 |
b8a890828283
add se-blog.sh se-cgi.sh se-funcs.sh se-init.sh mpsplit.rb
HIROSE Yuuji <yuuji@gentei.org>
parents:
diff
changeset
|
1518 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
|
1519 if [ -n "$text" ]; then |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1520 if $iswritable; then |
782
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1521 ## BEGIN: 2020-06-11 - Post Integrity Check. Disable if it slows down.. |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1522 blogid=`getpar blogid | tr -c -d 'a-z0-9'` |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1523 brid=`query "SELECT rowid FROM blog WHERE id='$blogid';"` |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1524 if [ x"$rowid" != x"$brid" ]; then |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1525 _id=`getpar id | tr -c -d 'a-z0-9'` |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1526 _aid=`query "SELECT rowid FROM article WHERE id='$_id';"` |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1527 if [ -z "$_aid" ]; then |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1528 echo "掲示板から書き込んで下さい。" | html p |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1529 return |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1530 fi |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1531 fi |
e9e86a1fc1f3
[TEST] Post integrity check introduced
HIROSE Yuuji <yuuji@gentei.org>
parents:
774
diff
changeset
|
1532 ## END: |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1533 par2table $formdir/article.def |
356
c087423c8234
Most of debugging code deactivated
HIROSE Yuuji <yuuji@gentei.org>
parents:
352
diff
changeset
|
1534 st=$? |
885
4c02a9f862d7
Prefix process id in all log entries
HIROSE Yuuji <yuuji@gentei.org>
parents:
884
diff
changeset
|
1535 err "blog_reply: POSTdone `gdate +%S.%03N` - st=$st title=$title owner=$owner user=$user, blogid=$blogid" |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1536 case $st in |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1537 0|4) |
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1538 [ "$st" = "4" ] && act="書込削除" |
386
606404fbb3d3
Sort group list by posting time(wtime)
HIROSE Yuuji <yuuji@gentei.org>
parents:
381
diff
changeset
|
1539 blog_notify_reply $rowid $user "$text" $act |
606404fbb3d3
Sort group list by posting time(wtime)
HIROSE Yuuji <yuuji@gentei.org>
parents:
381
diff
changeset
|
1540 if [ -n "$grprowid" ]; then |
606404fbb3d3
Sort group list by posting time(wtime)
HIROSE Yuuji <yuuji@gentei.org>
parents:
381
diff
changeset
|
1541 qgrp=$(sqlquote "$owner") |
749 | 1542 dbsetbyid grp "$owner" wtime "`date '+%F %T'`" |
474
4f9036d35b57
Sort user by last login. Sort group by the latest article time.
HIROSE Yuuji <yuuji@gentei.org>
parents:
473
diff
changeset
|
1543 else |
4f9036d35b57
Sort user by last login. Sort group by the latest article time.
HIROSE Yuuji <yuuji@gentei.org>
parents:
473
diff
changeset
|
1544 dbsetbyid user "$user" wtime "`date '+%F %T'`" |
386
606404fbb3d3
Sort group list by posting time(wtime)
HIROSE Yuuji <yuuji@gentei.org>
parents:
381
diff
changeset
|
1545 fi |
606404fbb3d3
Sort group list by posting time(wtime)
HIROSE Yuuji <yuuji@gentei.org>
parents:
381
diff
changeset
|
1546 ;; |
80
39e69daa2071
New feature "lsmyfile" added
HIROSE Yuuji <yuuji@gentei.org>
parents:
78
diff
changeset
|
1547 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
|
1548 else |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1549 if $isfrozen; then |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1550 title="$title(凍結板につき書き込み不可)" |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1551 else |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1552 title="$title(加入してないので書き込み不可)" |
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1553 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
|
1554 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
|
1555 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
|
1556 def=$formdir/article.def |
749 | 1557 echo "$title" | htmlescape > $tmpd/title.$$ |
397
e9e8b4d40220
Add feature of `frozen state' of the blog board
HIROSE Yuuji <yuuji@gentei.org>
parents:
386
diff
changeset
|
1558 echo "$subtitle$frozen_flag" > $tmpd/subtitle.$$ |
801
d368b937956e
Limit the number of articles to show by default
HIROSE Yuuji <yuuji@gentei.org>
parents:
782
diff
changeset
|
1559 ${BLOG_SHOW:-blog_showentry} blog $rowid "$2" \ |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
250
diff
changeset
|
1560 | _m4 -D_TITLE_="spaste(\`$tmpd/title.$$')" \ |
838
985ee9a09783
Hyperlinks in TITLE cannot be used..
HIROSE Yuuji <yuuji@gentei.org>
parents:
837
diff
changeset
|
1561 -D_H1_="spaste(\`$tmpd/title.$$')" \ |
259
85a001a9c7c5
Make it visible: the group is moderated; the user is a member of the group
HIROSE Yuuji <yuuji@gentei.org>
parents:
250
diff
changeset
|
1562 -D_BODYCLASS_=general"${memclass:+ $memclass}" \ |
189 | 1563 -D_FORMHEAD_="spaste(\`$tmpd/subtitle.$$')" \ |
1564 -D_FORM_='' \ | |
1565 -D_DUMPTABLE_="syscmd(cat)" -D_DUMPHEAD_="" \ | |
1566 $layout/html.m4.html $layout/form+dump-whead.m4.html | |
885
4c02a9f862d7
Prefix process id in all log entries
HIROSE Yuuji <yuuji@gentei.org>
parents:
884
diff
changeset
|
1567 err "blog_reply Finished: `gdate +%S.%03N` user=$user owner=[$owner] title=[$title]" |
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
|
1568 } |
451
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1569 |
898
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
1570 blog_fetch() { |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
1571 contenttype "text/plain; charset=utf-8"; echo |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
1572 err blog_fetch: blog "$@" |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
1573 blog_reply "$@" |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
1574 # blog_showentry blog "$@" |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
1575 } |
411ce55c0dae
AJAX posting and PJAX file-viewer initially introduced.
HIROSE Yuuji <yuuji@gentei.org>
parents:
890
diff
changeset
|
1576 |
451
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1577 blog_reply_article() { # Direct link to article in some blog |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1578 arid=${1:-0} # Already sanitized to digits |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1579 brid=`query "SELECT rowid FROM blog WHERE \ |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1580 id=(SELECT blogid FROM article WHERE rowid=$arid);"` |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1581 if [ -n "$brid" ]; then |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1582 newurl="?replyblog+$brid#$arid" |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1583 echo "Refresh: 0; $newurl"; echo |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1584 exit 0 |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1585 else |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1586 contenttype; echo |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1587 echo "無効な記事番号です." | html p |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1588 fi |
8965bdad3172
Add convenient link pattern [[#ArticleId]] for direct link to articles.
HIROSE Yuuji <yuuji@gentei.org>
parents:
446
diff
changeset
|
1589 } |