Exemple #1
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"] = _(
                "Please select one of the show question list or show answers options"
            )
Exemple #2
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=_("faq_introlabel", default="Description"),
            description=_("faq_intro",
                          default="Text above the questions list"),
        ),
    ),
    BooleanField(
        "show_header",
        searchable=False,
        widget=BooleanWidget(
            label=_("faq_showheaderlabel", default="Show question list"),
            description=_(
                "faq_showheader",
                default="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.")),
    ),
Exemple #3
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")
Exemple #4
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.",
                ),
            ),
Exemple #5
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=_("faq_answer_label", default="Answer"),
                   description=_("faq_answer",
                                 default="The answer to the question."),
               )), ))

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

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


class FAQEntry(ATCTContent):
    """A frequently asked question."""
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):