Papasan製簡易掲示版の作成(作成途中)
Ploneの標準機能を利用した簡易掲示版
Ploneのドキュメントには、標準でコメントを付けられる機能がついている。
これを利用して、簡易掲示版を作る
1.掲示版のためのフォルダーを作る。ここではBBSと名付けた
「サイト設定」ー「Zope管理インターフェース」で、BBSのフォルダーにいく。
anonymousユーザが返答を書き込めるように、securityタブの「Repy to Item」のanonymousにチェックを入れる。この設定を継承するためにaquireのところにチェックが入っていなければ、いれておく。
2.コメント入力フォームの変更
「サイト設定」ー「Zope管理インターフェース(ZMI)」から/portal_skins/plone_form_scripts/discussion_reply
3.スクリプトの変更
「サイト設定」ー「Zope管理インターフェース(ZMI)」から/portal_skins/plone_form_scripts/discussion_reply
へ行ってCustomizeボタンを押す。
すると内容が
/portal_skins/custom/discussion_reply
にコピーされ、アドレスも変わります。
これを次のように変更します。
次の部分をコメントにします
"""
if username or password:
# The user username/password inputs on on the comment form were used,
# which might happen when anonymous commenting is enabled. If they typed
# something in to either of the inputs, we send them to 'logged_in'.
# 'logged_in' will redirect them back to this script if authentication
# succeeds with a query string which will post the message appropriately
# and show them the result. if 'logged_in' fails, the user will be
# presented with the stock login failure page. This all depends
# heavily on cookiecrumbler, but I believe that is a Plone requirement.
came_from = '%s?subject=%s&body_text=%s' % (req['URL'], subject, body_text)
came_from = url_quote_plus(came_from)
portal_url = context.portal_url()
return req.RESPONSE.redirect(
'%s/logged_in?__ac_name=%s'
'&__ac_password=%s'
'&came_from=%s' % (portal_url,
url_quote_plus(username),
url_quote_plus(password),
came_from,
)
)
"""
creatorを次のように変更。
#creator = mtool.getAuthenticatedMember().getUserName()
creator = username
以下Papasanからの情報であるが、今の私のレベルでは修正できそうもないのでじっくり挑戦することにする。
2.については、その通りです、ZPTなどを編集しています。
・ discussion_reply (Reply to content)
・ discussion_reply_form
・ getReplyReplies (gets the replies to an object)
・「Re:」は自分でPythonScriptを作ってます(4行だけですが)。
if rtitle:
if rtitle[:4] != 'Re: ':
rtitle = 'Re: ' + rtitle
return rtitle