(連絡フォーム)

はじめに

Plone ships with a

  • site contact form which is form-to-mail to the site administration email
  • document comment form
  • email this to friend form

Default address /contact-info.

Customizing site contact form

Contact form files are

  • Products/CMFPlone/skins/plone_templates/contact-info.cpt
  • Products/CMFPlone/skins/plone_templates/contact-info.cpt.metadata
  • Products/CMFPlone/skins/plone_templates/site_feedback_template.pt
  • Products/CMFPlone/skins/plone_formscripts/validate_feedback.vpy
  • Products/CMFPlone/skins/plone_formscripts/send_feedback.cpy
  • Products/CMFPlone/skins/plone_formscripts/send_feedback.cpy.metadata
  • Products/CMFPlone/skins/plone_formscripts/send_feedback_site.cpy
  • Products/CMFPlone/skins/plone_formscripts/send_feedback_site.cpy.metadata

Inspect the files to known which you need to change. Copy these files to skin layer folder (any folder under skins) in your add-on product.

ノート

Different contact for is displayed for logged-in and anonymous users. Logged in user email is not asked, but one stored in member properties is used.

Example

Below is an example how to add “phone number” field for all not logged in users feedback form.

Add a new optional field to contact-info.cpt (language hardcoded):

<div class="field">

  <label for="phone_number">
    Puhelinnumero
  </label>

  <div class="formHelp">
    Puhelinnumero, mik&#xe4;li haluatte teihin oltavan yhteydess&#xe4; puhelimitse.
  </div>

  <input type="text"
         id="phone_number"
         name="phone_number"
         size="25"
         value=""
         tal:attributes="value request/phone_number|nothing"
         />
</div>

Refer this field in site_feedback_template.pt:

<div i18n:domain="plone"
     tal:omit-tag=""
     tal:define="utool nocall:here/portal_url;
                 portal utool/getPortalObject;
                 charset portal/email_charset|string:utf-8;
                 dummy python:request.RESPONSE.setHeader('Content-Type', 'text/plain;;charset=%s' % charset);"
>

<div i18n:translate="site_feedback_mailtemplate_body" tal:omit-tag="">

You are receiving this mail because <span i18n:name="fullname" tal:omit-tag="" tal:content="options/sender_fullname|nothing" />
<span i18n:name="from_address" tal:omit-tag="" tal:content="options/sender_from_address"/>
is sending feedback about the site administered by you at <span i18n:name="url" tal:replace="options/url" />.
The message sent was:

<span i18n:name="message" tal:omit-tag="" tal:content="options/message | nothing" />

</div>
--
<span tal:replace="portal/email_from_name" />

</div>

Puhelinnumero: <span tal:content="request/phone_number|nothing" />

ノート

As a crude hack we add new field to the very bottom of the email, as everything side <div i18n:translate> is replaced from translation catalogs.

目次

前のトピックへ

(Expressions)

次のトピックへ

(サイト設定)

このページ