qwikdoc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +2 -0
- data/CHANGES +3 -0
- data/COPYING +340 -0
- data/Gemfile +3 -0
- data/README.md +10 -0
- data/Rakefile +10 -0
- data/TextFormattingRules +137 -0
- data/TextFormattingRules.ja +143 -0
- data/bin/qwikdoc +34 -0
- data/lib/qwik_doc.rb +15 -0
- data/lib/qwik_doc/hack.rb +184 -0
- data/qwikdoc.gemspec +26 -0
- data/spec/qwik_doc_spec.rb +305 -0
- data/spec/spec_helper.rb +12 -0
- data/vendor/qwik/Makefile +63 -0
- data/vendor/qwik/Rakefile +17 -0
- data/vendor/qwik/act-aa.rb +83 -0
- data/vendor/qwik/act-archive.rb +386 -0
- data/vendor/qwik/act-attach.rb +304 -0
- data/vendor/qwik/act-backup.rb +236 -0
- data/vendor/qwik/act-basic.rb +325 -0
- data/vendor/qwik/act-book.rb +161 -0
- data/vendor/qwik/act-calc.rb +371 -0
- data/vendor/qwik/act-charset.rb +251 -0
- data/vendor/qwik/act-christel.rb +112 -0
- data/vendor/qwik/act-chronology.rb +149 -0
- data/vendor/qwik/act-code.rb +155 -0
- data/vendor/qwik/act-comment.rb +554 -0
- data/vendor/qwik/act-config.rb +49 -0
- data/vendor/qwik/act-counter.rb +125 -0
- data/vendor/qwik/act-day.rb +96 -0
- data/vendor/qwik/act-describe.rb +135 -0
- data/vendor/qwik/act-diary.rb +109 -0
- data/vendor/qwik/act-edit.rb +317 -0
- data/vendor/qwik/act-embed-html.rb +296 -0
- data/vendor/qwik/act-emode.rb +150 -0
- data/vendor/qwik/act-event.rb +187 -0
- data/vendor/qwik/act-file.rb +303 -0
- data/vendor/qwik/act-files.rb +771 -0
- data/vendor/qwik/act-getpass.rb +295 -0
- data/vendor/qwik/act-history.rb +136 -0
- data/vendor/qwik/act-html.rb +204 -0
- data/vendor/qwik/act-httpauth.rb +147 -0
- data/vendor/qwik/act-include.rb +142 -0
- data/vendor/qwik/act-interwiki.rb +189 -0
- data/vendor/qwik/act-isearch.rb +109 -0
- data/vendor/qwik/act-keywords.rb +137 -0
- data/vendor/qwik/act-lang.rb +81 -0
- data/vendor/qwik/act-license.rb +63 -0
- data/vendor/qwik/act-list.rb +287 -0
- data/vendor/qwik/act-login.rb +410 -0
- data/vendor/qwik/act-logout.rb +60 -0
- data/vendor/qwik/act-mail.rb +159 -0
- data/vendor/qwik/act-map.rb +292 -0
- data/vendor/qwik/act-md5.rb +42 -0
- data/vendor/qwik/act-mdlb.rb +741 -0
- data/vendor/qwik/act-media.rb +416 -0
- data/vendor/qwik/act-member.rb +157 -0
- data/vendor/qwik/act-menu.rb +142 -0
- data/vendor/qwik/act-metadata.rb +323 -0
- data/vendor/qwik/act-mlsubmitform.rb +49 -0
- data/vendor/qwik/act-monitor.rb +167 -0
- data/vendor/qwik/act-new.rb +418 -0
- data/vendor/qwik/act-pagelist.rb +248 -0
- data/vendor/qwik/act-password.rb +145 -0
- data/vendor/qwik/act-plan.rb +210 -0
- data/vendor/qwik/act-povray.rb +230 -0
- data/vendor/qwik/act-presen.rb +380 -0
- data/vendor/qwik/act-redirect.rb +133 -0
- data/vendor/qwik/act-ring.rb +1071 -0
- data/vendor/qwik/act-rrefs.rb +255 -0
- data/vendor/qwik/act-ruby.rb +116 -0
- data/vendor/qwik/act-sample.rb +170 -0
- data/vendor/qwik/act-save.rb +295 -0
- data/vendor/qwik/act-schedule.rb +374 -0
- data/vendor/qwik/act-search.rb +180 -0
- data/vendor/qwik/act-searchwords.rb +51 -0
- data/vendor/qwik/act-sendpass.rb +83 -0
- data/vendor/qwik/act-site.rb +89 -0
- data/vendor/qwik/act-sitebackup.rb +419 -0
- data/vendor/qwik/act-sitelog.rb +118 -0
- data/vendor/qwik/act-smil.rb +299 -0
- data/vendor/qwik/act-status.rb +220 -0
- data/vendor/qwik/act-style.rb +608 -0
- data/vendor/qwik/act-table.rb +263 -0
- data/vendor/qwik/act-tableform.rb +241 -0
- data/vendor/qwik/act-tag.rb +103 -0
- data/vendor/qwik/act-text.rb +70 -0
- data/vendor/qwik/act-textarea.rb +164 -0
- data/vendor/qwik/act-theme.rb +346 -0
- data/vendor/qwik/act-toc.rb +112 -0
- data/vendor/qwik/act-typekey.rb +198 -0
- data/vendor/qwik/act-under-const.rb +94 -0
- data/vendor/qwik/act-webservice.rb +321 -0
- data/vendor/qwik/act-wema.rb +558 -0
- data/vendor/qwik/act-wysiwyg.rb +238 -0
- data/vendor/qwik/action.rb +325 -0
- data/vendor/qwik/autoreload.rb +98 -0
- data/vendor/qwik/bench-bench.rb +28 -0
- data/vendor/qwik/bench-emode.rb +47 -0
- data/vendor/qwik/bench-format-xml.rb +70 -0
- data/vendor/qwik/bench-large-table.rb +62 -0
- data/vendor/qwik/bench-md5.rb +14 -0
- data/vendor/qwik/bench-module-session.rb +19 -0
- data/vendor/qwik/bench-page.rb +50 -0
- data/vendor/qwik/bench-s-md5.rb +28 -0
- data/vendor/qwik/bench-session.rb +25 -0
- data/vendor/qwik/bench-textformat.rb +31 -0
- data/vendor/qwik/catalog-factory.rb +91 -0
- data/vendor/qwik/catalog-ja.rb +479 -0
- data/vendor/qwik/catalog-ml-ja.rb +145 -0
- data/vendor/qwik/check-act-monitor.rb +112 -0
- data/vendor/qwik/check-act-monitor2.rb +46 -0
- data/vendor/qwik/check-act-theme.rb +27 -0
- data/vendor/qwik/check-event.rb +112 -0
- data/vendor/qwik/check-event2.rb +55 -0
- data/vendor/qwik/check-htree-rexml.rb +77 -0
- data/vendor/qwik/check-htree.rb +51 -0
- data/vendor/qwik/check-libxml.rb +135 -0
- data/vendor/qwik/check-many-pages.rb +47 -0
- data/vendor/qwik/check-monitor.rb +33 -0
- data/vendor/qwik/check-observer.rb +67 -0
- data/vendor/qwik/check-server.rb +61 -0
- data/vendor/qwik/check-uuencode.rb +33 -0
- data/vendor/qwik/check-webdav.rb +65 -0
- data/vendor/qwik/check-xml-xpath.rb +27 -0
- data/vendor/qwik/common-backtrace.rb +94 -0
- data/vendor/qwik/common-basic.rb +111 -0
- data/vendor/qwik/common-condition.rb +142 -0
- data/vendor/qwik/common-error.rb +48 -0
- data/vendor/qwik/common-gettext.rb +50 -0
- data/vendor/qwik/common-javascript.rb +45 -0
- data/vendor/qwik/common-notice.rb +132 -0
- data/vendor/qwik/common-plain.rb +105 -0
- data/vendor/qwik/common-plugin.rb +111 -0
- data/vendor/qwik/common-res.rb +76 -0
- data/vendor/qwik/common-resolve.rb +92 -0
- data/vendor/qwik/common-send.rb +171 -0
- data/vendor/qwik/common-session.rb +139 -0
- data/vendor/qwik/common-surface.rb +261 -0
- data/vendor/qwik/common-url.rb +90 -0
- data/vendor/qwik/compat/Makefile +12 -0
- data/vendor/qwik/compat/add_load_path.rb +1 -0
- data/vendor/qwik/config.rb +299 -0
- data/vendor/qwik/db-b-backup.rb +142 -0
- data/vendor/qwik/db-backup.rb +184 -0
- data/vendor/qwik/db-berkeley.rb +306 -0
- data/vendor/qwik/db-filesystem.rb +305 -0
- data/vendor/qwik/db-indexer.rb +154 -0
- data/vendor/qwik/db-searchwords.rb +238 -0
- data/vendor/qwik/description-ja.rb +267 -0
- data/vendor/qwik/description.rb +256 -0
- data/vendor/qwik/dev-add-copyright.rb +23 -0
- data/vendor/qwik/dev-backup.rb +24 -0
- data/vendor/qwik/dev-bench.rb +175 -0
- data/vendor/qwik/dev-calctime.rb +52 -0
- data/vendor/qwik/dev-css-compressor.rb +60 -0
- data/vendor/qwik/dev-extract-catalog.rb +102 -0
- data/vendor/qwik/dev-js-compressor.rb +73 -0
- data/vendor/qwik/dev-release.rb +235 -0
- data/vendor/qwik/dev-replace.rb +353 -0
- data/vendor/qwik/dev-sendmail.rb +25 -0
- data/vendor/qwik/farm.rb +283 -0
- data/vendor/qwik/gettext.rb +56 -0
- data/vendor/qwik/group-cond.rb +157 -0
- data/vendor/qwik/group-config.rb +247 -0
- data/vendor/qwik/group-confirm.rb +147 -0
- data/vendor/qwik/group-db.rb +326 -0
- data/vendor/qwik/group-mail.rb +195 -0
- data/vendor/qwik/group-member.rb +307 -0
- data/vendor/qwik/group-sendmail.rb +231 -0
- data/vendor/qwik/group-site.rb +374 -0
- data/vendor/qwik/group-sweep.rb +63 -0
- data/vendor/qwik/group.rb +157 -0
- data/vendor/qwik/helper.rb +6 -0
- data/vendor/qwik/html-generator.rb +104 -0
- data/vendor/qwik/html-to-wabisabi.rb +149 -0
- data/vendor/qwik/htree-diff.rb +87 -0
- data/vendor/qwik/htree-format-xml.rb +57 -0
- data/vendor/qwik/htree-generator.rb +144 -0
- data/vendor/qwik/htree-get.rb +251 -0
- data/vendor/qwik/htree-html-generator.rb +179 -0
- data/vendor/qwik/htree-template.rb +263 -0
- data/vendor/qwik/htree-to-wabisabi.rb +171 -0
- data/vendor/qwik/loadlib.rb +79 -0
- data/vendor/qwik/logger.rb +115 -0
- data/vendor/qwik/mail-body.rb +171 -0
- data/vendor/qwik/mail-header.rb +474 -0
- data/vendor/qwik/mail-multipart.rb +193 -0
- data/vendor/qwik/mail-parse.rb +147 -0
- data/vendor/qwik/mail.rb +341 -0
- data/vendor/qwik/mailaddress.rb +83 -0
- data/vendor/qwik/mdlb-model.rb +81 -0
- data/vendor/qwik/mdlb-sample.rb +324 -0
- data/vendor/qwik/ml-catalog-factory.rb +27 -0
- data/vendor/qwik/ml-exception.rb +15 -0
- data/vendor/qwik/ml-generator.rb +28 -0
- data/vendor/qwik/ml-gettext.rb +137 -0
- data/vendor/qwik/ml-logger.rb +82 -0
- data/vendor/qwik/ml-memory.rb +65 -0
- data/vendor/qwik/ml-msg-validator.rb +86 -0
- data/vendor/qwik/ml-processor.rb +609 -0
- data/vendor/qwik/ml-quickml-server.rb +122 -0
- data/vendor/qwik/ml-sendmail.rb +0 -0
- data/vendor/qwik/ml-server.rb +107 -0
- data/vendor/qwik/ml-session.rb +348 -0
- data/vendor/qwik/ml-sweeper.rb +101 -0
- data/vendor/qwik/mock-logger.rb +65 -0
- data/vendor/qwik/mock-sendmail.rb +78 -0
- data/vendor/qwik/mock-socket.rb +82 -0
- data/vendor/qwik/modulobe.rb +406 -0
- data/vendor/qwik/mongrel-server.rb +72 -0
- data/vendor/qwik/page-files.rb +249 -0
- data/vendor/qwik/page-generate.rb +82 -0
- data/vendor/qwik/page-get.rb +262 -0
- data/vendor/qwik/page-images.rb +168 -0
- data/vendor/qwik/page-put.rb +128 -0
- data/vendor/qwik/page-rrefs.rb +154 -0
- data/vendor/qwik/page-title.rb +0 -0
- data/vendor/qwik/page-wikidb.rb +234 -0
- data/vendor/qwik/page.rb +67 -0
- data/vendor/qwik/pages.rb +444 -0
- data/vendor/qwik/parse-plugin.rb +249 -0
- data/vendor/qwik/parser-emode.rb +116 -0
- data/vendor/qwik/parser-inline.rb +273 -0
- data/vendor/qwik/parser.rb +350 -0
- data/vendor/qwik/password.rb +183 -0
- data/vendor/qwik/periodic.rb +79 -0
- data/vendor/qwik/qp.rb +56 -0
- data/vendor/qwik/qwik-service.rb +341 -0
- data/vendor/qwik/qwik.rb +5 -0
- data/vendor/qwik/qwikweb-adduser.rb +34 -0
- data/vendor/qwik/qwikweb-catalog-validator.rb +110 -0
- data/vendor/qwik/qwikweb-incgen.rb +28 -0
- data/vendor/qwik/qwikweb-makesite.rb +41 -0
- data/vendor/qwik/qwikweb-server.rb +44 -0
- data/vendor/qwik/qwikweb-showpassword.rb +26 -0
- data/vendor/qwik/qwikweb-watchlog.rb +67 -0
- data/vendor/qwik/request-path.rb +304 -0
- data/vendor/qwik/request-ua.rb +76 -0
- data/vendor/qwik/request-webrick.rb +81 -0
- data/vendor/qwik/request.rb +91 -0
- data/vendor/qwik/resolve-tdiary.rb +292 -0
- data/vendor/qwik/resolve.rb +121 -0
- data/vendor/qwik/response.rb +228 -0
- data/vendor/qwik/server-memory.rb +57 -0
- data/vendor/qwik/server-webrick.rb +102 -0
- data/vendor/qwik/server.rb +252 -0
- data/vendor/qwik/site-config.rb +149 -0
- data/vendor/qwik/site-db.rb +136 -0
- data/vendor/qwik/site-event.rb +162 -0
- data/vendor/qwik/site-files.rb +86 -0
- data/vendor/qwik/site-group.rb +103 -0
- data/vendor/qwik/site-index.rb +47 -0
- data/vendor/qwik/site-log.rb +64 -0
- data/vendor/qwik/site-member.rb +230 -0
- data/vendor/qwik/site-monitor.rb +97 -0
- data/vendor/qwik/site-pages.rb +62 -0
- data/vendor/qwik/site-plan.rb +139 -0
- data/vendor/qwik/site-report.rb +282 -0
- data/vendor/qwik/site-resolve.rb +230 -0
- data/vendor/qwik/site-rrefs.rb +18 -0
- data/vendor/qwik/site-search.rb +180 -0
- data/vendor/qwik/site-timeline.rb +153 -0
- data/vendor/qwik/site-url.rb +189 -0
- data/vendor/qwik/site.rb +76 -0
- data/vendor/qwik/smil-time.rb +105 -0
- data/vendor/qwik/smtp-session.rb +331 -0
- data/vendor/qwik/template-generator.rb +149 -0
- data/vendor/qwik/template.rb +85 -0
- data/vendor/qwik/test-common.rb +10 -0
- data/vendor/qwik/test-ml-info.rb +225 -0
- data/vendor/qwik/test-module-ml.rb +142 -0
- data/vendor/qwik/test-module-path.rb +110 -0
- data/vendor/qwik/test-module-public.rb +70 -0
- data/vendor/qwik/test-module-server.rb +98 -0
- data/vendor/qwik/test-module-session.rb +264 -0
- data/vendor/qwik/test-module-suite.rb +91 -0
- data/vendor/qwik/test-ms-applemail.rb +59 -0
- data/vendor/qwik/test-ms-attach.rb +174 -0
- data/vendor/qwik/test-ms-basic.rb +40 -0
- data/vendor/qwik/test-ms-close.rb +35 -0
- data/vendor/qwik/test-ms-confirm.rb +75 -0
- data/vendor/qwik/test-ms-ignore-spam.rb +57 -0
- data/vendor/qwik/test-ms-japanese.rb +97 -0
- data/vendor/qwik/test-ms-jfilename.rb +82 -0
- data/vendor/qwik/test-ms-large.rb +58 -0
- data/vendor/qwik/test-ms-member.rb +103 -0
- data/vendor/qwik/test-ms-multipart.rb +84 -0
- data/vendor/qwik/test-ms-org.rb +129 -0
- data/vendor/qwik/test-ms-plan.rb +130 -0
- data/vendor/qwik/test-ms-post.rb +53 -0
- data/vendor/qwik/test-ms-quopri.rb +76 -0
- data/vendor/qwik/test-sub-quopri.rb +45 -0
- data/vendor/qwik/test-submit-base64.rb +59 -0
- data/vendor/qwik/test-submit-forward.rb +61 -0
- data/vendor/qwik/test-submit-html-mail.rb +52 -0
- data/vendor/qwik/test-submit-japanese.rb +135 -0
- data/vendor/qwik/test-submit-jfilename.rb +144 -0
- data/vendor/qwik/test-submit-uuencode.rb +71 -0
- data/vendor/qwik/test-suite-all.rb +8 -0
- data/vendor/qwik/test-suite-basic.rb +9 -0
- data/vendor/qwik/test-suite-ml.rb +9 -0
- data/vendor/qwik/test-typekey.rb +64 -0
- data/vendor/qwik/testunit.rb +45 -0
- data/vendor/qwik/tokenizer-inline.rb +294 -0
- data/vendor/qwik/tokenizer.rb +332 -0
- data/vendor/qwik/typekey.rb +160 -0
- data/vendor/qwik/util-basic.rb +135 -0
- data/vendor/qwik/util-charset.rb +332 -0
- data/vendor/qwik/util-css.rb +56 -0
- data/vendor/qwik/util-csv-tokenizer.rb +113 -0
- data/vendor/qwik/util-filename.rb +112 -0
- data/vendor/qwik/util-pathname.rb +202 -0
- data/vendor/qwik/util-pid.rb +58 -0
- data/vendor/qwik/util-safe.rb +67 -0
- data/vendor/qwik/util-sendmail.rb +273 -0
- data/vendor/qwik/util-string.rb +203 -0
- data/vendor/qwik/util-time.rb +125 -0
- data/vendor/qwik/util-webrick.rb +176 -0
- data/vendor/qwik/version.rb +11 -0
- data/vendor/qwik/wabisabi-basic.rb +163 -0
- data/vendor/qwik/wabisabi-diff.rb +130 -0
- data/vendor/qwik/wabisabi-format-xml.rb +310 -0
- data/vendor/qwik/wabisabi-generator.rb +262 -0
- data/vendor/qwik/wabisabi-index.rb +174 -0
- data/vendor/qwik/wabisabi-table.rb +212 -0
- data/vendor/qwik/wabisabi-template.rb +295 -0
- data/vendor/qwik/wabisabi-to-htree.rb +111 -0
- data/vendor/qwik/wabisabi-to-wiki.rb +690 -0
- data/vendor/qwik/wabisabi-traverse.rb +207 -0
- data/vendor/qwik/wabisabi-validator.rb +116 -0
- data/vendor/qwik/wabisabi.rb +5 -0
- metadata +416 -0
@@ -0,0 +1,112 @@
|
|
1
|
+
# -*- coding: cp932 -*-
|
2
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
3
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
4
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
7
|
+
|
8
|
+
module Qwik
|
9
|
+
class Action
|
10
|
+
D_christel = {
|
11
|
+
:dt => 'Takigawa Christel plugin',
|
12
|
+
:dd => 'You can embed Takigawa Christel image.',
|
13
|
+
:dc => "
|
14
|
+
Follow [[PluginChristel.describe]]"
|
15
|
+
}
|
16
|
+
|
17
|
+
D_PluginChristel = {
|
18
|
+
:dt => 'Takigawa Christel plugin',
|
19
|
+
:dd => 'You can embed Takigawa Christel image.',
|
20
|
+
:dc => "* Example
|
21
|
+
{{christel
|
22
|
+
This is Takigawa Christel plugin.
|
23
|
+
}}
|
24
|
+
{{christel
|
25
|
+
This is Takigawa Christel plugin.
|
26
|
+
}}
|
27
|
+
|
28
|
+
{{christel
|
29
|
+
You can embed images.
|
30
|
+
http://qwik.jp/.theme/i/login_qwik_logo.gif
|
31
|
+
}}
|
32
|
+
{{christel
|
33
|
+
You can embed images.
|
34
|
+
http://qwik.jp/.theme/i/login_qwik_logo.gif
|
35
|
+
}}
|
36
|
+
|
37
|
+
{{christel(640)
|
38
|
+
You can see bigger one.
|
39
|
+
}}
|
40
|
+
{{christel(640)
|
41
|
+
You can see bigger one.
|
42
|
+
}}
|
43
|
+
"
|
44
|
+
}
|
45
|
+
|
46
|
+
D_PluginChristel_ja = {
|
47
|
+
:dt => '���N���X�e���v���O�C��',
|
48
|
+
:dd => '���N���X�e������ɑ��ɂ���ׂ��Ă��炢�܂��B',
|
49
|
+
:dc => "* Example
|
50
|
+
{{christel
|
51
|
+
���N���X�e���v���O�C���ł�
|
52
|
+
}}
|
53
|
+
{{christel
|
54
|
+
���N���X�e���v���O�C���ł�
|
55
|
+
}}
|
56
|
+
|
57
|
+
{{christel
|
58
|
+
�摜�����ߍ��߂܂�
|
59
|
+
http://qwik.jp/.theme/i/login_qwik_logo.gif
|
60
|
+
}}
|
61
|
+
{{christel
|
62
|
+
�摜�����ߍ��߂܂�
|
63
|
+
http://qwik.jp/.theme/i/login_qwik_logo.gif
|
64
|
+
}}
|
65
|
+
|
66
|
+
{{christel(640)
|
67
|
+
�傫�����Ă݂܂���
|
68
|
+
}}
|
69
|
+
{{christel(640)
|
70
|
+
�傫�����Ă݂܂���
|
71
|
+
}}
|
72
|
+
"
|
73
|
+
}
|
74
|
+
|
75
|
+
def plg_christel(width = 320)
|
76
|
+
width = width.to_i.to_s
|
77
|
+
content = yield
|
78
|
+
message, image_url = content.to_a
|
79
|
+
message.chomp!
|
80
|
+
image_url.chomp! if image_url
|
81
|
+
query_str = {
|
82
|
+
:m => message.set_page_charset.to_euc,
|
83
|
+
:u => image_url
|
84
|
+
}.to_query_string
|
85
|
+
url = "http://gedo-style.com/crstl/crstl.php?#{query_str}"
|
86
|
+
return [:img, {:src=>url, :width=>width}]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
if $0 == __FILE__
|
92
|
+
require 'qwik/test-common'
|
93
|
+
$test = true
|
94
|
+
end
|
95
|
+
|
96
|
+
if defined?($test) && $test
|
97
|
+
class TestActChristel < Test::Unit::TestCase
|
98
|
+
include TestSession
|
99
|
+
|
100
|
+
def test_all
|
101
|
+
ok_wi([:img, {:width=>'320',
|
102
|
+
:src=>"http://gedo-style.com/crstl/crstl.php?m=a"}],
|
103
|
+
"{{christel\na\n}}")
|
104
|
+
ok_wi([:img, {:width=>'320',
|
105
|
+
:src=>"http://gedo-style.com/crstl/crstl.php?m=a&u=b"}],
|
106
|
+
"{{christel\na\nb\n}}")
|
107
|
+
ok_wi([:img, {:width=>'640',
|
108
|
+
:src=>"http://gedo-style.com/crstl/crstl.php?m=a"}],
|
109
|
+
"{{christel(640)\na\n}}")
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
2
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
3
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
6
|
+
require 'qwik/site-timeline'
|
7
|
+
|
8
|
+
module Qwik
|
9
|
+
class Action
|
10
|
+
D_ExtChronology = {
|
11
|
+
:dt => 'Chronology of site',
|
12
|
+
:dd => "You can see when the pages are created and updated.",
|
13
|
+
:dc => "* How to
|
14
|
+
Please go [[.chronology]] page to see the chronology of this site.
|
15
|
+
"
|
16
|
+
}
|
17
|
+
|
18
|
+
D_ExtChronology_ja = {
|
19
|
+
:dt => '�N�\�@�\ ',
|
20
|
+
:dd => "�T�C�g�̃y�[�W�����쐬����A�ҏW����Ă����̂����ꗗ�ł��܂��B",
|
21
|
+
:dc => '* �g����
|
22
|
+
[[.chronology]]�y�[�W�ŁA���̃T�C�g�̔N�\���\�����܂��B
|
23
|
+
'
|
24
|
+
}
|
25
|
+
|
26
|
+
def act_chronology
|
27
|
+
c_require_pagename
|
28
|
+
#c_require_member
|
29
|
+
|
30
|
+
timeline = @site.timeline
|
31
|
+
timeline.calc_history
|
32
|
+
divs = chronology_make_divs(timeline)
|
33
|
+
return chronology_show(divs)
|
34
|
+
end
|
35
|
+
alias act_time_walker act_chronology # Obsolete
|
36
|
+
|
37
|
+
CHRONOLOGY_WIDTH = 950
|
38
|
+
CHRONOLOGY_HEIGHT = 550
|
39
|
+
|
40
|
+
def chronology_make_divs(timeline)
|
41
|
+
# height =
|
42
|
+
|
43
|
+
times = timeline.times
|
44
|
+
pages_history = timeline.pages_history
|
45
|
+
page_min = timeline.page_min
|
46
|
+
site_min = timeline.site_min
|
47
|
+
site_duration = timeline.site_duration
|
48
|
+
|
49
|
+
return [:p, "No files here."] if times.nil?
|
50
|
+
page_num = times.length # Total page number
|
51
|
+
return [:p, "No files here."] if page_num == 0
|
52
|
+
|
53
|
+
h_span = CHRONOLOGY_HEIGHT / page_num
|
54
|
+
x_offset = 60
|
55
|
+
y_offset = 50
|
56
|
+
|
57
|
+
divs = []
|
58
|
+
num = 0
|
59
|
+
pages_history.each {|key|
|
60
|
+
ar = times[key]
|
61
|
+
|
62
|
+
pm_time = page_min[key]
|
63
|
+
|
64
|
+
x = 10
|
65
|
+
y = y_offset + CHRONOLOGY_HEIGHT * num / page_num
|
66
|
+
|
67
|
+
page = @site[key]
|
68
|
+
next if page.nil?
|
69
|
+
title = page.get_title
|
70
|
+
url = page.url
|
71
|
+
|
72
|
+
divs << [:div, {:title=>"#{title} | #{pm_time.ymd}",
|
73
|
+
:class=>'time_title',
|
74
|
+
:style=>"position:absolute;left:#{x}px;top:#{y}px;height:#{h_span}px;"},
|
75
|
+
[:a, {:href=>url}, title]]
|
76
|
+
|
77
|
+
num += 1
|
78
|
+
ar.each {|time|
|
79
|
+
past_time = time - site_min
|
80
|
+
x = x_offset + (CHRONOLOGY_WIDTH-x_offset) * past_time / site_duration
|
81
|
+
divs << [:div, {:title=>"#{title} | #{time.ymd}",
|
82
|
+
:class=>'time_update',
|
83
|
+
:style=>"left:#{x}px;top:#{y}px;width:10px;height:#{h_span}px;"},
|
84
|
+
[:a, {:href=>url}, '_']]
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
return divs
|
89
|
+
end
|
90
|
+
|
91
|
+
def chronology_show(divs)
|
92
|
+
ar = []
|
93
|
+
|
94
|
+
ar << [:style, "@import '.theme/css/wema.css';"]
|
95
|
+
|
96
|
+
ar << [:style, "
|
97
|
+
.time_update {
|
98
|
+
margin: 0;
|
99
|
+
padding: 0;
|
100
|
+
position: absolute;
|
101
|
+
background-color: #6dd;
|
102
|
+
border: 1px outset #9ff;
|
103
|
+
}
|
104
|
+
.time_update a {
|
105
|
+
margin: 0;
|
106
|
+
padding: 0;
|
107
|
+
}
|
108
|
+
"]
|
109
|
+
|
110
|
+
section = []
|
111
|
+
section << [:div, {:id=>"chronology"}, '']
|
112
|
+
section << divs
|
113
|
+
section << [:div, {:id=>'lines'}, '']
|
114
|
+
ar << [:div, {:class=>'day'},
|
115
|
+
[:div, {:class=>'section'},
|
116
|
+
section]]
|
117
|
+
|
118
|
+
ar << [:script,
|
119
|
+
{:type=>'text/javascript', :src=>'.theme/js/wema.js'}, '']
|
120
|
+
ar << [:script,
|
121
|
+
{:type=>'text/javascript',:src=>'.theme/js/history.js'}, '']
|
122
|
+
|
123
|
+
title = _('Chronology') + " | #{@site.sitename}"
|
124
|
+
return c_plain(title) { ar }
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
if $0 == __FILE__
|
130
|
+
require 'qwik/test-common'
|
131
|
+
$test = true
|
132
|
+
end
|
133
|
+
|
134
|
+
if defined?($test) && $test
|
135
|
+
class TestActChronology < Test::Unit::TestCase
|
136
|
+
include TestSession
|
137
|
+
|
138
|
+
def test_all
|
139
|
+
t_add_user
|
140
|
+
|
141
|
+
page = @site.create_new
|
142
|
+
page.store '* t1' # Store this page first
|
143
|
+
page.store '* t2' # Store this page second
|
144
|
+
|
145
|
+
res = session '/test/.chronology'
|
146
|
+
ok_in ['Chronology | test'], '//title'
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# -*- coding: shift_jis -*-
|
2
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
3
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
4
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'GD'
|
8
|
+
$have_gd = true
|
9
|
+
rescue LoadError
|
10
|
+
$have_gd = false
|
11
|
+
end
|
12
|
+
|
13
|
+
module Qwik
|
14
|
+
class Action
|
15
|
+
D_code = {
|
16
|
+
:dt => 'Code input plugin',
|
17
|
+
:dd => 'You can input code on the page.',
|
18
|
+
:dc => "
|
19
|
+
Follow [[PluginCode.describe]]"
|
20
|
+
}
|
21
|
+
|
22
|
+
D_PluginCode = {
|
23
|
+
:dt => 'Code input plugin',
|
24
|
+
:dd => 'You can input code on the page.',
|
25
|
+
:dc => "* Examples
|
26
|
+
{{code
|
27
|
+
puts \"hello, world!\"
|
28
|
+
puts \"hello, qwik users!\"
|
29
|
+
}}
|
30
|
+
{{code
|
31
|
+
puts \"hello, world!\"
|
32
|
+
puts \"hello, qwik users!\"
|
33
|
+
}}
|
34
|
+
{{code
|
35
|
+
#include <stdio.h>
|
36
|
+
|
37
|
+
void main(){
|
38
|
+
printf(\"hello, world!\\n\");
|
39
|
+
}
|
40
|
+
}}
|
41
|
+
"
|
42
|
+
}
|
43
|
+
|
44
|
+
D_PluginCode_ja = {
|
45
|
+
:dt => '�R�[�h�E�v���O�C��',
|
46
|
+
:dd => '�y�[�W���ɃR�[�h�����߂��ނƂ��Ɏg���܂��B',
|
47
|
+
:dc => "* ��
|
48
|
+
{{code
|
49
|
+
puts \"hello, world!\"
|
50
|
+
puts \"hello, qwik users!\"
|
51
|
+
}}
|
52
|
+
{{code
|
53
|
+
puts \"hello, world!\"
|
54
|
+
puts \"hello, qwik users!\"
|
55
|
+
}}
|
56
|
+
{{code
|
57
|
+
#include <stdio.h>
|
58
|
+
|
59
|
+
void main(){
|
60
|
+
printf(\"hello, world!\\n\");
|
61
|
+
}
|
62
|
+
}}
|
63
|
+
"
|
64
|
+
}
|
65
|
+
|
66
|
+
def plg_code(filename=nil, base_linenum=1)
|
67
|
+
content = ''
|
68
|
+
content = yield if block_given?
|
69
|
+
pre = [:pre]
|
70
|
+
content.each_with_index {|line, index|
|
71
|
+
line.chomp!
|
72
|
+
linenum = index + base_linenum.to_i
|
73
|
+
klass = 'line '
|
74
|
+
klass += if linenum % 2 == 0 then 'even' else 'odd' end
|
75
|
+
style = "background:url(.num/#{linenum}.png) no-repeat;"
|
76
|
+
pre << [:span, {:class=>klass, :style=>style}, line]
|
77
|
+
pre << "\n"
|
78
|
+
}
|
79
|
+
return [:div, {:class=>'code'}, pre]
|
80
|
+
end
|
81
|
+
|
82
|
+
def act_num
|
83
|
+
return c_nerror if ! $have_gd
|
84
|
+
args = @req.path_args
|
85
|
+
return c_nerror if args.nil? || args.empty?
|
86
|
+
filename = args.first
|
87
|
+
return c_nerror unless /\A([0-9]+)\.png\z/ =~ filename
|
88
|
+
str = $1
|
89
|
+
return c_nerror if 10 < str.length
|
90
|
+
files = @site.files('FrontPage')
|
91
|
+
if ! files.exist?(filename)
|
92
|
+
png = Action.generate_png(str)
|
93
|
+
files.put(filename, png)
|
94
|
+
end
|
95
|
+
path = files.path(filename)
|
96
|
+
return c_simple_send(path, 'image/png')
|
97
|
+
end
|
98
|
+
|
99
|
+
def self.generate_png(str)
|
100
|
+
return nil if ! $have_gd
|
101
|
+
font, fw, fh = GD::Font::TinyFont, 5, 8
|
102
|
+
str = str.to_s
|
103
|
+
width = fw * str.length
|
104
|
+
height = fh
|
105
|
+
img = GD::Image.new(width, height)
|
106
|
+
white = img.colorAllocate(255, 255, 255)
|
107
|
+
color = img.colorAllocate(127, 127, 127)
|
108
|
+
img.transparent(white)
|
109
|
+
img.string(font, 0, 0, str, color)
|
110
|
+
return img.pngStr
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
if $0 == __FILE__
|
116
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
117
|
+
require 'qwik/test-common'
|
118
|
+
$test = true
|
119
|
+
end
|
120
|
+
|
121
|
+
if defined?($test) && $test
|
122
|
+
class TestActCode < Test::Unit::TestCase
|
123
|
+
include TestSession
|
124
|
+
|
125
|
+
def test_code
|
126
|
+
res = session
|
127
|
+
ok_wi [:div, {:class=>"code"},
|
128
|
+
[:pre, [:span, {:style=>"background:url(.num/1.png) no-repeat;",
|
129
|
+
:class=>"line odd"}, "t"], "\n"]],
|
130
|
+
"{{code\nt\n}}"
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_num
|
134
|
+
return unless $have_gd
|
135
|
+
|
136
|
+
t_add_user
|
137
|
+
|
138
|
+
res = session('/test/.num/1.png')
|
139
|
+
eq 'image/png', res['Content-Type']
|
140
|
+
str = res.body
|
141
|
+
eq "\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\000\005\000\000\000\010\001\003\000\000\000\v?\247x\000\000\000\006PLTE\377\377\377\177\177\177br\365\207\000\000\000\001tRNS\000@\346\330f\000\000\000\024IDAT\010\231c``P`H\000b\020,``\000\000\t\300\001Q2\2179L\000\000\000\000IEND\256B`\202", str
|
142
|
+
|
143
|
+
res = session('/test/.num/1234567890.png')
|
144
|
+
str = res.body
|
145
|
+
# eq "\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\0002\000\000\000\010\001\003\000\000\000\201\020>9\000\000\000\006PLTE\377\377\377\177\177\177br\365\207\000\000\000\001tRNS\000@\346\330f\000\000\000=IDAT\010\231c`\200\002e\t\177\3433\211\f\f)KN8\004Mj`P\350\364\v\350\331\324\300\240\310\3720cRP\003\203\222\212\247\247\220P\003C\371\f7C\236D\230.\006\000\352y\016\246.\260\314\346\000\000\000\000IEND\256B`\202", str
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_generate_png
|
149
|
+
return if $0 != __FILE__ # Only for separated test.
|
150
|
+
png = Qwik::Action.generate_png(1234567890)
|
151
|
+
# 'tmp.png'.path.write(png)
|
152
|
+
# eq "\211PNG\r\n\032\n\000\000\000\rIHDR\000\000\0002\000\000\000\010\001\003\000\000\000\201\020>9\000\000\000\006PLTE\377\377\377\177\177\177br\365\207\000\000\000\001tRNS\000@\346\330f\000\000\000=IDAT\010\231c`\200\002e\t\177\3433\211\f\f)KN8\004Mj`P\350\364\v\350\331\324\300\240\310\3720cRP\003\203\222\212\247\247\220P\003C\371\f7C\236D\230.\006\000\352y\016\246.\260\314\346\000\000\000\000IEND\256B`\202", png
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
@@ -0,0 +1,554 @@
|
|
1
|
+
# -*- coding: shift_jis -*-
|
2
|
+
# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved.
|
3
|
+
# This is free software with ABSOLUTELY NO WARRANTY.
|
4
|
+
# You can redistribute it and/or modify it under the terms of the GNU GPL 2.
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..'
|
7
|
+
|
8
|
+
module Qwik
|
9
|
+
class Action
|
10
|
+
D_PluginComment = {
|
11
|
+
:dt => 'Comment plugin',
|
12
|
+
:dd => 'You can show comment field.',
|
13
|
+
:dc => "
|
14
|
+
* Multiline comment plugin
|
15
|
+
You can show a multi line comment field.
|
16
|
+
{{mcomment}}
|
17
|
+
{{mcomment}}
|
18
|
+
Add (1) to args, then you see the newest comment on the top.
|
19
|
+
{{mcomment(1)}}
|
20
|
+
* Hiki like comment plugin
|
21
|
+
You can show a Hiki like comment field.
|
22
|
+
{{hcomment}}
|
23
|
+
{{hcomment}}
|
24
|
+
Add (1) to args, then you see the newest comment on the top.
|
25
|
+
{{hcomment(1)}}
|
26
|
+
* Old comment plugin
|
27
|
+
This plugin is obsolete. Please use 'mcomment' plugin instead.
|
28
|
+
{{comment}}
|
29
|
+
{{comment}}
|
30
|
+
"
|
31
|
+
}
|
32
|
+
|
33
|
+
D_PluginComment_ja = {
|
34
|
+
:dt => '�R�����g�E�v���O�C��',
|
35
|
+
:dd => '�R�����g���͗���\�����܂��B',
|
36
|
+
:dc => "
|
37
|
+
* �����s�R�����g�E�v���O�C��
|
38
|
+
�����s���͂ł���R�����g�E�v���O�C���ł��B
|
39
|
+
{{mcomment}}
|
40
|
+
{{mcomment}}
|
41
|
+
���̂悤�ɁA(1)������ƁA�V�����R�����g����ԏ�ɂ��悤�ɂȂ�܂��B
|
42
|
+
{{mcomment(1)}}
|
43
|
+
* Hiki���R�����g�E�v���O�C��
|
44
|
+
Hiki�̃R�����g�E�v���O�C���Ƃقړ����g�������ł��܂��B
|
45
|
+
{{hcomment}}
|
46
|
+
{{hcomment}}
|
47
|
+
���l�ɁA(1)������ƁA�V�����R�����g����ԏ�ɂ��悤�ɂȂ�܂��B
|
48
|
+
{{hcomment(1)}}
|
49
|
+
* ���R�����g�E�v���O�C��
|
50
|
+
�Â��d�l�̃R�����g�v���O�C���ł��̂ŁA���p�͐������܂���B
|
51
|
+
�umcomment�v�v���O�C���𐄏����܂��B
|
52
|
+
{{comment}}
|
53
|
+
{{comment}}
|
54
|
+
"
|
55
|
+
}
|
56
|
+
|
57
|
+
# ============================== comment
|
58
|
+
def plg_comment
|
59
|
+
action = "#{@req.base}.comment"
|
60
|
+
user = @req.user
|
61
|
+
return [:div, {:class=>'comment'},
|
62
|
+
[:form, {:action=>action},
|
63
|
+
[:dl,
|
64
|
+
[:dt, _('User')],
|
65
|
+
[:dd, [:em, user]],
|
66
|
+
[:dt, _('Message')],
|
67
|
+
[:dd, [:textarea, {:name=>'msg', :cols=>'40', :rows=>'7'}, '']],
|
68
|
+
[:dd, [:input, {:type=>'submit', :value=>'POST'}]]]]]
|
69
|
+
end
|
70
|
+
|
71
|
+
def ext_comment
|
72
|
+
user = MailAddress.obfuscate(@req.user)
|
73
|
+
ymdx = @req.start_time.ymdx
|
74
|
+
|
75
|
+
msg = "\n" + @req.query['msg']
|
76
|
+
msg = msg.normalize_newline
|
77
|
+
msg = msg.gsub("\n", '{{br}}')
|
78
|
+
content = ":#{user} (#{ymdx}):#{msg}\n"
|
79
|
+
|
80
|
+
page = @site[@req.base]
|
81
|
+
page.add(content)
|
82
|
+
c_make_log('comment') # COMMENT
|
83
|
+
url = @req.base+'.html'
|
84
|
+
return c_notice(_('Message has been added.'), url) {
|
85
|
+
[[:h2, _('Message has been added.')],
|
86
|
+
[:p, [:a, {:href=>url}, _('Go back')]]]
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
# ============================== Hiki style comment
|
91
|
+
def plg_hcomment(style='0')
|
92
|
+
action = @req.base+'.hcomment'
|
93
|
+
|
94
|
+
style = style.to_i
|
95
|
+
style = 0 if style != 1
|
96
|
+
|
97
|
+
# @hcomment_num is global for an action.
|
98
|
+
@hcomment_num = 0 if !defined?(@hcomment_num)
|
99
|
+
@hcomment_num += 1
|
100
|
+
num = @hcomment_num
|
101
|
+
|
102
|
+
return [:div, {:class=>'hcomment'},
|
103
|
+
[:form, {:method=>'POST', :action=>action},
|
104
|
+
_('Name'), ': ', [:input, {:name=>'name', :size=>10}], ' ',
|
105
|
+
_('Comment'), ': ', [:input, {:name=>'msg', :size=>50}], ' ',
|
106
|
+
[:input, {:type=>'submit', :name=>'comment', :value=>_('Submit')}],
|
107
|
+
[:input, {:type=>'hidden', :name=>'comment_no', :value=>num}],
|
108
|
+
[:input, {:type=>'hidden', :name=>'style', :value=>style}]]]
|
109
|
+
end
|
110
|
+
|
111
|
+
def ext_hcomment
|
112
|
+
#c_require_login # Guest can post.
|
113
|
+
c_require_login # Guest cannot post.
|
114
|
+
c_require_post
|
115
|
+
|
116
|
+
date = @req.start_time.ymdx
|
117
|
+
user = @req.query['name']
|
118
|
+
user = _('Anonymous') if user.nil? || user.empty?
|
119
|
+
msg = @req.query['msg']
|
120
|
+
return c_nerror('no message') if msg.nil? || msg.empty?
|
121
|
+
content = "- #{date} '''#{user}''' : #{msg}\n"
|
122
|
+
|
123
|
+
comment_no = @req.query['comment_no'].to_i
|
124
|
+
comment_no = 1 if comment_no < 1
|
125
|
+
style = @req.query['style'].to_i
|
126
|
+
style = 0 if style != 1
|
127
|
+
|
128
|
+
page = @site[@req.base]
|
129
|
+
str = page.load
|
130
|
+
md5 = str.md5hex
|
131
|
+
|
132
|
+
new_str, written = hcomment_add_to_page(str, comment_no, style, content)
|
133
|
+
|
134
|
+
return c_nerror(_('Failed')) if !written
|
135
|
+
|
136
|
+
begin
|
137
|
+
page.put_with_md5(new_str, md5)
|
138
|
+
rescue PageCollisionError
|
139
|
+
return hcomment_error(_('Page collision detected.'))
|
140
|
+
end
|
141
|
+
|
142
|
+
c_make_log('hcomment') # COMMENT
|
143
|
+
|
144
|
+
url = @req.base+'.html'
|
145
|
+
return c_notice(_('Add a comment.'), url){
|
146
|
+
[[:h2, _('Message has been added.')],
|
147
|
+
[:p, [:a, {:href=>url}, _('Go back')]]]
|
148
|
+
}
|
149
|
+
end
|
150
|
+
|
151
|
+
def hcomment_error(msg, url)
|
152
|
+
return c_nerror(msg){
|
153
|
+
[[:h2, msg],
|
154
|
+
[:p, msg],
|
155
|
+
[:p, _('Go back and input again.')],
|
156
|
+
[:dl,
|
157
|
+
[:dt, _('Name')], [:dd, user],
|
158
|
+
[:dt, _('Comment')], [:dd, msg],
|
159
|
+
[:p, [:a, {:href=>url}, _('Go back')]]]]
|
160
|
+
}
|
161
|
+
end
|
162
|
+
|
163
|
+
def hcomment_add_to_page(str, comment_no, style, content)
|
164
|
+
new_str = ''
|
165
|
+
num = 1
|
166
|
+
written = false
|
167
|
+
str.each {|line|
|
168
|
+
if /\A\{\{hcomment/ =~ line && !written
|
169
|
+
if num == comment_no
|
170
|
+
new_str << content if style == 0 # new comment is on the bottom.
|
171
|
+
new_str << line
|
172
|
+
new_str << content if style == 1 # new comment is on the top.
|
173
|
+
written = true
|
174
|
+
else
|
175
|
+
new_str << line
|
176
|
+
num += 1
|
177
|
+
end
|
178
|
+
else
|
179
|
+
new_str << line
|
180
|
+
end
|
181
|
+
}
|
182
|
+
return new_str, written
|
183
|
+
end
|
184
|
+
|
185
|
+
# ============================== Multiline comment
|
186
|
+
def plg_nomore_mcomment(style='0', cols='50', rows='4')
|
187
|
+
# Just show the content. No more post.
|
188
|
+
content = ''
|
189
|
+
content = yield if block_given?
|
190
|
+
messages = mcomment_construct_messages(content)
|
191
|
+
div = [:div, {:class=>'mcomment'}]
|
192
|
+
div += messages
|
193
|
+
return div
|
194
|
+
end
|
195
|
+
|
196
|
+
def plg_mcomment(style='0', cols='50', rows='4')
|
197
|
+
# @mcomment_num is global for an action.
|
198
|
+
@mcomment_num = 0 if !defined?(@mcomment_num)
|
199
|
+
@mcomment_num += 1
|
200
|
+
num = @mcomment_num
|
201
|
+
style = style.to_i
|
202
|
+
style = 0 if style != 1
|
203
|
+
action = "#{@req.base}.#{num}.#{style}.mcomment"
|
204
|
+
|
205
|
+
content = ''
|
206
|
+
content = yield if block_given?
|
207
|
+
messages = mcomment_construct_messages(content)
|
208
|
+
|
209
|
+
div = [:div, {:class=>'mcomment'}]
|
210
|
+
div += messages if style == 0
|
211
|
+
|
212
|
+
form = [:form, {:method=>'POST', :action=>action},
|
213
|
+
[:p, _('Name'), ': ', [:input, {:name=>'u', :size=>'30'}]],
|
214
|
+
[:p, _('Comment'), ': ',
|
215
|
+
[:textarea, {:name=>'m', :cols=>cols, :rows=>rows}, '']],
|
216
|
+
[:input, {:type=>'submit', :value=>_('Submit')}]]
|
217
|
+
|
218
|
+
form = [:form, {:method=>'POST', :action=>action},
|
219
|
+
[:table,
|
220
|
+
[:tr,
|
221
|
+
[:th, _('Name')],
|
222
|
+
[:td, [:input, {:name=>'u', :size=>'30'}]]],
|
223
|
+
[:tr,
|
224
|
+
[:th, _('Comment')],
|
225
|
+
[:td, [:textarea, {:name=>'m', :cols=>cols, :rows=>rows}, '']]],
|
226
|
+
[:tr,
|
227
|
+
[:th, ''],
|
228
|
+
[:td, [:input, {:type=>'submit', :value=>_('Submit')}]]]]]
|
229
|
+
|
230
|
+
div << form
|
231
|
+
|
232
|
+
div += messages if style == 1
|
233
|
+
return div
|
234
|
+
end
|
235
|
+
|
236
|
+
def mcomment_construct_messages(content)
|
237
|
+
messages = []
|
238
|
+
content.each {|line|
|
239
|
+
line.chomp!
|
240
|
+
dummy, date, user, msg = line.split('|', 4)
|
241
|
+
date = Time.at(date.to_i).ymd
|
242
|
+
msg ||= ''
|
243
|
+
msg.gsub!(/\\n/, "\n")
|
244
|
+
mm = []
|
245
|
+
msg.each {|m|
|
246
|
+
mm << m
|
247
|
+
mm << [:br]
|
248
|
+
}
|
249
|
+
messages << [:div, {:class=>'msg'},
|
250
|
+
[:dl, [:dt, [:span, {:class=>'date'}, date],
|
251
|
+
[:span, {:class=>'user'}, user]], [:dd, *mm]]]
|
252
|
+
}
|
253
|
+
return messages
|
254
|
+
end
|
255
|
+
|
256
|
+
def ext_mcomment
|
257
|
+
#c_require_login # Guest can also post comment.
|
258
|
+
c_require_login # Guest cannot post.
|
259
|
+
c_require_post
|
260
|
+
c_require_page_exist
|
261
|
+
|
262
|
+
date = @req.start_time.to_i
|
263
|
+
|
264
|
+
num = @req.ext_args[0].to_i
|
265
|
+
return c_nerror(_('Error')) if num < 1
|
266
|
+
|
267
|
+
style = @req.ext_args[1].to_i
|
268
|
+
style = 0 if style != 1
|
269
|
+
|
270
|
+
user = @req.query['u']
|
271
|
+
user = _('Anonymous') if user.nil? || user.empty?
|
272
|
+
|
273
|
+
msg = @req.query['m']
|
274
|
+
return c_nerror(_('No message.')) if msg.nil? || msg.empty?
|
275
|
+
msg = msg.normalize_newline
|
276
|
+
msg.gsub!("\n", "\\n")
|
277
|
+
|
278
|
+
comment = "|#{date}|#{user}|#{msg}\n"
|
279
|
+
|
280
|
+
begin
|
281
|
+
plugin_edit(:mcomment, num) {|content|
|
282
|
+
if style == 0
|
283
|
+
content += comment
|
284
|
+
else
|
285
|
+
content = comment + content
|
286
|
+
end
|
287
|
+
content
|
288
|
+
}
|
289
|
+
rescue NoCorrespondingPlugin
|
290
|
+
return c_nerror(_('Failed'))
|
291
|
+
rescue PageCollisionError
|
292
|
+
return mcomment_error(_('Page collision detected.'))
|
293
|
+
end
|
294
|
+
|
295
|
+
c_make_log('mcomment') # COMMENT
|
296
|
+
|
297
|
+
url = "#{@req.base}.html"
|
298
|
+
return c_notice(_('Add a comment.'), url){
|
299
|
+
[[:h2, _('Message has been added.')],
|
300
|
+
[:p, [:a, {:href=>url}, _('Go back')]]]
|
301
|
+
}
|
302
|
+
end
|
303
|
+
|
304
|
+
def mcomment_error(msg, url)
|
305
|
+
return c_nerror(msg){
|
306
|
+
[[:h2, msg],
|
307
|
+
[:p, msg],
|
308
|
+
[:p, _('Go back and input again.')],
|
309
|
+
[:dl,
|
310
|
+
[:dt, _('Name')], [:dd, user],
|
311
|
+
[:dt, _('Comment')], [:dd, msg],
|
312
|
+
[:p, [:a, {:href=>url}, _('Go back')]]]]
|
313
|
+
}
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
if $0 == __FILE__
|
319
|
+
require 'qwik/test-common'
|
320
|
+
$test = true
|
321
|
+
end
|
322
|
+
|
323
|
+
if defined?($test) && $test
|
324
|
+
class TestActComment < Test::Unit::TestCase
|
325
|
+
include TestSession
|
326
|
+
|
327
|
+
def test_plg_comment
|
328
|
+
t_add_user
|
329
|
+
ok_wi([:div, {:class=>'comment'},
|
330
|
+
[:form, {:action=>'1.comment'},
|
331
|
+
[:dl,
|
332
|
+
[:dt, 'User'],
|
333
|
+
[:dd, [:em, 'user@e.com']],
|
334
|
+
[:dt, 'Message'],
|
335
|
+
[:dd, [:textarea,
|
336
|
+
{:rows=>'7', :name=>'msg', :cols=>'40'}, '']],
|
337
|
+
[:dd, [:input, {:value=>'POST', :type=>'submit'}]]]]],
|
338
|
+
'{{comment}}')
|
339
|
+
end
|
340
|
+
|
341
|
+
def test_comment
|
342
|
+
t_add_user
|
343
|
+
|
344
|
+
page = @site.create_new
|
345
|
+
page.store '{{comment}}'
|
346
|
+
|
347
|
+
res = session('/test/1.html')
|
348
|
+
ok_xp([:textarea, {:cols=>'40', :rows=>'7', :name=>'msg'}, ''],
|
349
|
+
'//textarea')
|
350
|
+
|
351
|
+
# The 1st comment.
|
352
|
+
res = session('/test/1.comment?msg=Hi')
|
353
|
+
ok_title('Message has been added.')
|
354
|
+
|
355
|
+
res = session('/test/1.html')
|
356
|
+
ok_xp([:dl, [:dt, 'user@e... (1970-01-01 09:00:00)'], [:dd, [:br], 'Hi']],
|
357
|
+
"//div[@class='section']/dl[2]")
|
358
|
+
|
359
|
+
page = @site['_SiteChanged']
|
360
|
+
assert_match(/^,[.0-9]+,user@e.com,comment,1$/, page.load)
|
361
|
+
|
362
|
+
# The 2nd comment.
|
363
|
+
res = session('/test/1.comment?msg=hello%0aworld')
|
364
|
+
ok_title('Message has been added.')
|
365
|
+
|
366
|
+
res = session('/test/1.html')
|
367
|
+
ok_xp([:dl,
|
368
|
+
[:dt, 'user@e... (1970-01-01 09:00:00)'],
|
369
|
+
[:dd, [:br], 'Hi'],
|
370
|
+
[:dt, 'user@e... (1970-01-01 09:00:00)'],
|
371
|
+
[:dd, [:br], 'hello', [:br], 'world']],
|
372
|
+
'//div[@class="section"]/dl[2]')
|
373
|
+
|
374
|
+
page = @site['_SiteChanged']
|
375
|
+
assert_match(/^,[.0-9]+,user@e.com,comment,1$/, page.load)
|
376
|
+
end
|
377
|
+
|
378
|
+
def test_plg_hcomment
|
379
|
+
ok_wi([:div, {:class=>'hcomment'},
|
380
|
+
[:form, {:action=>'1.hcomment', :method=>'POST'},
|
381
|
+
'Name', ': ', [:input, {:size=>10, :name=>'name'}], ' ',
|
382
|
+
'Comment', ': ', [:input, {:size=>50, :name=>'msg'}], ' ',
|
383
|
+
[:input, {:value=>'Submit', :type=>'submit', :name=>'comment'}],
|
384
|
+
[:input, {:value=>1, :type=>'hidden', :name=>'comment_no'}],
|
385
|
+
[:input, {:value=>0, :type=>'hidden', :name=>'style'}]]],
|
386
|
+
'{{hcomment}}')
|
387
|
+
end
|
388
|
+
|
389
|
+
def test_ext_hcomment
|
390
|
+
t_add_user
|
391
|
+
|
392
|
+
page = @site.create_new
|
393
|
+
page.store("{{hcomment}}\n")
|
394
|
+
res = session('POST /test/1.hcomment?name=n&msg=m&comment_no=1&style=0')
|
395
|
+
ok_eq("- 1970-01-01 09:00:00 '''n''' : m\n{{hcomment}}\n",
|
396
|
+
page.load)
|
397
|
+
|
398
|
+
page.store("{{hcomment(1)}}\n")
|
399
|
+
res = session('POST /test/1.hcomment?name=n&msg=m&comment_no=1&style=1')
|
400
|
+
ok_eq("{{hcomment(1)}}\n- 1970-01-01 09:00:00 '''n''' : m\n",
|
401
|
+
page.load)
|
402
|
+
end
|
403
|
+
|
404
|
+
def test_plg_mcomment
|
405
|
+
ok_wi([:div, {:class=>'mcomment'},
|
406
|
+
[:form, {:method=>'POST', :action=>'1.1.0.mcomment'},
|
407
|
+
[:table,
|
408
|
+
[:tr, [:th, 'Name'],
|
409
|
+
[:td, [:input, {:size=>'30', :name=>'u'}]]],
|
410
|
+
[:tr,
|
411
|
+
[:th, 'Comment'],
|
412
|
+
[:td, [:textarea,
|
413
|
+
{:cols=>'50', :rows=>'4', :name=>'m'}, '']]],
|
414
|
+
[:tr, [:th, ''],
|
415
|
+
[:td, [:input, {:value=>'Submit', :type=>'submit'}]]]]]],
|
416
|
+
"{{mcomment}}")
|
417
|
+
ok_wi([:div, {:class=>'mcomment'},
|
418
|
+
[:div, {:class=>'msg'},
|
419
|
+
[:dl, [:dt,
|
420
|
+
[:span, {:class=>'date'}, '1970-01-01'],
|
421
|
+
[:span, {:class=>'user'}, 'u']],
|
422
|
+
[:dd, 'm', [:br]]]],
|
423
|
+
[:form, {:method=>'POST', :action=>'1.1.0.mcomment'},
|
424
|
+
[:table,
|
425
|
+
[:tr, [:th, 'Name'],
|
426
|
+
[:td, [:input, {:size=>'30', :name=>'u'}]]],
|
427
|
+
[:tr,[:th, 'Comment'],
|
428
|
+
[:td, [:textarea,
|
429
|
+
{:cols=>'50', :rows=>'4', :name=>'m'}, '']]],
|
430
|
+
[:tr, [:th, ''],
|
431
|
+
[:td, [:input, {:value=>'Submit', :type=>'submit'}]]]]]],
|
432
|
+
"{{mcomment
|
433
|
+
|0|u|m
|
434
|
+
}}")
|
435
|
+
ok_wi([:div, {:class=>'mcomment'},
|
436
|
+
[:form, {:method=>'POST', :action=>'1.1.1.mcomment'},
|
437
|
+
[:table,
|
438
|
+
[:tr, [:th, 'Name'],
|
439
|
+
[:td, [:input, {:size=>'30', :name=>'u'}]]],
|
440
|
+
[:tr, [:th, 'Comment'],
|
441
|
+
[:td, [:textarea,
|
442
|
+
{:cols=>'50', :rows=>'4', :name=>'m'}, '']]],
|
443
|
+
[:tr, [:th, ''],
|
444
|
+
[:td, [:input, {:value=>'Submit', :type=>'submit'}]]]]],
|
445
|
+
[:div, {:class=>'msg'},
|
446
|
+
[:dl, [:dt,
|
447
|
+
[:span, {:class=>'date'}, '1970-01-01'],
|
448
|
+
[:span, {:class=>'user'}, 'u']],
|
449
|
+
[:dd, 'm', [:br]]]]],
|
450
|
+
"{{mcomment(1)
|
451
|
+
|0|u|m
|
452
|
+
}}")
|
453
|
+
end
|
454
|
+
|
455
|
+
def test_ext_mcomment
|
456
|
+
t_add_user
|
457
|
+
|
458
|
+
page = @site.create_new
|
459
|
+
page.store("{{mcomment}}\n")
|
460
|
+
res = session('POST /test/1.html')
|
461
|
+
ok_xp([:div, {:class=>'mcomment'},
|
462
|
+
[:form, {:method=>'POST', :action=>'1.1.0.mcomment'},
|
463
|
+
[:table,
|
464
|
+
[:tr, [:th, 'Name'],
|
465
|
+
[:td, [:input, {:size=>'30', :name=>'u'}]]],
|
466
|
+
[:tr, [:th, 'Comment'],
|
467
|
+
[:td, [:textarea,
|
468
|
+
{:cols=>'50', :rows=>'4', :name=>'m'}, '']]],
|
469
|
+
[:tr, [:th, ''],
|
470
|
+
[:td, [:input, {:value=>'Submit', :type=>'submit'}]]]]]],
|
471
|
+
"//div[@class='mcomment']")
|
472
|
+
|
473
|
+
res = session("POST /test/1.1.0.mcomment?u=u&m=m")
|
474
|
+
eq "{{mcomment
|
475
|
+
|0|u|m
|
476
|
+
}}
|
477
|
+
", page.load
|
478
|
+
|
479
|
+
res = session("POST /test/1.1.0.mcomment?u=u2&m=m2")
|
480
|
+
eq "{{mcomment
|
481
|
+
|0|u|m
|
482
|
+
|0|u2|m2
|
483
|
+
}}
|
484
|
+
", page.load
|
485
|
+
|
486
|
+
page.store("{{mcomment(1)}}
|
487
|
+
")
|
488
|
+
res = session("POST /test/1.1.1.mcomment?u=u&m=m")
|
489
|
+
eq "{{mcomment(1)
|
490
|
+
|0|u|m
|
491
|
+
}}
|
492
|
+
", page.load
|
493
|
+
|
494
|
+
res = session("POST /test/1.1.1.mcomment?u=u2&m=m2")
|
495
|
+
eq "{{mcomment(1)
|
496
|
+
|0|u2|m2
|
497
|
+
|0|u|m
|
498
|
+
}}
|
499
|
+
", page.load
|
500
|
+
|
501
|
+
page.store("{{mcomment}}
|
502
|
+
{{mcomment}}
|
503
|
+
")
|
504
|
+
res = session("POST /test/1.1.0.mcomment?u=u&m=m")
|
505
|
+
eq "{{mcomment
|
506
|
+
|0|u|m
|
507
|
+
}}
|
508
|
+
{{mcomment}}
|
509
|
+
", page.load
|
510
|
+
|
511
|
+
res = session("POST /test/1.2.0.mcomment?u=u2&m=m2")
|
512
|
+
eq "{{mcomment
|
513
|
+
|0|u|m
|
514
|
+
}}
|
515
|
+
{{mcomment
|
516
|
+
|0|u2|m2
|
517
|
+
}}
|
518
|
+
", page.load
|
519
|
+
end
|
520
|
+
|
521
|
+
def test_ext_mcomment2
|
522
|
+
t_add_user
|
523
|
+
|
524
|
+
page = @site.create_new
|
525
|
+
page.store("{{mcomment}}\n")
|
526
|
+
res = session("POST /test/1.1.0.mcomment?u=u&m=m\n")
|
527
|
+
eq '{{mcomment
|
528
|
+
|0|u|m\n
|
529
|
+
}}
|
530
|
+
', page.load
|
531
|
+
|
532
|
+
page.store("{{mcomment}}\n")
|
533
|
+
res = session("POST /test/1.1.0.mcomment?u=u&m=m\r\n")
|
534
|
+
eq '{{mcomment
|
535
|
+
|0|u|m\n
|
536
|
+
}}
|
537
|
+
', page.load
|
538
|
+
|
539
|
+
page.store("{{mcomment}}\n")
|
540
|
+
res = session("POST /test/1.1.0.mcomment?u=u&m=m\r")
|
541
|
+
eq '{{mcomment
|
542
|
+
|0|u|m\n
|
543
|
+
}}
|
544
|
+
', page.load
|
545
|
+
|
546
|
+
page.store("{{mcomment}}\n")
|
547
|
+
res = session("POST /test/1.1.0.mcomment?u=u&m=m\n\r")
|
548
|
+
eq '{{mcomment
|
549
|
+
|0|u|m\n\n
|
550
|
+
}}
|
551
|
+
', page.load
|
552
|
+
end
|
553
|
+
end
|
554
|
+
end
|