Example #1
0
try:
    from Products.LinguaPlone.public import *
except ImportError:
    # No multilingual support
    from Products.Archetypes.public import *

schema = ATFolderSchema.copy() + Schema(
    (
        TextField(
            "description",
            searchable=True,
            required=True,
            accessor="Description",
            storage=MetadataStorage(),
            widget=VisualWidget(
                label=_(u"faq_introlabel", default=u"Description"),
                description=_(u"faq_intro", default=u"Text above the questions list"),
            ),
        ),
        BooleanField(
            "show_header",
            searchable=False,
            widget=BooleanWidget(
                label=_(u"faq_showheaderlabel", default=u"Show question list"),
                description=_(
                    u"faq_showheader",
                    default=u"Show a short list with all questions at the top of "
                    "the FAQ. This can make it navigation easier if you have "
                    "a large number of entries in your FAQ.",
                ),
            ),
Example #2
0
    def post_validate(self, REQUEST=None, errors={}):
        """Custom validator to check if either show_header or show_ansers is set.
        """

        if not (int(REQUEST.form.get("show_header", 1)) or int(REQUEST.form.get("show_answers", 1))):
            errors["show_header"] = _(u"Please select one of the show question list or show answers options")
Example #3
0
try:
    from Products.LinguaPlone.public import *
except ImportError:
    # No multilingual support
    from Products.Archetypes.public import *

schema  = ATContentTypeSchema.copy() + Schema((
    TextField("answer",
        required                = True,
        searchable              = True,
        primary                 = True,
        allowable_content_types = ('text/html', 'text/plain'),
        default_content_type    = 'text/html',
        default_output_type     = 'text/html',
        widget                  = RichWidget(
            label       = _(u"faq_answer_label", default=u"Answer"),
            description = _(u"faq_answer", default=u"The answer to the question."),
            )
        ),
    ))

schema['allowDiscussion'].schemata = 'default'
schema.delField('description')

schema["title"].widget=StringWidget(
                label             = _(u"faq_question_label", default=u"Question"),
                description       = _(u"faq_question", default=u"A commonly asked question.")
                )
schema.moveField("answer", after="title")

class FAQEntry(ATCTContent):